Hi,
I'm wondering whether it is necessary to use @api.one or @api.multi in all methods of a model?.
In my case, I have implemented a workflow. In this one, I have built a transition that only triggers if a condition is evaluated to True.
<record id="coming_soon_to_discontinued_end_date" model="workflow.transition">
<field name="act_from" ref="state_coming_soon"/>
<field name="act_to" ref="state_discontinued"/>
<field name="condition">end_date_reached()</field>
</record>
The condition is evaluated through a method in my model:
class Product(models.AbstractModel):
_name = 'sdicrm.product'
...
def end_date_reached(self):
end_date = fields.Date.from_string(self.end_date_sale)
return end_date < date.today()
What I don't know is whether I have to use @api.one decorator in the 'end_date_reached' method:
@api.one
def end_date_reached(self):
end_date = fields.Date.from_string(self.end_date_sale)
return end_date < date.today()
Thank you.