mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[UPD][IMP] @murtuzasaleh remarks + search_count
[UPD] @murtuzasaleh remarks for readme.rst [IMP] use search_count
This commit is contained in:
@@ -12,10 +12,7 @@ class Agreement(models.Model):
|
||||
|
||||
@api.multi
|
||||
def _compute_task_count(self):
|
||||
data = self.env['project.task'].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.task_count = count_data.get(agreement.id, 0)
|
||||
for ag in self:
|
||||
count = self.env['project.task'].search_count(
|
||||
[('agreement_id', 'in', self.ids)])
|
||||
ag.task_count = count
|
||||
|
||||
Reference in New Issue
Block a user