Do no run mts mto procurement if it already has been splited into at least another procurement

This commit is contained in:
Florian da Costa
2016-03-10 15:22:13 +01:00
committed by Pierrick Brun
parent 94558043de
commit fb1cd6a3a5
2 changed files with 11 additions and 0 deletions

View File

@@ -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
===========

View File

@@ -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