From ab9cb62c74006bcc619ec8d23dc12052e39a7a70 Mon Sep 17 00:00:00 2001 From: "Paolo (pgi)" Date: Wed, 20 Apr 2022 10:12:16 +0000 Subject: [PATCH] [FIX] purchase: tests should not rely on demo data Fixed the TestPurchaseInvoice.test_double_validation and the setupClass to use test accounting data in setupClass instead of the demo data. closes odoo/odoo#89370 X-original-commit: a7546aead36c5d56809fcd9c46b2a552991b5449 Signed-off-by: Steve Van Essche Signed-off-by: Paolo Gatti (pgi) --- addons/purchase/tests/test_access_rights.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/purchase/tests/test_access_rights.py b/addons/purchase/tests/test_access_rights.py index 855b0270b66..724b8726682 100644 --- a/addons/purchase/tests/test_access_rights.py +++ b/addons/purchase/tests/test_access_rights.py @@ -142,7 +142,16 @@ class TestPurchaseInvoice(AccountTestInvoicingCommon): """Only purchase managers can approve a purchase order when double validation is enabled""" group_purchase_manager = self.env.ref('purchase.group_purchase_manager') - order = self.env.ref("purchase.purchase_order_1") + order = self.env['purchase.order'].create({ + "partner_id": self.vendor.id, + "order_line": [ + (0, 0, { + 'product_id': self.product.id, + 'name': f'{self.product.name} {1:05}', + 'price_unit': 79.80, + 'product_qty': 15.0, + }), + ]}) company = order.sudo().company_id company.po_double_validation = 'two_step' company.po_double_validation_amount = 0