Odoo Help

1

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

By
Tatorus
on 3/1/16, 4:10 AM 551 views

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.

0
CatsandDogs
On 3/1/16, 4:25 AM

Try below one,

@api.multi

def button_confirm(self):

self.check_po()

return super(purchase_order, self)

Don't works :/

Tatorus
on 3/1/16, 4:31 AM

It's working to me.

CatsandDogs
on 3/1/16, 4:46 AM

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

Yenthe
on 3/1/16, 5:42 AM

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

1 follower(s)

Stats

Asked: 3/1/16, 4:10 AM
Seen: 551 times
Last updated: 9/20/16, 7:57 AM