Browse Source

[IMP] change summed fields in group by

pull/1/head
houssine 6 years ago
parent
commit
1f14f58ed6
  1. 16
      easy_my_coop/models/coop.py

16
easy_my_coop/models/coop.py

@ -408,3 +408,19 @@ class subscription_register(models.Model):
_order = "register_number_operation asc" _order = "register_number_operation asc"
@api.model
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
if 'share_unit_price' in fields:
fields.remove('share_unit_price')
if 'register_number_operation' in fields:
fields.remove('register_number_operation')
res = super(subscription_register, self).read_group(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy)
if 'total_amount_line' in fields:
for line in res:
if '__domain' in line:
lines = self.search(line['__domain'])
inv_value = 0.0
for line2 in lines:
inv_value += line2.total_amount_line
line['total_amount_line'] = inv_value
return res
Loading…
Cancel
Save