From e32b992d2bffda023a7a6a2ca3eb28ee1d4aba29 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Wed, 22 Sep 2010 12:08:55 +0530 Subject: [PATCH] [ADD] stock: Add the production_lot field in Stock partial move wizard bzr revid: sbh@tinyerp.com-20100922063855-zuj4ww3uzr69z9rl --- addons/stock/stock.py | 3 +++ addons/stock/wizard/stock_partial_move.py | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 33914b5c435..c5784541f68 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2283,6 +2283,9 @@ class stock_move(osv.osv): product_uom = partial_data.get('product_uom',False) product_price = partial_data.get('product_price',0.0) product_currency = partial_data.get('product_currency',False) + prodlot_id = partial_data.get('prodlot_id',False) + if prodlot_id: + self.write(cr, uid, [move.id],{'prodlot_id': prodlot_id,}) if move.product_qty == product_qty: complete.append(move) elif move.product_qty > product_qty: diff --git a/addons/stock/wizard/stock_partial_move.py b/addons/stock/wizard/stock_partial_move.py index 1fee7c66d0b..a6e515cd0c4 100644 --- a/addons/stock/wizard/stock_partial_move.py +++ b/addons/stock/wizard/stock_partial_move.py @@ -47,7 +47,9 @@ class stock_partial_move(osv.osv_memory): self._columns['move%s_product_qty'%(m.id)] = fields.float("Quantity") if 'move%s_product_uom'%(m.id) not in self._columns: self._columns['move%s_product_uom'%(m.id)] = fields.many2one('product.uom',string="Product UOM") - + if 'move%s_prodlot_id'%(m.id) not in self._columns: + self._columns['move%s_prodlot_id'%(m.id)] = fields.many2one('stock.production.lot', string="Lot") + if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'): if 'move%s_product_price'%(m.id) not in self._columns: self._columns['move%s_product_price'%(m.id)] = fields.float("Price") @@ -89,7 +91,12 @@ class stock_partial_move(osv.osv_memory): 'relation': 'product.uom', 'required' : True, 'readonly' : True, - } + }, + 'move%s_prodlot_id'%(m.id): { + 'string': _('Production Lot'), + 'type': 'many2one', + 'relation': 'stock.production.lot', + } }) _moves_arch_lst += """ @@ -97,7 +104,8 @@ class stock_partial_move(osv.osv_memory): - """%(m.id, m.id, m.id) + + """%(m.id, m.id, m.id,m.id) if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'): _moves_fields.update({ 'move%s_product_price'%(m.id) : { @@ -162,6 +170,8 @@ class stock_partial_move(osv.osv_memory): res['move%s_product_qty'%(m.id)] = m.product_qty if 'move%s_product_uom'%(m.id) in fields: res['move%s_product_uom'%(m.id)] = m.product_uom.id + if 'move%s_prodlot_id'%(m.id) in fields: + res['move%s_prodlot_id'%(m.id)] = m.prodlot_id.id if m.product_id.cost_method == 'average' : price = m.product_id.standard_price currency = False @@ -193,7 +203,8 @@ class stock_partial_move(osv.osv_memory): partial_datas['move%s'%(m.id)] = { 'product_id' : getattr(partial, 'move%s_product_id'%(m.id)).id, 'product_qty' : getattr(partial, 'move%s_product_qty'%(m.id)), - 'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)).id + 'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)).id, + 'prodlot_id' : getattr(partial, 'move%s_prodlot_id'%(m.id)).id } if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):