[REM] stock : Remove the move_stock_return_history field and use the move_history_ids

bzr revid: sbh@tinyerp.com-20100901060133-3njqgnlefvo5iaxn
This commit is contained in:
sbh (Open ERP)
2010-09-01 11:31:33 +05:30
parent a8a86ff19d
commit a92ef531c8
2 changed files with 3 additions and 5 deletions
-2
View File
@@ -1395,7 +1395,6 @@ class stock_move(osv.osv):
'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Order"),
'origin': fields.related('picking_id','origin',type='char', size=64, relation="stock.picking", string="Origin",store=True),
'scrapped': fields.related('location_dest_id','scrap_location',type='boolean',relation='stock.location',string='Scrapped'),
'move_stock_return_history': fields.many2many('stock.move', 'stock_move_return_history', 'move_id', 'return_move_id', 'Move Return History',readonly=True),
}
_constraints = [
(_check_tracking,
@@ -1465,7 +1464,6 @@ class stock_move(osv.osv):
if default is None:
default = {}
default = default.copy()
default['move_stock_return_history'] = []
return super(stock_move, self).copy(cr, uid, id, default, context=context)
def _auto_init(self, cursor, context=None):
+3 -3
View File
@@ -103,7 +103,7 @@ class stock_return_picking(osv.osv_memory):
return_history = {}
for m_line in pick.move_lines:
return_history[m_line.id] = 0
for rec in m_line.move_stock_return_history:
for rec in m_line.move_history_ids2:
return_history[m_line.id] += rec.product_qty
res['fields'].clear()
arch_lst=['<?xml version="1.0"?>', '<form string="%s">' % _('Return lines'), '<label string="%s" colspan="4"/>' % _('Provide the quantities of the returned products.')]
@@ -169,7 +169,7 @@ class stock_return_picking(osv.osv_memory):
new_qty = data['return%s' % move.id]
returned_qty = move.product_qty
for rec in move.move_stock_return_history:
for rec in move.move_history_ids2:
returned_qty -= rec.product_qty
if returned_qty != new_qty:
@@ -182,7 +182,7 @@ class stock_return_picking(osv.osv_memory):
'picking_id':new_picking, 'state':'draft',
'location_id':new_location, 'location_dest_id':move.location_id.id,
'date':date_cur, 'date_planned':date_cur,})
move_obj.write(cr, uid, [move.id], {'move_stock_return_history':[(4,new_move)]})
move_obj.write(cr, uid, [move.id], {'move_history_ids2':[(4,new_move)]})
if set_invoice_state_to_none:
pick_obj.write(cr, uid, [pick.id], {'invoice_state':'none'})