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.

16 lines
487 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. mo_count = fields.Integer('# MOs', compute='_compute_mo_count')
  7. @api.multi
  8. def _compute_mo_count(self):
  9. for ag_rec in self:
  10. ag_rec.mo_count = self.env['mrp.production'].search_count(
  11. [('agreement_id', 'in', ag_rec.ids)])