[IMP] stock: Improve the splitinto wizard
bzr revid: sbh@tinyerp.com-20100831055950-qt563oayr1wyvxsl
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user