[MIG] account_invoice_constraint_chronology: Migration to 14.0
This commit is contained in:
parent
8f231112b8
commit
3ac663af91
@ -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",
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user