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.

17 lines
539 B

  1. # Copyright (C) 2018 - TODAY, Open Source Integrators
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import api, fields, models
  4. class Agreement(models.Model):
  5. _inherit = "agreement"
  6. mr_count = fields.Integer('# Maintenance Requests',
  7. compute='_compute_mr_count')
  8. @api.multi
  9. def _compute_mr_count(self):
  10. for ag_rec in self:
  11. ag_rec.mr_count = self.env['maintenance.request'].search_count(
  12. [('agreement_id', 'in', ag_rec.ids)])