[FIX] repair: avoid running test without necessary module

Previous fix odoo/odoo#135784 added a test to repair that references
a sale_order_line field that only exists when the sale_margin module is
installed. Unfortunately there isn't already a common module that
requires both repair + sale_margin and runbot doesn't do single module
app tests so this test slipped through the cracks.

To avoid the error when the nightly single module tests occur, we avoid
running the test when sale_margin is installed since it will still run
during standard runbot tests and ensure that the bug doesn't return.

closes odoo/odoo#137490

X-original-commit: 6343e2f3125bb48b01bf5b1ef7be36d86ae35f86
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
This commit is contained in:
Tiffany Chang (tic)
2023-10-04 08:39:20 +00:00
parent 2650d402af
commit dfdaa9e5fe
+2
View File
@@ -507,6 +507,8 @@ class TestRepair(common.TransactionCase):
Test that the purchase price is correctly set on the SO line,
when creating a SO from a repair order.
"""
if not self.env['ir.module.module'].search([('name', '=', 'sale_margin'), ('state', '=', 'installed')]):
self.skipTest("sale_margin is not installed, so there is no purchase price to test")
self.product_product_11.standard_price = 10
repair = self.env['repair.order'].create({
'partner_id': self.res_partner_1.id,