Odoo Help

3

0
1 Answer
8
Avatar

Fabien Pinckaers (fp) United States

--Fabien Pinckaers (fp)--
7219
| 7 8 10
San Francisco, United States
--Fabien Pinckaers (fp)--

Odoo Founder & CEO

Fabien Pinckaers (fp) United States
3/28/13, 3:35 PM

I always thought doing hooks is a bit "old school" development practice :)

In order to hook your code on an existing object, you never have to define hooks or connect to existing hooks. We use standard inheritances practices between objects.

Suppose you have an object like this:

class sale_order(osv.osv):
  __name__='sale.order'
  def my_method(self, **args):
     # This method do something
     return True

If you want to hook to the my_method, you create an object that inherits from the sale.order object and extend it.

class sale_order(osv.osv):
  _inherit = 'sale.order'
  def my_method(self, **args):
     # do something before
     value = super(sale_order, self).my_method(self, **args)
     # do something after
     return value
1 Comment
Saturnprogress, Lda, Carlos Almeida Portugal
1/19/16, 8:41 PM

And how can you redefine a method of a class like mail.thread?

Ask a Question
Writer
Keep Informed
0 follower(s)
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.

Register
Odoo Training Center

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

Test it now