[FIX] sale_mrp: fix the test_reset_avco_kit
The test is incorrect because a search is made on all product variants instead of getting only the previously-created product variants The SO action_cancel function returns a wizard that is not processed, so the so was never canceled. we should call the private function instead closes odoo/odoo#94742 X-original-commit: c4e6562e669881047802f25866f3c2c19bf2394a Signed-off-by: Adrien Widart <awt@odoo.com> Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
This commit is contained in:
@@ -185,7 +185,7 @@ class TestSaleMrpKitBom(TransactionCase):
|
||||
aluminium_legs = self.env['product.attribute.value'].create(
|
||||
{'attribute_id': attributes.id, 'name': 'Aluminium'})
|
||||
|
||||
product = self.env['product.product'].create({
|
||||
product_template = self.env['product.template'].create({
|
||||
'name': 'test product',
|
||||
'categ_id': product_category.id,
|
||||
'attribute_line_ids': [(0, 0, {
|
||||
@@ -193,9 +193,7 @@ class TestSaleMrpKitBom(TransactionCase):
|
||||
'value_ids': [(6, 0, [steel_legs.id, aluminium_legs.id])]
|
||||
})]
|
||||
})
|
||||
product_variant_ids = product.product_variant_ids.search([('id', '!=', product.id)])
|
||||
product_variant_ids[0].categ_id.property_cost_method = 'average'
|
||||
product_variant_ids[1].categ_id.property_cost_method = 'average'
|
||||
product_variant_ids = product_template.product_variant_ids
|
||||
# BoM 1 with component_1
|
||||
self.env['mrp.bom'].create({
|
||||
'product_id': product_variant_ids[0].id,
|
||||
@@ -225,7 +223,7 @@ class TestSaleMrpKitBom(TransactionCase):
|
||||
'order_id': so.id,
|
||||
})
|
||||
so.action_confirm()
|
||||
so.action_cancel()
|
||||
so._action_cancel()
|
||||
so.action_draft()
|
||||
with Form(so) as so_form:
|
||||
with so_form.order_line.edit(0) as order_line_change:
|
||||
|
||||
Reference in New Issue
Block a user