diff --git a/cor_custom/models/analytic.py b/cor_custom/models/analytic.py
index 97c0605..8cb31f3 100644
--- a/cor_custom/models/analytic.py
+++ b/cor_custom/models/analytic.py
@@ -10,4 +10,9 @@ class AccountAnalyticLine(models.Model):
ispercentage = fields.Boolean(string="Is Percentage", default=False)
percentage_rate = fields.Float(string="Percentage (%)")
- per_from_amt = fields.Float(string="Of", digits=(6, 2))
\ No newline at end of file
+ per_from_amt = fields.Float(string="Of", digits=(6, 2))
+
+ @api.onchange('ispercentage', 'percentage_rate', 'per_from_amt')
+ def onchange_amount(self):
+ if self.ispercentage == True and self.percentage_rate > 0.0 and self.per_from_amt > 0.0:
+ self.amount = - (self.per_from_amt * (self.percentage_rate / 100))
\ No newline at end of file
diff --git a/cor_custom/models/project_overview.py b/cor_custom/models/project_overview.py
index f697d5f..3c1b54c 100755
--- a/cor_custom/models/project_overview.py
+++ b/cor_custom/models/project_overview.py
@@ -102,6 +102,15 @@ class Project(models.Model):
values['dashboard'] = dashboard_values
+ # Profit Percentage added in COR Project
+ try:
+ profit_amount = profit['total']
+ revenues_amount = profit['invoiced'] + profit['to_invoice'] + profit['other_revenues']
+ profit_percent = round(profit_amount / revenues_amount * 100, 2) if revenues_amount else 0.0
+ profit['profit_percent'] = profit_percent
+ except Exception:
+ profit['profit_percent'] = 0
+
#
# Time Repartition (per employee per billable types)
#
diff --git a/cor_custom/views/analytic_view.xml b/cor_custom/views/analytic_view.xml
index dd0c981..4f3dd79 100755
--- a/cor_custom/views/analytic_view.xml
+++ b/cor_custom/views/analytic_view.xml
@@ -6,7 +6,7 @@
account.analytic.line
-
+
diff --git a/cor_custom/views/hr_timesheet_templates.xml b/cor_custom/views/hr_timesheet_templates.xml
index c997bba..f2eda16 100755
--- a/cor_custom/views/hr_timesheet_templates.xml
+++ b/cor_custom/views/hr_timesheet_templates.xml
@@ -6,6 +6,23 @@
project.project
+
+
+
+
+
+
+ |
+
+ ( %)
+ |
+
+ Total
+ |
+
+
Hourly Rate |