Odoo Help

0

How to call method from another class in openerp ?

By
Duy
on 7/17/13, 6:47 AM 4,093 views

hi everyone,

I have a class

<code>
 class product_extend(osv.osv):

 def convert(....):
      return result

 product_extend()

</code>

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()
test.convert()

Does anyone have any idea ? I will appreciate.

Thanks, Duy.

0

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.

Register

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)

Stats

Asked: 7/17/13, 6:47 AM
Seen: 4093 times
Last updated: 3/16/15, 8:10 AM