Odoo Help

Welcome!

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.

1

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

By
Tatorus
on 3/1/16, 4:10 AM 410 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

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

1 follower(s)

Stats

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