Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
8365 Visualizzazioni

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

    @api.one
    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?

Avatar
Abbandona

error log?

Autore

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

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

Autore

Thank you! That worked

Risposta migliore

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:

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

Hope this will help you.

Thanks

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
4
feb 25
2713
1
ago 24
2239
2
nov 24
3384
3
ott 23
14914
2
feb 23
2514