mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[MIG][12.0] agreement_maintenance
This commit is contained in:
committed by
Olga Marco
parent
0737956801
commit
44d2f7e374
@@ -12,10 +12,6 @@ class Agreement(models.Model):
|
||||
|
||||
@api.multi
|
||||
def _compute_mr_count(self):
|
||||
data = self.env['maintenance.request'].read_group(
|
||||
[('agreement_id', 'in', self.ids)],
|
||||
['agreement_id'], ['agreement_id'])
|
||||
count_data = dict((item['agreement_id'][0],
|
||||
item['agreement_id_count']) for item in data)
|
||||
for agreement in self:
|
||||
agreement.mr_count = count_data.get(agreement.id, 0)
|
||||
for ag_rec in self:
|
||||
ag_rec.mr_count = self.env['maintenance.request'].search_count(
|
||||
[('agreement_id', 'in', ag_rec.ids)])
|
||||
|
||||
Reference in New Issue
Block a user