[FIX] Account:Displays warning when wrong UoM is selected in account invoice line
lp bug: https://launchpad.net/bugs/600534 fixed bzr revid: mtr@mtr-20101217083947-kj4h7ipczmnbh7t2
This commit is contained in:
parent
9331cb8c79
commit
6eab65384c
|
@ -1452,10 +1452,19 @@ class account_invoice_line(osv.osv):
|
||||||
|
|
||||||
def uos_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None):
|
def uos_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None):
|
||||||
res = self.product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context)
|
res = self.product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context)
|
||||||
|
warning = {}
|
||||||
if 'uos_id' in res['value']:
|
if 'uos_id' in res['value']:
|
||||||
del res['value']['uos_id']
|
del res['value']['uos_id']
|
||||||
if not uom:
|
if not uom:
|
||||||
res['value']['price_unit'] = 0.0
|
res['value']['price_unit'] = 0.0
|
||||||
|
prod = self.pool.get('product.product').browse(cr, uid, product, context=context)
|
||||||
|
u = self.pool.get('product.uom').browse(cr, uid, uom, context=context)
|
||||||
|
if prod.uom_id.category_id.id != u.category_id.id:
|
||||||
|
warning = {
|
||||||
|
'title': _('Wrong UoM !'),
|
||||||
|
'message': _('Select correct UoM for your product.')
|
||||||
|
}
|
||||||
|
return {'warning': warning}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def move_line_get(self, cr, uid, invoice_id, context=None):
|
def move_line_get(self, cr, uid, invoice_id, context=None):
|
||||||
|
|
Loading…
Reference in New Issue