Files
contract/agreement_project/models/agreement.py
2021-07-08 10:03:38 +05:30

18 lines
500 B
Python

# Copyright (C) 2018 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class Agreement(models.Model):
_inherit = "agreement"
task_count = fields.Integer("# Tasks", compute="_compute_task_count")
def _compute_task_count(self):
for ag in self:
count = self.env["project.task"].search_count(
[("agreement_id", "=", ag.id)]
)
ag.task_count = count