Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


inherit product onchange function in sale order line

veena vasudevan
on 11/28/13, 11:47 PM 2,194 views

how to inherit product onchange function in sale order line


Anil R. Kesariya

--Anil R. Kesariya--
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
Technical & Functional Expert
Anil R. Kesariya
On 11/29/13, 6:16 AM

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.


Anil Kesariya

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 11/28/13, 11:47 PM
Seen: 2194 times
Last updated: 3/16/15, 8:10 AM