I have a problem related to set data on a form on a onchange event. On saleorderline i want to set the quantity automatically when I change the product. But I have linked product to a one2many ean13 codes that have information about the quantity. So I redefine the search of the product searching on the other table linked to the products containing the quantity information, but when i type the code of the products in the onchange I have only the product_id and lost the code_id linked to the search field so I cannot retrive te quantity information. Do you have an idea how I can have in the onchange other information about the id passed???
I post the code of the onchange, the parameter ean13_id would be an ean13_id and not a product_id, or I would have to add a parameter about the code typed to search the product.
def ean13_id_change_with_wh(self, cr, uid, ids, ean13_id, context=None):
if context is None:
context = {}
res = {}
ean_obj = self.pool.get('product.ean13').browse(cr, uid, ean13_id, context)
if ean13_id:
res = {
'value':{
'product_id':ean_obj.product_id,
'product_uom_qty':ean_obj.quantity
}
}
return res
my friend plz did you put the onchange in yyou xml and plz print to me what did you get in ean_obj = self.pool.get('product.ean13').browse(cr, uid, ean13_id, context)