[FIX] Stock : While configuring physical inventory, manufacturing lots field should be set mandatory if the product has this attribute True

lp bug: https://launchpad.net/bugs/700928 fixed

bzr revid: jvo@tinyerp.com-20110329131543-sulhfsoqzb0zh34o
This commit is contained in:
Jay Vora (OpenERP) 2011-03-29 18:45:43 +05:30
parent 82096674df
commit 23ac3d3c8e
2 changed files with 8 additions and 5 deletions

View File

@ -2636,6 +2636,7 @@ class stock_inventory_line(osv.osv):
'company_id': fields.related('inventory_id','company_id',type='many2one',relation='res.company',string='Company',store=True, select=True, readonly=True),
'prod_lot_id': fields.many2one('stock.production.lot', 'Production Lot', domain="[('product_id','=',product_id)]"),
'state': fields.related('inventory_id','state',type='char',string='State',readonly=True),
'tracking': fields.dummy(string='Tracking', type='boolean'),
}
def on_change_product_id(self, cr, uid, ids, location_id, product, uom=False, to_date=False):
@ -2646,12 +2647,11 @@ class stock_inventory_line(osv.osv):
@return: Dictionary of changed values
"""
if not product:
return {}
if not uom:
prod = self.pool.get('product.product').browse(cr, uid, [product], {'uom': uom})[0]
uom = prod.uom_id.id
return {'product_qty': 0.0, 'product_uom': False, 'tracking': False}
obj_product = self.pool.get('product.product').browse(cr, uid, product)
uom = uom or obj_product.uom_id.id
amount = self.pool.get('stock.location')._product_get(cr, uid, location_id, [product], {'uom': uom, 'to_date': to_date})[product]
result = {'product_qty': amount, 'product_uom': uom}
result = {'product_qty': amount, 'product_uom': uom, 'tracking': obj_product.track_production}
return {'value': result}
stock_inventory_line()

View File

@ -58,6 +58,7 @@
<field name="arch" type="xml">
<form string="Stock Inventory Lines">
<field context="location=location_id,uom=product_uom,to_date=parent.date" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)" select="1" domain="[('type','&lt;&gt;','service')]"/>
<field name="tracking" invisible="1" />
<field name="product_qty"/>
<field name="product_uom"/>
<field name="prod_lot_id" groups="base.group_extended"/>
@ -118,6 +119,7 @@
<tree string="Products" editable="bottom">
<field colspan="4" domain="[('usage','=','internal')]" name="location_id"/>
<field context="location=location_id,uom=product_uom,to_date=parent.date" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)" domain="[('type','&lt;&gt;','service')]"/>
<field name="tracking" invisible="1" />
<field name="product_qty"/>
<field name="product_uom"/>
<field name="prod_lot_id" groups="base.group_extended"/>
@ -130,6 +132,7 @@
<field domain="[('usage','=','internal')]" name="location_id"/>
<newline/>
<field context="location=location_id,uom=product_uom,to_date=parent.date" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)" domain="[('type','&lt;&gt;','service')]"/>
<field name="tracking" invisible="1" />
<field name="product_qty"/>
<field name="product_uom"/>
<group colspan="2" col="4">