From 80de65b053dca6050719fc226b8642683396e164 Mon Sep 17 00:00:00 2001 From: prakash Date: Thu, 14 Apr 2022 12:38:30 +0530 Subject: [PATCH] Report total profit percentage and filter updated --- project_report/report/project_revenue_custom_report.py | 5 +++++ .../report/project_revenue_custom_report_views.xml | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/project_report/report/project_revenue_custom_report.py b/project_report/report/project_revenue_custom_report.py index dce246a..ec06461 100755 --- a/project_report/report/project_revenue_custom_report.py +++ b/project_report/report/project_revenue_custom_report.py @@ -244,5 +244,10 @@ class ProjectRevenueCustomReport(models.Model): 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'] + if 'profit_amt' in line and 'actual_revenue' in line and 'id' in line: + try: + line['profit_per'] = (line['profit_amt'] / line['actual_revenue']) * 100 + except ZeroDivisionError: + pass return res diff --git a/project_report/report/project_revenue_custom_report_views.xml b/project_report/report/project_revenue_custom_report_views.xml index 75373fa..c9d1391 100755 --- a/project_report/report/project_revenue_custom_report_views.xml +++ b/project_report/report/project_revenue_custom_report_views.xml @@ -67,8 +67,8 @@ - - + +