diff --git a/account_invoice_constraint_chronology/__manifest__.py b/account_invoice_constraint_chronology/__manifest__.py index dc9c0e1e..c04c8529 100644 --- a/account_invoice_constraint_chronology/__manifest__.py +++ b/account_invoice_constraint_chronology/__manifest__.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Account Invoice Constraint Chronology", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "author": "Odoo Community Association (OCA), ACSONE SA/NV, CorporateHub", "website": "https://github.com/OCA/account-financial-tools", "license": "AGPL-3", diff --git a/account_invoice_constraint_chronology/model/account_move.py b/account_invoice_constraint_chronology/model/account_move.py index e7fa076a..fa90e662 100644 --- a/account_invoice_constraint_chronology/model/account_move.py +++ b/account_invoice_constraint_chronology/model/account_move.py @@ -15,13 +15,10 @@ class AccountMove(models.Model): self.ensure_one() domain = [ ("journal_id", "=", self.journal_id.id), - ("type", "!=", "entry"), + ("move_type", "!=", "entry"), ] - if ( - self.journal_id.refund_sequence - and self.journal_id.sequence_id != self.journal_id.refund_sequence_id - ): - domain.append(("type", "=", self.type)) + if self.journal_id.refund_sequence: + domain.append(("move_type", "=", self.move_type)) return domain def _get_older_conflicting_invoices_domain(self): diff --git a/account_invoice_constraint_chronology/tests/test_account_invoice_constraint_chronology.py b/account_invoice_constraint_chronology/tests/test_account_invoice_constraint_chronology.py index a983a392..03a03fc8 100644 --- a/account_invoice_constraint_chronology/tests/test_account_invoice_constraint_chronology.py +++ b/account_invoice_constraint_chronology/tests/test_account_invoice_constraint_chronology.py @@ -20,23 +20,12 @@ class TestAccountInvoiceConstraintChronology(common.SavepointCase): cls.yesterday = cls.today - timedelta(days=1) cls.tomorrow = cls.today + timedelta(days=1) - cls.IrSequence = cls.env["ir.sequence"] - cls.sale_journal_sequence = cls.IrSequence.create( - { - "name": "Sale journal sequence", - "prefix": "SALE", - "padding": 6, - "company_id": cls.company.id, - } - ) - cls.AccountJournal = cls.env["account.journal"] cls.sale_journal = cls.AccountJournal.create( { "name": "Sale journal", "code": "SALE", "type": "sale", - "sequence_id": cls.sale_journal_sequence.id, "check_chronology": True, } ) @@ -46,7 +35,7 @@ class TestAccountInvoiceConstraintChronology(common.SavepointCase): cls.AccountMove = cls.env["account.move"] with common.Form( - cls.AccountMove.with_context(default_type="out_invoice") + cls.AccountMove.with_context(default_move_type="out_invoice") ) as invoice_form: invoice_form.invoice_date = cls.today invoice_form.partner_id = cls.partner_2