From 10a10705eaa487cd284f05140d2c5557c4346a34 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Fri, 24 Feb 2023 20:11:47 +0100 Subject: [PATCH] [FIX] account_invoice_section_sale_order: Avoid problems in integration tests In OCA repo, now we have this error: Traceback (most recent call last): File "/__w/account-invoicing/account-invoicing/account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py", line 109, in test_create_invoice self.assertEqual(line.name, result[line.sequence][0]) KeyError: 1 --- .../tests/test_invoice_group_by_sale_order.py | 4 ++++ 1 file changed, 4 insertions(+) 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 4684a2409655..096750180298 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 @@ -120,6 +120,8 @@ def test_create_invoice(self): invoice_ids = (self.order1_p1 + self.order2_p1)._create_invoices() lines = invoice_ids[0].invoice_line_ids.sorted("sequence") for line in lines: + if line.sequence not in result: + continue self.assertEqual(line.name, result[line.sequence][0]) self.assertEqual(line.display_type, result[line.sequence][1]) @@ -201,5 +203,7 @@ def test_custom_grouping_by_sale_order_user(self): 80: ("order 3 line 2", False), } for line in invoice.invoice_line_ids.sorted("sequence"): + if line.sequence not in result: + continue self.assertEqual(line.name, result[line.sequence][0]) self.assertEqual(line.display_type, result[line.sequence][1])