From bd2d666e59e29fa821737951b4268a5df4a11685 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 24 Dec 2020 01:04:56 +0100 Subject: [PATCH] [IMP] account_banking_mandate: black, isort, etc... --- .../models/account_banking_mandate.py | 8 +++---- .../models/account_move_line.py | 4 +++- .../tests/test_invoice_mandate.py | 13 +++++++----- .../views/account_banking_mandate_view.xml | 21 +++++++++++++------ .../odoo/addons/account_banking_mandate | 1 + setup/account_banking_mandate/setup.py | 6 ++++++ 6 files changed, 36 insertions(+), 17 deletions(-) create mode 120000 setup/account_banking_mandate/odoo/addons/account_banking_mandate create mode 100644 setup/account_banking_mandate/setup.py diff --git a/account_banking_mandate/models/account_banking_mandate.py b/account_banking_mandate/models/account_banking_mandate.py index c67782408..4cf2f2098 100644 --- a/account_banking_mandate/models/account_banking_mandate.py +++ b/account_banking_mandate/models/account_banking_mandate.py @@ -64,7 +64,8 @@ class AccountBankingMandate(models.Model): string="Unique Mandate Reference", tracking=10, copy=False ) signature_date = fields.Date( - string="Date of Signature of the Mandate", tracking=50, + string="Date of Signature of the Mandate", + tracking=50, ) scan = fields.Binary(string="Scan of the Mandate") last_debit_date = fields.Date(string="Date of the Last Debit", readonly=True) @@ -135,10 +136,7 @@ class AccountBankingMandate(models.Model): def _check_dates(self): today = fields.Date.context_today(self) for mandate in self: - if ( - mandate.signature_date - and mandate.signature_date > today - ): + if mandate.signature_date and mandate.signature_date > today: raise ValidationError( _("The date of signature of mandate '%s' " "is in the future!") % mandate.unique_mandate_reference diff --git a/account_banking_mandate/models/account_move_line.py b/account_banking_mandate/models/account_move_line.py index 4cbd314ac..9b8e77a91 100644 --- a/account_banking_mandate/models/account_move_line.py +++ b/account_banking_mandate/models/account_move_line.py @@ -10,7 +10,9 @@ class AccountMoveLine(models.Model): _inherit = "account.move.line" mandate_id = fields.Many2one( - "account.banking.mandate", string="Direct Debit Mandate", ondelete="restrict", + "account.banking.mandate", + string="Direct Debit Mandate", + ondelete="restrict", check_company=True, ) diff --git a/account_banking_mandate/tests/test_invoice_mandate.py b/account_banking_mandate/tests/test_invoice_mandate.py index 0694c663b..c24b9e91a 100644 --- a/account_banking_mandate/tests/test_invoice_mandate.py +++ b/account_banking_mandate/tests/test_invoice_mandate.py @@ -230,8 +230,10 @@ class TestInvoiceMandate(TransactionCase): bank_journal = self.env["account.journal"].search( [ ("type", "=", "bank"), - ('company_id', '=', self.company.id), - ], limit=1) + ("company_id", "=", self.company.id), + ], + limit=1, + ) self.mode_inbound_acme.variable_journal_ids = bank_journal self.mode_inbound_acme.payment_method_id.mandate_required = True self.mode_inbound_acme.payment_order_ok = True @@ -284,9 +286,10 @@ class TestInvoiceMandate(TransactionCase): "move_type": "out_invoice", "company_id": self.company.id, "journal_id": self.env["account.journal"] - .search([ - ("type", "=", "sale"), - ('company_id', '=', self.company.id)], limit=1) + .search( + [("type", "=", "sale"), ("company_id", "=", self.company.id)], + limit=1, + ) .id, "invoice_line_ids": invoice_vals, } diff --git a/account_banking_mandate/views/account_banking_mandate_view.xml b/account_banking_mandate/views/account_banking_mandate_view.xml index 85d69305f..c31374da4 100644 --- a/account_banking_mandate/views/account_banking_mandate_view.xml +++ b/account_banking_mandate/views/account_banking_mandate_view.xml @@ -37,7 +37,11 @@ confirm="You should set a mandate back to draft only if you cancelled it by mistake. Do you want to continue?" invisible="context.get('mandate_bank_partner_view')" /> - +
@@ -64,15 +68,17 @@ invisible="context.get('mandate_bank_partner_view')" readonly="True" /> - +
- +
@@ -148,11 +154,14 @@ groups="account_payment_order.group_account_payment" attrs="{'invisible': ['|', ('id', '=', False), ('state', '!=', 'cancel')]}" /> - + decoration-warning="state == 'expired'" + /> diff --git a/setup/account_banking_mandate/odoo/addons/account_banking_mandate b/setup/account_banking_mandate/odoo/addons/account_banking_mandate new file mode 120000 index 000000000..0e535383d --- /dev/null +++ b/setup/account_banking_mandate/odoo/addons/account_banking_mandate @@ -0,0 +1 @@ +../../../../account_banking_mandate \ No newline at end of file diff --git a/setup/account_banking_mandate/setup.py b/setup/account_banking_mandate/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/account_banking_mandate/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)