Add product_uom change on sale order line

bzr revid: ced-374c178d965ac84e33ea29d90fec351803fce938
This commit is contained in:
ced 2007-12-13 13:39:26 +00:00
parent 0ceeaedb1f
commit 9e7de52026
2 changed files with 16 additions and 1 deletions

View File

@ -816,4 +816,17 @@ class sale_order_line(osv.osv):
result['th_weight'] = result['product_uom_qty'] * product.weight
return {'value': result, 'domain': domain}
def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0,
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
lang=False, update_tax=True, date_order=False):
res = self.product_id_change(cursor, user, ids, pricelist, product,
qty=0, uom=uom, qty_uos=qty_uos, uos=uos, name=name,
partner_id=partner_id, lang=lang, update_tax=update_tax,
date_order=date_order)
if 'product_uom' in res['value']:
del res['value']['product_uom']
if not uom:
res['value']['price_unit'] = 0.0
return res
sale_order_line()

View File

@ -95,7 +95,9 @@
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)"
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
select="1"/>
<field name="product_uom"/>
<field name="product_uom"
on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)"
/>
<field name="product_id"
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], True, parent.date_order)"
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"