From 03a6baede8f554d8262c6559c1e818dd23a87ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BEAU?= Date: Mon, 6 Jun 2022 09:14:06 +0200 Subject: [PATCH 1/2] stock_mts_mto_rule: remove useless constraint Having the same src location is not needed and maybe wanted in some case For example the Manufacturing can be done in an other warehouse --- stock_mts_mto_rule/models/stock_rule.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/stock_mts_mto_rule/models/stock_rule.py b/stock_mts_mto_rule/models/stock_rule.py index aec5321c3..b63189e79 100644 --- a/stock_mts_mto_rule/models/stock_rule.py +++ b/stock_mts_mto_rule/models/stock_rule.py @@ -25,16 +25,6 @@ class StockRule(models.Model): "No MTS or MTO rule configured on procurement " "rule: %s!" ) % (rule.name,) raise ValidationError(msg) - if ( - rule.mts_rule_id.location_src_id.id - != rule.mto_rule_id.location_src_id.id - ): - msg = _( - "Inconsistency between the source locations of " - "the mts and mto rules linked to the procurement " - "rule: %s! It should be the same." - ) % (rule.name,) - raise ValidationError(msg) def get_mto_qty_to_order(self, product, product_qty, product_uom, values): self.ensure_one() From cb32477639c69c1ad9afc35e7223ed2a9e075653 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Mon, 17 Oct 2022 16:50:30 +0200 Subject: [PATCH 2/2] [FIX] stock_mts_mto_rule: fix tests after the removal of a constrains --- stock_mts_mto_rule/tests/test_mto_mts_route.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/stock_mts_mto_rule/tests/test_mto_mts_route.py b/stock_mts_mto_rule/tests/test_mto_mts_route.py index e4370952a..486d0d4d7 100644 --- a/stock_mts_mto_rule/tests/test_mto_mts_route.py +++ b/stock_mts_mto_rule/tests/test_mto_mts_route.py @@ -150,8 +150,6 @@ class TestMtoMtsRoute(TransactionCase): ) with self.assertRaises(exceptions.ValidationError): rule.write({"mts_rule_id": False}) - with self.assertRaises(exceptions.ValidationError): - rule.write({"mts_rule_id": self.dummy_rule.id}) def test_mts_mto_route_mto_removed(self): self.env.ref("stock_mts_mto_rule.route_mto_mts").unlink()