Odoo Help


How to call method from another class in openerp ?

on 7/17/13, 6:47 AM 4,944 views

hi everyone,

I have a class

 class product_extend(osv.osv):

 def convert(....):
      return result



So how I can convert() method in another class, I tried this in product_product class as normally in python syntax but get error when run time

test = product_extend()

Does anyone have any idea ? I will appreciate.

Thanks, Duy.


Timo Talvitie, Vizucom Oy

--Timo Talvitie, Vizucom Oy--
| 5 4 7
Tampere, Finland
--Timo Talvitie, Vizucom Oy--

Lead developer at Vizucom.

Timo Talvitie, Vizucom Oy
On 7/17/13, 6:53 AM

You can get a reference to your other model via the pool, e.g.

my_model = self.pool.get('module_name.model_name')

What if the class is in the same module (and even python file) e.g class po_line_ext(models.Model): _inherit = "purchase.order.line" def line_bla(self): #check for something class po_ext(models.Model): _inherit = "purchase.order" def call_po_line(self): if line_bla: #do something ?

OpusVL, Peter Alabaster
on 2/12/15, 12:24 PM

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: 7/17/13, 6:47 AM
Seen: 4944 times
Last updated: 3/16/15, 8:10 AM