[IMP] mrp: new procurement group for MTO manufacture product

The purpose is to split up the supply chain in different group.
Currently if a user create a SO with a MTO manufacture product
that use MTO/buy components.
SO cancellation will:
- Cancel all the pickings including pickings between MO and suppliers.
- Log an activity on the MO but not cancel it.

We prefer cancel all transfers between SO and MO when the SO is cancel.
Cancel all the transfers between MO and suppliers when the MO is cancel.

Create a new procurement group when the _run_manufacture method is call
allows to achieve this behavior.
This commit is contained in:
Arnold Moyaux
2018-08-13 15:38:34 +02:00
parent bf592f7b86
commit c5b3f41fbd
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ class StockRule(models.Model):
'bom_id': bom.id,
'date_planned_start': fields.Datetime.to_string(self._get_date_planned(product_id, values)),
'date_planned_finished': values['date_planned'],
'procurement_group_id': values.get('group_id').id if values.get('group_id', False) else False,
'procurement_group_id': False,
'propagate': self.propagate,
'picking_type_id': self.picking_type_id.id or values['warehouse_id'].manu_type_id.id,
'company_id': values['company_id'].id,
+1 -1
View File
@@ -215,7 +215,7 @@ class TestSaleMrpFlow(common.TransactionCase):
# <><><><><><><><><><><><><><><><><><><><><><>
# FP Todo: find a better way to look for the production order
mnf_product_d = self.MrpProduction.search([('product_id', '=', product_d.id), ('move_dest_ids.group_id', '=', order.procurement_group_id.id)], order='id desc', limit=1)
mnf_product_d = self.MrpProduction.search([('product_id', '=', product_d.id)], order='id desc', limit=1)
# Check state of production order D.
self.assertEqual(mnf_product_d.state, 'confirmed', 'Manufacturing order should be confirmed.')