[FIX]sale :improve on_change based on uom and its category
bzr revid: mma@tinyerp.com-20120808083835-t9fwlisbt9gj7ank
This commit is contained in:
parent
9c891b9fad
commit
c8f2630b2b
|
@ -1406,7 +1406,6 @@ class sale_order_line(osv.osv):
|
||||||
[('category_id', '=', product_obj.uom_id.category_id.id)],
|
[('category_id', '=', product_obj.uom_id.category_id.id)],
|
||||||
'product_uos':
|
'product_uos':
|
||||||
[('category_id', '=', uos_category_id)]}
|
[('category_id', '=', uos_category_id)]}
|
||||||
|
|
||||||
elif uos and not uom: # only happens if uom is False
|
elif uos and not uom: # only happens if uom is False
|
||||||
result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id
|
result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id
|
||||||
result['product_uom_qty'] = qty_uos / product_obj.uos_coeff
|
result['product_uom_qty'] = qty_uos / product_obj.uos_coeff
|
||||||
|
@ -1463,15 +1462,12 @@ class sale_order_line(osv.osv):
|
||||||
lang=False, update_tax=True, date_order=False, context=None):
|
lang=False, update_tax=True, date_order=False, context=None):
|
||||||
context = context or {}
|
context = context or {}
|
||||||
lang = lang or ('lang' in context and context['lang'])
|
lang = lang or ('lang' in context and context['lang'])
|
||||||
res = self.product_id_change(cursor, user, ids, pricelist, product,
|
if not uom:
|
||||||
|
return {'value': {'price_unit': 0.0, 'product_uom' : uom or False}}
|
||||||
|
return self.product_id_change(cursor, user, ids, pricelist, product,
|
||||||
qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name,
|
qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name,
|
||||||
partner_id=partner_id, lang=lang, update_tax=update_tax,
|
partner_id=partner_id, lang=lang, update_tax=update_tax,
|
||||||
date_order=date_order, context=context)
|
date_order=date_order, context=context)
|
||||||
if 'product_uom' in res['value']:
|
|
||||||
del res['value']['product_uom']
|
|
||||||
if not uom:
|
|
||||||
res['value']['price_unit'] = 0.0
|
|
||||||
return res
|
|
||||||
|
|
||||||
def unlink(self, cr, uid, ids, context=None):
|
def unlink(self, cr, uid, ids, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
|
|
Loading…
Reference in New Issue