diff --git a/account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py b/account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py index 15482e4d782b..872d5a22337f 100644 --- a/account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py +++ b/account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py @@ -20,11 +20,16 @@ def setUpClass(cls): cls.product_2 = cls.env.ref("product.product_product_2") cls.product_1.invoice_policy = "order" cls.product_2.invoice_policy = "order" + eur = cls.env.ref("base.EUR") + cls.pricelist = cls.env["product.pricelist"].create( + {"name": "Europe pricelist", "currency_id": eur.id} + ) cls.order1_p1 = cls.env["sale.order"].create( { "partner_id": cls.partner_1.id, "partner_shipping_id": cls.partner_1.id, "partner_invoice_id": cls.partner_1.id, + "pricelist_id": cls.pricelist.id, "client_order_ref": "ref123", "order_line": [ ( @@ -58,6 +63,7 @@ def setUpClass(cls): "partner_id": cls.partner_1.id, "partner_shipping_id": cls.partner_1.id, "partner_invoice_id": cls.partner_1.id, + "pricelist_id": cls.pricelist.id, "order_line": [ ( 0, @@ -127,12 +133,7 @@ def test_create_invoice(self): def test_create_invoice_with_currency(self): """Check invoice is generated with a correct total amount""" - eur = self.env.ref("base.EUR") - pricelist = self.env["product.pricelist"].create( - {"name": "Europe pricelist", "currency_id": eur.id} - ) orders = self.order1_p1 | self.order2_p1 - orders.write({"pricelist_id": pricelist.id}) invoices = orders._create_invoices() self.assertEqual(invoices.amount_total, 80)