Revenue report total header updated

This commit is contained in:
prakash 2022-04-12 21:45:47 +05:30
parent 565d6ad3bd
commit 7931c0b58f
1 changed files with 20 additions and 2 deletions

View File

@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, tools
from odoo import api, fields, models, tools
class ProjectRevenueCustomReport(models.Model):
@ -223,4 +222,23 @@ class ProjectRevenueCustomReport(models.Model):
) res
)""" % (self._table,))
@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']
for line in res:
if 'unit_amount' in line and 'pro_hourly_rate' in line and 'id' in line:
line['actual_revenue'] = line['pro_hourly_rate'] * line['unit_amount']
if 'unit_amount' in line and 'timesheet_cost' in line and 'id' in line:
line['actual_cost'] = line['timesheet_cost'] * line['unit_amount']
if 'overall_budgeted_revenue' in line and 'budgeted_hours' in line and 'id' in line:
if line['budgeted_hours'] > 0:
line['overall_hourly_rate'] = line['overall_budgeted_revenue'] / line['budgeted_hours']
if 'pro_hourly_rate' in line and 'budgeted_hours' in line and 'id' in line:
if line['budgeted_hours'] > 0:
line['pro_hourly_rate'] = line['budgeted_revenue'] / line['budgeted_hours']
if 'actual_revenue' in line and 'actual_cost' in line and 'expenses_amt' in line and 'id' in line:
line['profit_amt'] = line['actual_revenue'] - line['actual_cost'] - line['expenses_amt']
return res