From fb1cd6a3a52e1090fe0d313c317cf071561915c8 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Thu, 10 Mar 2016 15:22:13 +0100 Subject: [PATCH] Do no run mts mto procurement if it already has been splited into at least another procurement --- stock_mts_mto_rule/README.rst | 9 +++++++++ stock_mts_mto_rule/model/procurement.py | 2 ++ 2 files changed, 11 insertions(+) diff --git a/stock_mts_mto_rule/README.rst b/stock_mts_mto_rule/README.rst index 00f85b320..91c13ea9c 100644 --- a/stock_mts_mto_rule/README.rst +++ b/stock_mts_mto_rule/README.rst @@ -49,6 +49,15 @@ Configuration You have to select 'Use MTO+MTS rules' on the company's warehouse form. +Known issues +============ + +If you cancel a delivery order and then recreate it from Recreate +Delivery Order button in sale order form, then the stock level at the time of +the Re-Creation won't be taken into account. So if a purchase order was created +when the sale order was first validated, a similar purchase order will be created +during the Re-creation of the delivery order, even if not needed regarding the actual stock. + Bug Tracker =========== diff --git a/stock_mts_mto_rule/model/procurement.py b/stock_mts_mto_rule/model/procurement.py index a92fb5bab..2a8586c57 100644 --- a/stock_mts_mto_rule/model/procurement.py +++ b/stock_mts_mto_rule/model/procurement.py @@ -92,6 +92,8 @@ class ProcurementOrder(models.Model): def _run(self, procurement): if procurement.rule_id and \ procurement.rule_id.action == 'split_procurement': + if procurement.mts_mto_procurement_ids: + return super(ProcurementOrder, self)._run(procurement) uom_obj = self.env['product.uom'] needed_qty = procurement.get_mto_qty_to_order() rule = procurement.rule_id