From 5925001c1912b4e8c85481a679d3dc5890b9beff Mon Sep 17 00:00:00 2001 From: oco-odoo Date: Mon, 8 Mar 2021 16:41:38 +0000 Subject: [PATCH] [IMP] account: tests framework: add explicit label to invoice lines created with only amount, to avoid crashing in some tests We also inject a context key to ignore prediction in case account_predictive_bills (enterprise) is installed. This way, having the same label on invoice lines generated by the helper will still behave in the same way, even if enterprise is installed. closes odoo/odoo#67998 X-original-commit: b6c37754532ae6a7cc1f68a345fde6258abdc893 Related: odoo/enterprise#17125 Signed-off-by: Laurent Smet Signed-off-by: oco-odoo --- addons/account/tests/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/tests/common.py b/addons/account/tests/common.py index dc840167e40..27301f76957 100644 --- a/addons/account/tests/common.py +++ b/addons/account/tests/common.py @@ -363,7 +363,7 @@ class AccountTestInvoicingCommon(TransactionCase): @classmethod def init_invoice(cls, move_type, partner=None, invoice_date=None, post=False, products=[], amounts=[], taxes=None): - move_form = Form(cls.env['account.move'].with_context(default_move_type=move_type)) + move_form = Form(cls.env['account.move'].with_context(default_move_type=move_type, account_predictive_bills_disable_prediction=True)) move_form.invoice_date = invoice_date or fields.Date.from_string('2019-01-01') move_form.partner_id = partner or cls.partner_a @@ -376,6 +376,9 @@ class AccountTestInvoicingCommon(TransactionCase): for amount in amounts: with move_form.invoice_line_ids.new() as line_form: + line_form.name = "test line" + # We use account_predictive_bills_disable_prediction context key so that + # this doesn't trigger prediction in case enterprise (hence account_predictive_bills) is installed line_form.price_unit = amount if taxes: line_form.tax_ids.clear()