Skip to Content
Menu
This question has been flagged
3 Replies
10382 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.

Avatar
Discard
Best Answer

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

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

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 ?