@@ -721,7 +719,7 @@
-
+
@@ -740,7 +738,7 @@
-
+
@@ -767,7 +765,7 @@
-
+
diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py
index 1786336bedd..d0592128908 100644
--- a/addons/mrp/stock.py
+++ b/addons/mrp/stock.py
@@ -228,7 +228,7 @@ class stock_warehouse(osv.osv):
'route_id': manufacture_route_id,
'action': 'manufacture',
'picking_type_id': warehouse.int_type_id.id,
- 'procure_method': 'make_to_order',
+ 'propagate': False,
'warehouse_id': warehouse.id,
}
diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py
index b464f7045e6..14acd667866 100644
--- a/addons/mrp_operations/mrp_operations.py
+++ b/addons/mrp_operations/mrp_operations.py
@@ -97,7 +97,7 @@ class mrp_production_workcenter_line(osv.osv):
'delay': fields.float('Working Hours',help="The elapsed time between operation start and stop in this Work Center",readonly=True),
'production_state':fields.related('production_id','state',
type='selection',
- selection=[('draft','Draft'),('picking_except', 'Picking Exception'),('confirmed','Waiting Goods'),('ready','Ready to Produce'),('in_production','In Production'),('cancel','Canceled'),('done','Done')],
+ selection=[('draft','Draft'),('confirmed','Waiting Goods'),('ready','Ready to Produce'),('in_production','In Production'),('cancel','Canceled'),('done','Done')],
string='Production Status', readonly=True),
'product':fields.related('production_id','product_id',type='many2one',relation='product.product',string='Product',
readonly=True),
diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py
index 546ef5c60a9..69d970b7be6 100644
--- a/addons/purchase/stock.py
+++ b/addons/purchase/stock.py
@@ -112,7 +112,7 @@ class stock_warehouse(osv.osv):
'route_id': buy_route_id,
'action': 'buy',
'picking_type_id': warehouse.in_type_id.id,
- 'procure_method': 'make_to_order',
+ 'propagate': False,
'warehouse_id': warehouse.id,
}
diff --git a/addons/sale_mrp/test/cancellation_propagated.yml b/addons/sale_mrp/test/cancellation_propagated.yml
index 770601bac6d..0005e15db53 100644
--- a/addons/sale_mrp/test/cancellation_propagated.yml
+++ b/addons/sale_mrp/test/cancellation_propagated.yml
@@ -51,12 +51,17 @@
Confirm sales order
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_product_manu}
+-
+ I run scheduler.
+-
+ !python {model: procurement.order}: |
+ self.run_scheduler(cr, uid)
-
Check the propagation when we cancel the main procurement
* Retrieve related procurements and check that there are all running
* Check that the purchase order has been well created
* Cancel the main procurement
- * Check that all procurements related and the purchase order has been well cancelled
+ * Check that all procurements related and the purchase order has been well cancelled
-
!python {model: procurement.order}: |
# Retrieve related procu
@@ -65,7 +70,7 @@
assert len(procu_ids)>0, 'No procurements are found for sale order "%s" (with id : %d)' %(so.name, so.id)
# Check that all procurements are running
- for procu in self.browse(cr, uid, procu_ids, context=context):
+ for procu in self.browse(cr, uid, procu_ids, context=context):
assert procu.state == u'running', 'Procurement with id %d should be "running" but is with a state : %s!' %(procu.id, procu.state)
# Check that one production order exist
diff --git a/addons/sale_mrp/test/sale_mrp.yml b/addons/sale_mrp/test/sale_mrp.yml
index 82c8b6e8b12..85e25b502f3 100644
--- a/addons/sale_mrp/test/sale_mrp.yml
+++ b/addons/sale_mrp/test/sale_mrp.yml
@@ -100,7 +100,7 @@
!python {model: procurement.order}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
- proc_ids = self.search(cr, uid, [('origin','=',so.name)])
+ proc_ids = self.search(cr, uid, [('origin','like',so.name)])
self.run(cr, uid, proc_ids)
-
I verify that a procurement state is "running"
@@ -108,8 +108,8 @@
!python {model: procurement.order}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
- proc_ids = self.search(cr, uid, [('origin','like',so.name), ('state','=','running')])
- # Check that all procurement are running
+ proc_ids = self.search(cr, uid, [('origin','like',so.name)])
+ # Check that all procurement are running
for procu in self.browse(cr,uid,proc_ids,context=context):
assert procu.state == u'running', 'Procurement with id %d should be with a state "running" but is with a state : %s!' %(procu.id,procu.state)
-
diff --git a/addons/stock/procurement.py b/addons/stock/procurement.py
index 8b96ec48f2a..bdae93a4054 100644
--- a/addons/stock/procurement.py
+++ b/addons/stock/procurement.py
@@ -99,8 +99,7 @@ class procurement_order(osv.osv):
#set the context for the propagation of the procurement cancelation
ctx['cancel_procurement'] = True
for procurement in self.browse(cr, uid, to_cancel_ids, context=ctx):
- if procurement.rule_id and procurement.rule_id.propagate:
- self.propagate_cancel(cr, uid, procurement, context=ctx)
+ self.propagate_cancel(cr, uid, procurement, context=ctx)
return super(procurement_order, self).cancel(cr, uid, to_cancel_ids, context=ctx)
def _find_parent_locations(self, cr, uid, procurement, context=None):
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index e7fc3a36d05..7285ccd6ea9 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -2120,7 +2120,7 @@ class stock_move(osv.osv):
quants = quant_obj.quants_get_prefered_domain(cr, uid, move.location_id, move.product_id, qty, domain=main_domain[move.id], prefered_domain_list=[], restrict_lot_id=move.restrict_lot_id.id, restrict_partner_id=move.restrict_partner_id.id, context=context)
quant_obj.quants_reserve(cr, uid, quants, move, context=context)
- #force assignation of consumable products and incoming from supplier/inventory/production
+ #force assignation of consumable products and incoming from supplier/inventory/production
if to_assign_moves:
self.force_assign(cr, uid, to_assign_moves, context=context)
@@ -2144,6 +2144,14 @@ class stock_move(osv.osv):
#cancel chained moves
if move.propagate:
self.action_cancel(cr, uid, [move.move_dest_id.id], context=context)
+ # If we have a long chain of moves to be cancelled, it is easier for the user to handle
+ # only the last procurement which will go into exception, instead of all procurements
+ # along the chain going into exception. We need to check if there are no split moves not cancelled however
+ if move.procurement_id:
+ proc = move.procurement_id
+ if all([x.state == 'cancel' for x in proc.move_ids if x.id != move.id]):
+ procurement_obj.write(cr, uid, [proc.id], {'state': 'cancel'})
+
elif move.move_dest_id.state == 'waiting':
self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'}, context=context)
return self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False}, context=context)
@@ -2360,6 +2368,7 @@ class stock_move(osv.osv):
'restrict_lot_id': restrict_lot_id,
'restrict_partner_id': restrict_partner_id,
'split_from': move.id,
+ 'move_dest_id': move.move_dest_id.id,
}
if context.get('source_location_id'):
defaults['location_id'] = context['source_location_id']
diff --git a/addons/stock_dropshipping/test/cancellation_propagated.yml b/addons/stock_dropshipping/test/cancellation_propagated.yml
index cb68b582a6a..71f5e75385d 100644
--- a/addons/stock_dropshipping/test/cancellation_propagated.yml
+++ b/addons/stock_dropshipping/test/cancellation_propagated.yml
@@ -40,6 +40,11 @@
Confirm the sale order
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_product_mto}
+-
+ I run scheduler.
+-
+ !python {model: procurement.order}: |
+ self.run_scheduler(cr, uid)
-
Check the propagation when we cancel the main procurement
* Retrieve related procurements and check that there are all running
@@ -64,7 +69,7 @@
# Cancel the main procurement
main_procu_id = self.search(cr, uid, [('origin', '=', so.name)])
assert len(main_procu_id) == 1, 'Main procurement not identified !'
- self.cancel(cr, uid, main_procu_id, context=context)
+ self.cancel(cr, uid, main_procu_id, context=context)
assert self.browse(cr, uid, main_procu_id[0]).state == u'cancel', 'Main procurement should be cancelled !'
# Check that all procurements related are cancelled