Odoo Help


Call original function from parent class fails

on 1/28/15, 2:04 PM 2,700 views

Original function in "account.voucher" was:

    def button_proforma_voucher(self, cr, uid, ids, context=None):
        self.signal_workflow(cr, uid, ids, 'proforma_voucher')
        return {'type': 'ir.actions.act_window_close'}


I have overriden the base class function:

class MyAccountVoucher(models.Model):
    _inherit = "account.voucher"

# Override "Pay" button press method

    def button_proforma_voucher(self):
------ some code that works fine -----
 res = super(MyAccountVoucher,self).button_proforma_voucher
return res

Nothing happens. I assume that the problem may be in the middle between new and old api, but what is wrong in the code?

error log?

on 1/28/15, 2:56 PM

There is no error. It just does nothing. Like there is no function at all.

on 1/28/15, 2:58 PM

Try @api.multi and button_proforma_voucher() - with brackets.

on 1/28/15, 4:15 PM

Thank you! That worked

on 1/29/15, 3:03 AM
Nishant Jogi
On 1/29/15, 12:35 AM

Hello Sam,

You did the mistake while defining function @api.one can not be use in case of multiple occurence.

And one another problem : in case of calling function you need to use ().

Use the following code:

    def button_proforma_voucher(self):
         ------ some code that works fine -----
         res = super(MyAccountVoucher,self).button_proforma_voucher()
         return res

Hope this will help you.


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.


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)


Asked: 1/28/15, 2:04 PM
Seen: 2700 times
Last updated: 3/16/15, 8:10 AM