You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
444 B

  1. from odoo import _, api, fields, models
  2. class ProjectTask(models.Model):
  3. _inherit = "project.task"
  4. funder_ids = fields.One2many("project.funder", "task_id", string="funder")
  5. amount_total = fields.Float(compute="_compute_amount_total", string="Amount Total")
  6. @api.depends("funder_ids")
  7. def _compute_amount_total(self):
  8. for record in self:
  9. record.amount_total = sum(record.funder_ids.mapped("amount"))