Is anyone stumble over situation when in module you start put any @api decorator and it crashes odoo?
I have module with states. I'm trying to signed button function to change state. But when i writing any @api decorator
and restart server, reload web page, it pushes me to form of choosing database or shows continious messages about connection lost and retrieve.
When i comment @api it works fine up to moment of button click.
Here is my simple model:
from odoo import models, fields, api
class la_shipping(models.Model):
_name = 'tralalal'
_description = 'Tralala'
@api.multi
def button_done(self):
for rec in self:
rec.write({'state', 'done'})
state = fields.Selection([('sent', 'Sent'),('done','Done')],
required =True, default='sent')
<header>
<button name="button_done" string="Done" states="sent" class="oe_highlight" type="object"></button>
<button name="button_sent" string="Sent" states="sent,done" class="oe_highlight" type="object"></button>
<field name="state" widget="statusbar"></field>
</header>
https://www.youtube.com/watch?v=YfJK6thy2s0
Hi Kirill,
We no need to use any @api decorators for handling multiple records it's by default handling in Odoo 13.