[FIX] Stock : Onchange corrected to have an effect of translations

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

bzr revid: jvo@tinyerp.com-20100210114808-15s8lcvl2lbypwzi
This commit is contained in:
ACH(OpenERP) 2010-02-10 17:18:08 +05:30 committed by Jay (Open ERP)
parent 3b4d5593c1
commit d79db3f73a
2 changed files with 13 additions and 6 deletions

View File

@ -1059,10 +1059,17 @@ class stock_move(osv.osv):
return {'value': result}
def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False, loc_dest_id=False):
def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False, loc_dest_id=False, address_id=False):
if not prod_id:
return {}
product = self.pool.get('product.product').browse(cr, uid, [prod_id])[0]
lang = False
if address_id:
addr_rec = self.pool.get('res.partner.address').browse(cr, uid, address_id)
if addr_rec:
lang = addr_rec.partner_id and addr_rec.partner_id.lang or False
ctx = {'lang': lang}
product = self.pool.get('product.product').browse(cr, uid, [prod_id], context=ctx)[0]
uos_id = product.uos_id and product.uos_id.id or False
result = {
'name': product.partner_ref,

View File

@ -534,7 +534,7 @@
<separator colspan="4" string="Move Information"/>
<field name="location_id" select="1" domain="[('usage','=','internal')]"/>
<field name="location_dest_id" select="1" domain="[('usage','=','internal')]"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id)" select="1"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)" select="1"/>
<field name="product_qty" select="1" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" select="1"/>
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
@ -633,7 +633,7 @@
<separator colspan="4" string="Move Information"/>
<field name="location_id" select="1" domain="[('usage','=','internal')]"/>
<field name="location_dest_id" select="1" domain="[('usage','&lt;&gt;','view')]"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id)" select="1"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)" select="1"/>
<field name="product_qty" select="1" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" select="1"/>
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
@ -826,7 +826,7 @@
<separator colspan="4" string="Move Information"/>
<field name="location_id" select="1" domain="[('usage','=','internal')]"/>
<field name="location_dest_id" select="1" domain="[('usage','&lt;&gt;','view')]"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id)" select="1"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)" select="1"/>
<field name="product_qty" select="1" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" />
<field name="product_uom" select="1"/>
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
@ -1015,7 +1015,7 @@
<separator colspan="4" string="Move Information"/>
<field name="location_id" select="1" domain="[('usage','&lt;&gt;','view')]"/>
<field domain="[('usage','=','internal')]" name="location_dest_id" select="1"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id)" select="1"/>
<field colspan="4" context="location=location_id" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)" select="1"/>
<field name="product_qty" select="1" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" select="1"/>
<field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>