mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
17 lines
502 B
Python
17 lines
502 B
Python
# Copyright (C) 2021 - 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"
|
|
|
|
mr_count = fields.Integer("# Maintenance Requests", compute="_compute_mr_count")
|
|
|
|
def _compute_mr_count(self):
|
|
for ag_rec in self:
|
|
ag_rec.mr_count = self.env["maintenance.request"].search_count(
|
|
[("agreement_id", "in", ag_rec.ids)]
|
|
)
|