diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 9788a0c33d8..357da1a3927 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -61,7 +61,7 @@ class stock_location(osv.osv):
_order = 'parent_left'
def name_get(self, cr, uid, ids, context=None):
res = self._complete_name(cr, uid, ids, 'complete_name', None, context=context)
- return res.items()
+ return res.items()
def _complete_name(self, cr, uid, ids, name, args, context=None):
""" Forms complete name of location from parent location to child location.
@@ -432,7 +432,7 @@ class stock_picking(osv.osv):
res[pick.id] = 'done'
continue
- order = {'confirmed':0, 'auto':1, 'assigned':2}
+ order = {'confirmed':0, 'waiting':1, 'assigned':2}
order_inv = dict(zip(order.values(),order.keys()))
lst = [order[x.state] for x in pick.move_lines if x.state not in ('cancel','done')]
if pick.move_lines == 'one':
@@ -467,7 +467,7 @@ class stock_picking(osv.osv):
'stock.move': (_get_pickings, ['state', 'picking_id'], 20)}, selection = [
('draft', 'Draft'),
('cancel', 'Cancelled'),
- ('auto', 'Waiting Another Operation'),
+ ('waiting', 'Waiting Another Operation'),
('confirmed', 'Waiting Availability'),
('assigned', 'Ready to Transfer'),
('done', 'Transferred'),
@@ -697,7 +697,8 @@ class stock_picking(osv.osv):
self.action_done(cr, uid, [picking.id], context=context)
continue
for op in picking.pack_operation_ids:
- if op.package_id:
+ #TODO: op.package_id can not work as quants_get is not defined on quant package => gives traceback
+ if op.package_id:
for quant in quant_package_obj.quants_get(cr, uid, op.package_id, context=context):
self._do_partial_product_move(cr, uid, picking, quant.product_id, quant.qty, quant, context=context)
op.package_id.write(cr, uid, {
@@ -705,12 +706,14 @@ class stock_picking(osv.osv):
}, context=context)
elif op.product_id:
moves = self._do_partial_product_move(cr, uid, picking, op.product_id, op.product_qty, op.quant_id, context=context)
+
quants = []
for m in moves:
for quant in m.quant_ids:
quants.append(quant.id)
quant_obj.write(cr, uid, quants, {
'package_id': op.result_package_id.id
+
}, context=context)
self._create_backorder(cr, uid, picking, context=context)
@@ -1199,7 +1202,7 @@ class stock_move(osv.osv):
('group_id', '=', move.group_id.id),
('location_id', '=', move.location_id.id),
('location_dest_id', '=', move.location_dest_id.id),
- ('state', 'in', ['confirmed', 'auto'])], context=context)
+ ('state', 'in', ['confirmed', 'waiting'])], context=context)
if picks:
pick = picks[0]
else:
@@ -1506,7 +1509,7 @@ class stock_move(osv.osv):
self.write(cr, uid, [move.id], {
'product_uom_qty': move.product_uom_qty - uom_qty,
'product_uos_qty': move.product_uos_qty - uos_qty,
- 'reserved_quant_ids': []
+ 'reserved_quant_ids': [(6,0,[])]
}, context=context)
return new_move
@@ -1932,7 +1935,6 @@ class stock_pack_operation(osv.osv):
'lot_id': fields.many2one('stock.production.lot', 'Lot/Serial Number'),
'result_package_id': fields.many2one('stock.quant.package', 'Container Package', help="If set, the operations are packed into this package", required=False, ondelete='cascade'),
'date': fields.datetime('Date', required=True),
- #'lot_id': fields.many2one('stock.production.lot', 'Serial Number', ondelete='CASCADE'),
#'update_cost': fields.boolean('Need cost update'),
'cost': fields.float("Cost", help="Unit Cost for this product line"),
'currency': fields.many2one('res.currency', string="Currency", help="Currency in which Unit cost is expressed", ondelete='CASCADE'),
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index da202f04d10..575712ad771 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -1046,7 +1046,7 @@
ir.actions.act_window
form
tree,form
- ['|','&',('picking_id','=',False),('location_id.usage', 'in', ['customer','supplier']),'&',('picking_id','!=',False)]
+
{'product_receive': True, 'search_default_future': True}
@@ -1141,7 +1141,7 @@
ir.actions.act_window
form
tree,form
- ['|','&',('picking_id','=',False),('location_dest_id.usage', 'in', ['customer','supplier']),'&',('picking_id','!=',False)]
+
{'search_default_future': True}
diff --git a/addons/stock/test/procrule.yml b/addons/stock/test/procrule.yml
index a8baad650e8..d1762ae4806 100644
--- a/addons/stock/test/procrule.yml
+++ b/addons/stock/test/procrule.yml
@@ -1,5 +1,11 @@
-
- Create new delivery order from output -> customers
+ Create new global procurement rule from Stock -> Output
+-
+ !record {model: procurement.rule, ref:}
+ location_id: stock
+ location_dest_id: output
+-
+ Create Delivery Order from Output -> Customer
-
!record {model: stock.picking, ref:}
-
diff --git a/addons/stock_complex_routes/test/procurementexception.yml b/addons/stock_complex_routes/test/procurementexception.yml
new file mode 100644
index 00000000000..67afc101089
--- /dev/null
+++ b/addons/stock_complex_routes/test/procurementexception.yml
@@ -0,0 +1,37 @@
+-
+ Create product with no seller_ids
+-
+
+-
+ Create a sales order with 1 piece for that product and route crossdock
+-
+ !record{sale.order}
+-
+ Confirm sales order
+-
+ !python {
+-
+ Check there is a procurement in exception that has the procurement group of the sales order
+-
+ !python {
+ assert
+-
+ Adjust the product that it has at least one seller_id
+-
+ !record{id: model: product.product) or in !python
+-
+ Run the Scheduler
+-
+ !python
+-
+ Check the status changed there is no procurement order in exception any more from that procurement group
+-
+ !python{model: procurement.order}
+ search procurement from
+-
+ Check a purchase quotation was created
+-
+
+
+
+
diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py
index 668b80ae72a..7f27496ff0d 100644
--- a/addons/stock_location/stock_location.py
+++ b/addons/stock_location/stock_location.py
@@ -52,9 +52,6 @@ class stock_location_path(osv.osv):
'name': fields.char('Operation', size=64),
'company_id': fields.many2one('res.company', 'Company'),
'route_id': fields.many2one('stock.location.route', 'Route'),
-
- 'product_id' : fields.many2one('product.product', 'Products', ondelete='cascade', select=1),
-
'location_from_id' : fields.many2one('stock.location', 'Source Location', ondelete='cascade', select=1, required=True),
'location_dest_id' : fields.many2one('stock.location', 'Destination Location', ondelete='cascade', select=1, required=True),
'delay': fields.integer('Delay (days)', help="Number of days to do this transition"),
@@ -62,7 +59,7 @@ class stock_location_path(osv.osv):
("invoiced", "Invoiced"),
("2binvoiced", "To Be Invoiced"),
("none", "Not Applicable")], "Invoice Status",
- required=True,),
+ required=True,),
'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', help="This is the picking type associated with the different pickings"),
'auto': fields.selection(
[('auto','Automatic Move'), ('manual','Manual Operation'),('transparent','Automatic No Step Added')],
@@ -254,14 +251,15 @@ class stock_move(osv.osv):
def _push_apply(self, cr, uid, moves, context):
for move in moves:
- for route in move.product_id.route_ids:
- found = False
- for rule in route.push_ids:
- if rule.location_from_id.id == move.location_dest_id.id:
- self.pool.get('stock.location.path')._apply(cr, uid, rule, move, context=context)
- found = True
- break
- if found: break
+ if not move.move_dest_id:
+ for route in move.product_id.route_ids:
+ found = False
+ for rule in route.push_ids:
+ if rule.location_from_id.id == move.location_dest_id.id:
+ self.pool.get('stock.location.path')._apply(cr, uid, rule, move, context=context)
+ found = True
+ break
+ if found: break
return True
# Create the stock.move.putaway records
@@ -272,16 +270,16 @@ class stock_move(osv.osv):
if putaway:
# Should call different methods here in later versions
# TODO: take care of lots
- if putaway.method == 'fixed' and putaway.location_id:
+ if putaway.method == 'fixed' and putaway.location_spec_id:
moveputaway_obj.create(cr, uid, {'move_id': move.id,
- 'location_id': putaway.location_id.id,
+ 'location_id': putaway.location_spec_id.id,
'quantity': move.product_uom_qty}, context=context)
return True
def action_assign(self, cr, uid, ids, context=None):
- result = super(stock_move, self).action_assign(cr, uid, ids, context=context)
- self._putaway_apply(cr, uid, ids, context=context)
- return result
+ result = super(stock_move, self).action_assign(cr, uid, ids, context=context)
+ self._putaway_apply(cr, uid, ids, context=context)
+ return result
def action_confirm(self, cr, uid, ids, context=None):
result = super(stock_move, self).action_confirm(cr, uid, ids, context)
@@ -289,6 +287,8 @@ class stock_move(osv.osv):
self._push_apply(cr, uid, moves, context=context)
return result
+
+
def _create_procurement(self, cr, uid, move, context=None):
"""
Next to creating the procurement order, it will propagate the routes
diff --git a/addons/stock_location/stock_location_demo_cpu3.yml b/addons/stock_location/stock_location_demo_cpu3.yml
index 52a18c4a68e..d1d4a2c8348 100644
--- a/addons/stock_location/stock_location_demo_cpu3.yml
+++ b/addons/stock_location/stock_location_demo_cpu3.yml
@@ -21,7 +21,6 @@
-
!record {model: stock.location.path, id: push_pick}:
name: Pick List
- product_id: product.product_product_10
location_from_id: stock.stock_location_output
location_dest_id: location_pack_zone
picking_type_id: stock.picking_type_internal
\ No newline at end of file
diff --git a/addons/stock_location/stock_location_view.xml b/addons/stock_location/stock_location_view.xml
index 088dceb8803..8a42f2afb46 100644
--- a/addons/stock_location/stock_location_view.xml
+++ b/addons/stock_location/stock_location_view.xml
@@ -87,14 +87,15 @@