Odoo Help


inherit product onchange function in sale order line

veena vasudevan
on 11/28/13, 11:47 PM 3,060 views

how to inherit product onchange function in sale order line


Anil R. Kesariya

--Anil R. Kesariya--
| 6 5 8
Rajkot, India
--Anil R. Kesariya--

Odoo Techno Functional Expert

* Engaged with odoo since May - 2012.

* Customise existing module or develop new module base on customer requirement.

* Played key developer role in many past and running projects.

* Expert in requirement gathering of business and transforming requirement into odoo platform.

* Major expertise in core modules, database, report development and theme development.

* Integration expert.

Linkedin  : https://in.linkedin.com/in/anil-kesariya-97b20a66

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

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


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