Odoo Help


How to run python function when editing a product

on 6/21/16, 6:57 AM 808 views


I'm trying to run a python function when I click on "Save" in a product page but I don't know what is the function I have to inherit from product.product or product.template.

Please, help me ! Thank you in advance.


Jérémy Kersten (jke)

--Jérémy Kersten (jke)--

| 3 3 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 6/21/16, 7:33 AM

def create() if it is a new record

def write() if it is an existing record.

You can find nice informations in the documentation of odoo about the ORM : https://www.odoo.com/documentation/8.0/reference/orm.html

product.product if you are in a product variant view

product.template if you are on a product view.

You can find easily in the url the active_model.

Dilip Dabhi
On 6/21/16, 9:12 AM

When you click on "Save" button below two method you have to inherit...

def create(self, cr, uid, ids, context=None):



res = super(sale_order, self).create(cr, uid, ids, context=None)



return res


def write(self, cr, uid, ids,vals, context=None):



res = super(sale_order, self).create(cr, uid, ids, vals,context=None)



return res

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

1 follower(s)


Asked: 6/21/16, 6:57 AM
Seen: 808 times
Last updated: 6/21/16, 9:12 AM