[IMP] hr_expense : added condition to function
bzr revid: cha@tinyerp.com-20120809105103-tm0m7g854zglxfrg
This commit is contained in:
parent
1a36733f5b
commit
4cc8dce4ec
|
@ -294,13 +294,14 @@ class hr_expense_line(osv.osv):
|
|||
|
||||
def onchange_uom(self, cr, uid, ids, product_id, uom_id, context=None):
|
||||
res = {'value':{}}
|
||||
if product_id:
|
||||
product = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
|
||||
uom = self.pool.get('product.uom').browse(cr, uid, uom_id, context=context)
|
||||
if uom.category_id.id != product.uom_id.category_id.id:
|
||||
res['warning'] = {'title': _('Warning'), 'message': _('Selected Unit of Measure does not belong to the same category as the product Unit of Measure')}
|
||||
uom_id = product.uom_id.id
|
||||
res['value'].update({'uom_id': uom_id})
|
||||
if uom_id:
|
||||
if product_id:
|
||||
product = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
|
||||
uom = self.pool.get('product.uom').browse(cr, uid, uom_id, context=context)
|
||||
if uom.category_id.id != product.uom_id.category_id.id:
|
||||
res['warning'] = {'title': _('Warning'), 'message': _('Selected Unit of Measure does not belong to the same category as the product Unit of Measure')}
|
||||
uom_id = product.uom_id.id
|
||||
res['value'].update({'uom_id': uom_id})
|
||||
return res
|
||||
|
||||
hr_expense_line()
|
||||
|
|
Loading…
Reference in New Issue