[IMP] stock: Improve the splitinto wizard

bzr revid: sbh@tinyerp.com-20100831055950-qt563oayr1wyvxsl
This commit is contained in:
sbh (Open ERP)
2010-08-31 11:29:50 +05:30
parent 51b18ab6dc
commit 69eaae3a89
+6 -3
View File
@@ -41,7 +41,7 @@ class stock_split_into(osv.osv_memory):
quantity = self.browse(cr, uid, data[0], context).quantity or 0.0
for move in move_obj.browse(cr, uid, rec_id):
quantity_rest = move.product_qty - quantity
if move.tracking_id and quantity!= 0.0:
if move.tracking_id :
raise osv.except_osv(_('Error!'), _('The current move line is already assigned to a pack, please remove it first if you really want to change it ' \
'for this product: "%s" (id: %d)') % \
(move.product_id.name, move.product_id.id,))
@@ -59,14 +59,17 @@ class stock_split_into(osv.osv_memory):
if quantity_rest>0:
quantity_rest = move.product_qty - quantity
tracking_id = track_obj.create(cr, uid, {})
default_val = {
if quantity==0.0:
move_obj.write(cr, uid, [move.id], {'tracking_id': tracking_id})
else:
default_val = {
'product_qty': quantity_rest,
'product_uos_qty': quantity_rest,
'tracking_id': tracking_id,
'state': move.state,
'product_uos': move.product_uom.id
}
current_move = move_obj.copy(cr, uid, move.id, default_val)
current_move = move_obj.copy(cr, uid, move.id, default_val)
return {}
stock_split_into()