Trợ giúp

1

Problem when i'm overriding an inherited method (Odoo9)

Avatar
Tatorus

Hi, in my file purchase.py :

class purchase_order(models.Model):

_inherit = 'purchase.order'

I have this method :

@api.multi

def check_po(self):

     ...

And i want to override the inherited method "button_confirm" to do the check_po method from below. So just after check_po, in the same file, i do :

@api.multi

def button_confirm(self):

purchase_order.check_po(self)

return super(purchase_order, self)

But when i choose a Purchase (Request for quotation) and i click on the "CONFIRM ORDER" button, nothing happen.

It doesn't even confirm the purchase and i suppose it doesn't do the "check_po".


Thank you in advance.

Ảnh đại diện
Huỷ bỏ
1 Trả lời
0
Avatar
CatsandDogs
Best Answer

Try below one,

@api.multi

def button_confirm(self):

self.check_po()

return super(purchase_order, self)

3 Bình luận
Ảnh đại diện
Huỷ bỏ
Avatar
Tatorus
-

Don't works :/

Avatar
CatsandDogs
-

It's working to me.

Should work fine. A neat pick: you should add self.ensure_one() in there.