[ADD] create project_funders to track funds on tasks

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
This commit is contained in:
Nicolas JEUDY
2022-07-26 01:30:55 +02:00
committed by Stéphan Sainléger
parent c4ef88d3d4
commit 1f8baa73d1
12 changed files with 427 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
from odoo import _, api, fields, models
class ProjectTask(models.Model):
_inherit = "project.task"
funder_ids = fields.One2many("project.funder", "task_id", string="funder")
amount_total = fields.Float(compute="_compute_amount_total", string="Amount Total")
@api.depends("funder_ids")
def _compute_amount_total(self):
for record in self:
record.amount_total = sum(record.funder_ids.mapped("amount"))