Skip to content

Commit 2f402c7

Browse files
mmequignonchaule97
authored andcommitted
fixup! Refactor mto_route_product_variant
1 parent 2c12b0f commit 2f402c7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

stock_product_variant_mto/models/product_product.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ProductProduct(models.Model):
2424
route_ids = fields.Many2many(
2525
"stock.location.route",
2626
compute="_compute_route_ids",
27+
domain="[('product_selectable', '=', True)]",
2728
store=False
2829
)
2930

@@ -34,7 +35,7 @@ def _compute_is_mto(self):
3435
product.is_mto = False
3536
continue
3637
product.is_mto = mto_route in product.product_tmpl_id.route_ids
37-
38+
3839
@api.depends("is_mto", "product_tmpl_id.route_ids")
3940
def _compute_route_ids(self):
4041
mto_route = self.env.ref("stock.route_warehouse0_mto", raise_if_not_found=False)

stock_product_variant_mto/models/product_template.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def write(self, values):
2020
templates_mto_added = template_not_mto_before & templates_mto_after
2121
templates_mto_removed = (self - template_not_mto_before) & (self - templates_mto_after)
2222
(templates_mto_added | templates_mto_removed).product_variant_ids._compute_is_mto()
23+
return res
2324

2425
@api.onchange("route_ids")
2526
def onchange_route_ids(self):

0 commit comments

Comments
 (0)