I have this function that does its job, but i tried to make the field store=True and when i update it gives me and expected singleton error Expected singleton: project.project(2, 3, 1).
this is my code.
sum_pre = fields.Float(string="Total Presupuesto Aprobado", required=False, compute='presupuesto_sum')
@api.depends('tasks.sum_total_cost')
def presupuesto_sum(self):
etapa = self.env['project.task'].search([('project_id', '=', self.id), ('stage_id', '=', 'Presupuesto Aprobado')])
for data in etapa:
if data:
self.sum_pre = round(sum(etapa.mapped('sum_total_cost')), 2)
Someone knows how to resolve it or where i have the error, Thanks!