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.


How to call method from another class in openerp ?

on 7/17/13, 6:47 AM 3,293 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
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

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