[FIX]: purchase: Fixed onchange product and uom

lp bug: https://launchpad.net/bugs/703861 fixed

bzr revid: rpa@tinyerp.com-20110118133335-69gmspu2h3c2adt1
This commit is contained in:
rpa (Open ERP) 2011-01-18 19:03:35 +05:30
parent c2634f16c3
commit 0a5454dea7
2 changed files with 6 additions and 4 deletions

View File

@ -700,7 +700,7 @@ class purchase_order_line(osv.osv):
dt = (datetime.now() + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S')
res.update({'value': {'price_unit': price, 'name': name or prod_name,
res.update({'value': {'price_unit': price, 'name': prod_name,
'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id),
'date_planned': date_planned or dt,'notes': notes or prod.description_purchase,
'product_qty': qty,
@ -721,9 +721,11 @@ class purchase_order_line(osv.osv):
return res
def product_uom_change(self, cr, uid, ids, pricelist, product, qty, uom,
partner_id, date_order=False,fiscal_position=False):
partner_id, date_order=False, fiscal_position=False, date_planned=False,
name=False, price_unit=False, notes=False):
res = self.product_id_change(cr, uid, ids, pricelist, product, qty, uom,
partner_id=partner_id, date_order=date_order,fiscal_position=fiscal_position)
partner_id, date_order=date_order, fiscal_position=fiscal_position, date_planned=date_planned,
name=name, price_unit=price_unit, notes=notes)
if 'product_uom' in res['value']:
if uom and (uom != res['value']['product_uom']) and res['value']['product_uom']:
seller_uom_name = self.pool.get('product.uom').read(cr, uid, [res['value']['product_uom']], ['name'])[0]['name']

View File

@ -318,7 +318,7 @@
<page string="Order Line">
<field name="product_id" colspan="4" context="partner_id=parent.partner_id,quantity=product_qty,pricelist=parent.pricelist_id,uom=product_uom,warehouse=parent.warehouse_id" on_change="product_id_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes)"/>
<field name="product_qty" context="partner_id=parent.partner_id,quantity=product_qty,pricelist=parent.pricelist_id,uom=product_uom,warehouse=parent.warehouse_id" on_change="product_id_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id,parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes)"/>
<field name="product_uom" on_change="product_uom_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position)"/>
<field name="product_uom" on_change="product_uom_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes)"/>
<field colspan="4" name="name"/>
<field name="date_planned" widget="date"/>
<field name="price_unit"/>