[FIX]stock:Update button at product form Stock update without production lot possible Tracking production lot wanted
lp bug: https://launchpad.net/bugs/700963 fixed bzr revid: ron@tinyerp.com-20110113104100-0ho06wvhf8z0a0fj
This commit is contained in:
parent
5122874ab9
commit
4dc24a074d
|
@ -28,10 +28,23 @@ class stock_change_product_qty(osv.osv_memory):
|
|||
_columns = {
|
||||
'product_id' : fields.many2one('product.product', 'Product'),
|
||||
'new_quantity': fields.float('Quantity', required=True, help='This quantity is expressed in the Default UoM of the product.'),
|
||||
'prodlot_id': fields.many2one('stock.production.lot', 'Production Lot', domain="[('product_id','=',product_id)]"),
|
||||
'prodlot_id': fields.many2one('stock.production.lot', 'Production Lot', required=True,domain="[('product_id','=',product_id)]"),
|
||||
'location_id': fields.many2one('stock.location', 'Location', required=True, domain="[('usage', '=', 'internal')]"),
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
result = super(stock_change_product_qty, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
|
||||
product_id = context and context.get('active_id', False) or False
|
||||
prod_obj = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
|
||||
|
||||
if (context.get('active_model') == 'product.product') and prod_obj:
|
||||
fields=result.get('fields',{})
|
||||
if fields and (prod_obj.track_production == True) and (fields.get('prodlot_id')):
|
||||
result['fields']['prodlot_id']['required'] = True
|
||||
else:
|
||||
result['fields']['prodlot_id']['required'] = False
|
||||
return result
|
||||
|
||||
def default_get(self, cr, uid, fields, context):
|
||||
""" To get default values for the object.
|
||||
@param self: The object pointer.
|
||||
|
|
Loading…
Reference in New Issue