Community Mailinglisten Archive


Iterating recordset with @api.multi and without.

dxFactory EOOD, Dimitar Epitropov
- 22.11.2017 04:32:00

Hi community,

I would like to get a better feeling about when to use @api decorators and when not. I've read a lot about them, but I still don't have a good feeling. They are not very intuitive to me. I get the feeling that you have to use them on almost every method to control the behavior of self.
I am interested in the following example from account_invoice:

Here why don't we use @api.multi?

def _onchange_amount_total(self):
    for inv in self:
        if inv.amount_total < 0:
            raise Warning(_('You cannot validate an invoice with a negative total amount. You should create a credit note instead.'))


Dimitar Epitropov | Odoo developer
+359 883 356 833
Consulting | Project Outsourcing | Software Development