[v12] api.one vs api.multi in calculated field
It seem that api.one is deprecated in favor of api.multi + ensure.one
as an example:
@api.onedef _compute_total_cost(self):records = self.env["project.task"].search([("model", "in", self.ids)])
tcost = 0.0
for rec in records:
tcost += rec.cost
self.total_cost = tcost
total_cost = fields.Monetary(comput="_compute_total_cost")
I tried to use api.multi but I am getting errors when there are more than one record in "records".
How would I switch to use api.multi in place of api.one in this case? Should I?