Hello,
I tried to overwrite product_id_change in sale_order_line:
Code:
from osv import osv, fields
class sale_order_line(osv.osv):
_name = 'sale.order.line'
_inherit = 'sale.order.line'
_columns = {
}
_defaults = {
}
def product_id_change( self, cr, uid, ids, pricelist, product, qty=0,
uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False,
update_tax=True, date_order=False, packaging=False, fiscal_position=False,
flag=False ):
return {'value': {'th_weight': 0, 'product_packaging': False,
'product_uos_qty': qty, 'x_code': '123'}, 'domain': {'product_uom': [],
'product_uos': []}}
# return super(C, self).product_id_change( self, cr, uid, ids, pricelist,
# product, qty=0, uom=False, qty_uos=0, uos=False, name='',
# partner_id=False, lang=False, update_tax=True, date_order=False,
# packaging=False, fiscal_position=False, flag=False)
sale_order_line()
As you see I'm going to return 'x_code': '123'. But if I add a new product in the sale.order.form the x_code field doesn't change and the other fields are still updated. So nothing changed. What did I miss? Must the product_id_change() method be called somehow special after it's overwritten?
Thanks in advance