This question has been flagged
1 Reply
6262 Views

how to inherit product onchange function in sale order line

Avatar
Discard
Best Answer

Hello veena vasudevan,

Function can be override not inherit. for overriding you need to inherit that model.

here is the sample code to override your funciton.

In your custom py file

class sale_order_line(osv.osv)

_inherit = 'sale.order.line'

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, context=None):

     #your code for changes

     res = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty=qty,
        uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
        lang=lang, update_tax=update_tax, date_order= date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context):

      #your code for changes
 return res

By this way use can override the on change function.

Hope this will help.

Regards,

Anil Kesariya

Avatar
Discard