mirror of
https://github.com/brain-tec/account_ebics.git
synced 2024-11-23 20:52:04 +00:00
[14.0]black, isort, prettier
This commit is contained in:
parent
d6456146ef
commit
f720844f1a
@ -2,16 +2,14 @@
|
|||||||
# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl).
|
# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl).
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Upload Payment Order via EBICS',
|
"name": "Upload Payment Order via EBICS",
|
||||||
'version': '14.0.1.0.0',
|
"version": "14.0.1.0.0",
|
||||||
'license': 'LGPL-3',
|
"license": "LGPL-3",
|
||||||
'author': 'Noviat',
|
"author": "Noviat",
|
||||||
'category': 'Accounting & Finance',
|
"category": "Accounting & Finance",
|
||||||
'depends': [
|
"depends": ["account_ebics", "account_payment_order"],
|
||||||
'account_ebics',
|
"data": [
|
||||||
'account_payment_order'],
|
"views/account_payment_order.xml",
|
||||||
'data': [
|
|
||||||
'views/account_payment_order.xml',
|
|
||||||
],
|
],
|
||||||
'installable': True,
|
"installable": True,
|
||||||
}
|
}
|
||||||
|
@ -6,57 +6,69 @@ from odoo.exceptions import UserError
|
|||||||
|
|
||||||
|
|
||||||
class AccountPaymentOrder(models.Model):
|
class AccountPaymentOrder(models.Model):
|
||||||
_inherit = 'account.payment.order'
|
_inherit = "account.payment.order"
|
||||||
|
|
||||||
def ebics_upload(self):
|
def ebics_upload(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
ctx = self._context.copy()
|
ctx = self._context.copy()
|
||||||
attach = self.env['ir.attachment'].search(
|
attach = self.env["ir.attachment"].search(
|
||||||
[('res_model', '=', self._name),
|
[("res_model", "=", self._name), ("res_id", "=", self.id)]
|
||||||
('res_id', '=', self.id)])
|
)
|
||||||
if not attach:
|
if not attach:
|
||||||
raise UserError(_(
|
raise UserError(
|
||||||
"This payment order doesn't contains attachements."
|
_(
|
||||||
"\nPlease generate first the Payment Order file first."))
|
"This payment order doesn't contains attachements."
|
||||||
|
"\nPlease generate first the Payment Order file first."
|
||||||
|
)
|
||||||
|
)
|
||||||
elif len(attach) > 1:
|
elif len(attach) > 1:
|
||||||
raise UserError(_(
|
raise UserError(
|
||||||
"This payment order contains multiple attachments."
|
_(
|
||||||
"\nPlease remove the obsolete attachments or upload "
|
"This payment order contains multiple attachments."
|
||||||
"the payment order file via the "
|
"\nPlease remove the obsolete attachments or upload "
|
||||||
"EBICS Processing > EBICS Upload menu"))
|
"the payment order file via the "
|
||||||
|
"EBICS Processing > EBICS Upload menu"
|
||||||
|
)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
origin = _("Payment Order") + ': ' + self.name
|
origin = _("Payment Order") + ": " + self.name
|
||||||
ebics_config = self.env['ebics.config'].search([
|
ebics_config = self.env["ebics.config"].search(
|
||||||
('journal_ids', '=', self.journal_id.id),
|
[
|
||||||
('state', '=', 'confirm'),
|
("journal_ids", "=", self.journal_id.id),
|
||||||
])
|
("state", "=", "confirm"),
|
||||||
|
]
|
||||||
|
)
|
||||||
if not ebics_config:
|
if not ebics_config:
|
||||||
raise UserError(_(
|
raise UserError(
|
||||||
"No active EBICS configuration available "
|
_(
|
||||||
"for the selected bank."
|
"No active EBICS configuration available "
|
||||||
))
|
"for the selected bank."
|
||||||
|
)
|
||||||
|
)
|
||||||
if len(ebics_config) == 1:
|
if len(ebics_config) == 1:
|
||||||
ctx["default_ebics_config_id"] = ebics_config.id
|
ctx["default_ebics_config_id"] = ebics_config.id
|
||||||
ctx.update({
|
ctx.update(
|
||||||
'default_upload_data': attach.datas,
|
{
|
||||||
'default_upload_fname': attach.name,
|
"default_upload_data": attach.datas,
|
||||||
'origin': origin,
|
"default_upload_fname": attach.name,
|
||||||
'force_comany': self.company_id.id,
|
"origin": origin,
|
||||||
})
|
"force_comany": self.company_id.id,
|
||||||
ebics_xfer = self.env['ebics.xfer'].with_context(ctx).create({})
|
}
|
||||||
|
)
|
||||||
|
ebics_xfer = self.env["ebics.xfer"].with_context(ctx).create({})
|
||||||
ebics_xfer._onchange_ebics_config_id()
|
ebics_xfer._onchange_ebics_config_id()
|
||||||
ebics_xfer._onchange_upload_data()
|
ebics_xfer._onchange_upload_data()
|
||||||
ebics_xfer._onchange_format_id()
|
ebics_xfer._onchange_format_id()
|
||||||
view = self.env.ref('account_ebics.ebics_xfer_view_form_upload')
|
view = self.env.ref("account_ebics.ebics_xfer_view_form_upload")
|
||||||
act = {
|
act = {
|
||||||
'name': _('EBICS Upload'),
|
"name": _("EBICS Upload"),
|
||||||
'view_type': 'form',
|
"view_type": "form",
|
||||||
'view_mode': 'form',
|
"view_mode": "form",
|
||||||
'res_model': 'ebics.xfer',
|
"res_model": "ebics.xfer",
|
||||||
'view_id': view.id,
|
"view_id": view.id,
|
||||||
'res_id': ebics_xfer.id,
|
"res_id": ebics_xfer.id,
|
||||||
'type': 'ir.actions.act_window',
|
"type": "ir.actions.act_window",
|
||||||
'target': 'new',
|
"target": "new",
|
||||||
'context': ctx,
|
"context": ctx,
|
||||||
}
|
}
|
||||||
return act
|
return act
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
<record id="account_payment_order_form" model="ir.ui.view">
|
<record id="account_payment_order_form" model="ir.ui.view">
|
||||||
<field name="name">account.payment.order.form</field>
|
<field name="name">account.payment.order.form</field>
|
||||||
<field name="model">account.payment.order</field>
|
<field name="model">account.payment.order</field>
|
||||||
<field name="inherit_id" ref="account_payment_order.account_payment_order_form"/>
|
<field name="inherit_id" ref="account_payment_order.account_payment_order_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<button name="open2generated" position="after">
|
<button name="open2generated" position="after">
|
||||||
<button name="ebics_upload" type="object" states="generated"
|
<button
|
||||||
string="EBICS Upload" class="oe_highlight"/>
|
name="ebics_upload"
|
||||||
|
type="object"
|
||||||
|
states="generated"
|
||||||
|
string="EBICS Upload"
|
||||||
|
class="oe_highlight"
|
||||||
|
/>
|
||||||
</button>
|
</button>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
Loading…
Reference in New Issue
Block a user