Report read group updated

This commit is contained in:
prakash 2022-04-29 14:24:45 +05:30
parent 912cf53fff
commit f20b6af7f8
1 changed files with 4 additions and 6 deletions

View File

@ -227,20 +227,18 @@ class ProjectRevenueCustomReport(models.Model):
@api.model
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
res = super(ProjectRevenueCustomReport, self).read_group(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy)
#print("resssssss", res)
#accounts = self.env['account.analytic.account']
hourly_rate = 0
actual_cost = 0
for line in res:
hourly_rate = 0
actual_cost = 0
try:
if 'actual_cost' in line:
actual_cost = line['actual_cost']
if 'pro_hourly_rate' in line:
hourly_rate = line['pro_hourly_rate']
if 'unit_amount' in line and not 'id' in line: # and 'pro_hourly_rate' in line and 'id' in line
if 'unit_amount' in line: # and 'pro_hourly_rate' in line and 'id' in line
if hourly_rate != 0:
line['actual_revenue'] = hourly_rate * line['unit_amount']
if 'unit_amount' in line and 'timesheet_cost' in line and not 'id' in line:
if 'unit_amount' in line and 'timesheet_cost' in line:
line['actual_cost'] = line['timesheet_cost'] * line['unit_amount']
if 'overall_budgeted_revenue' in line and 'budgeted_hours' in line:
if line['budgeted_hours'] > 0: