[IMP] stock: Improved code quality for precision and improved name for return moves(case:575526)
bzr revid: pso@tinyerp.com-20120608131901-3q63jkmv9x4xl1uc
This commit is contained in:
parent
8fc8797ccb
commit
99f7f15111
|
@ -163,9 +163,9 @@ class stock_return_picking(osv.osv_memory):
|
||||||
new_type = 'out'
|
new_type = 'out'
|
||||||
else:
|
else:
|
||||||
new_type = 'internal'
|
new_type = 'internal'
|
||||||
seq_obj_name = 'stock.picking.' + pick.type
|
seq_obj_name = 'stock.picking.' + new_type
|
||||||
seq_name = self.pool.get('ir.sequence').get(cr, uid, seq_obj_name)
|
new_pick_name = self.pool.get('ir.sequence').get(cr, uid, seq_obj_name)
|
||||||
new_picking = pick_obj.copy(cr, uid, pick.id, {'name': seq_name + '-return',
|
new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s-%s-return' % (new_pick_name, pick.name),
|
||||||
'move_lines':[], 'state':'draft', 'type':new_type,
|
'move_lines':[], 'state':'draft', 'type':new_type,
|
||||||
'date':date_cur, 'invoice_state':data['invoice_state'],})
|
'date':date_cur, 'invoice_state':data['invoice_state'],})
|
||||||
|
|
||||||
|
@ -178,10 +178,10 @@ class stock_return_picking(osv.osv_memory):
|
||||||
new_location = move.location_dest_id.id
|
new_location = move.location_dest_id.id
|
||||||
returned_qty = move.product_qty
|
returned_qty = move.product_qty
|
||||||
if new_qty > returned_qty:
|
if new_qty > returned_qty:
|
||||||
precision = '%0.' + str(dp.get_precision('Product UoM')(cr)[1] or 0) + 'f'
|
precision = self.pool.get('decimal.precision').precision_get(cr, uid, 'Product UoM')
|
||||||
raise osv.except_osv(_('Returning Error'),
|
raise osv.except_osv(_('Returning Error'),
|
||||||
_('Returning quantity %s for %s is larger than the available quantity %s !')\
|
_('Returning quantity %.*f for %s is larger than the available quantity %.*f!')\
|
||||||
% (precision % new_qty, move.product_id.name, precision % returned_qty))
|
% (precision, new_qty, move.product_id.name, precision, returned_qty))
|
||||||
for rec in move.move_history_ids2:
|
for rec in move.move_history_ids2:
|
||||||
returned_qty -= rec.product_qty
|
returned_qty -= rec.product_qty
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue