From 269fa239eae8c49ecf62d7226c4401c4f069b145 Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Tue, 17 Nov 2026 11:22:54 +0000 Subject: [PATCH] [FIX] account_invoice_margin_sale: fix test setup for 19.0 Invoice lines get no account when no chart of accounts is installed, which is the case for at-install tests on a fresh database (e.g. Odoo.sh test builds). Give the company an income account and the sale journal a default account so lines resolve one. Assisted-by: Devin:SWE-2 Flash --- .../tests/test_account_invoice_margin_sale.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py index a743a8b8..48341be1 100644 --- a/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py +++ b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py @@ -23,6 +23,17 @@ def setUpClass(cls): } ) cls.partner.property_account_receivable_id = cls.account + # No chart of accounts is installed during at-install tests on a + # fresh database, so provide the accounts invoice lines need. + cls.income_account = cls.env["account.account"].create( + { + "name": "Test income account", + "code": "TESTINC", + "account_type": "income", + } + ) + cls.env.company.income_account_id = cls.income_account + cls.journal.default_account_id = cls.income_account cls.product_categ = cls.env["product.category"].create( {"name": "Test category"} )