diff --git a/project_forecast/models/project_forecast.py b/project_forecast/models/project_forecast.py
index 824e4f1..d1071cc 100755
--- a/project_forecast/models/project_forecast.py
+++ b/project_forecast/models/project_forecast.py
@@ -17,6 +17,7 @@ class PlanningShift(models.Model):
project_id = fields.Many2one('project.project', string="Project", domain="[('company_id', '=', company_id), ('allow_forecast', '=', True)]", check_company=True)
budgeted_hours = fields.Float("Budgeted hours", default=0, compute='_compute_budgeted_hours', store=True)
+ rem_all_hours = fields.Float("Remaining Allocated hours", default=0, compute='_compute_budgeted_hours', store=True)
task_id = fields.Many2one('project.task', string="Task", domain="[('company_id', '=', company_id), ('project_id', '=', project_id)]", check_company=True)
_sql_constraints = [
@@ -27,6 +28,8 @@ class PlanningShift(models.Model):
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
if 'budgeted_hours' in fields:
fields.remove('budgeted_hours')
+ if 'rem_all_hours' in fields:
+ fields.remove('rem_all_hours')
return super(PlanningShift, self).read_group(domain, fields, groupby, offset, limit, orderby, lazy)
@@ -36,12 +39,22 @@ class PlanningShift(models.Model):
if slot.project_id and slot.employee_id:
if slot.project_id.project_type == 'hours_no_limit':
slot.budgeted_hours = slot.project_id.budgeted_hours
- #print("slot.project_id.project_type", slot.project_id.project_type)
+ rec = self.search([('project_id','=',slot.project_id.id)])
+ all_hours = 0
+ for r in rec:
+ all_hours += r.allocated_hours
+ slot.rem_all_hours = self.budgeted_hours - all_hours
if slot.project_id.project_type == 'hours_in_consultant':
cons = self.env['project.sale.line.employee.map'].search([('employee_id','=',slot.employee_id.id),('project_id','=',slot.project_id.id)], limit=1)
slot.budgeted_hours = cons and cons.budgeted_qty or 0
+ rec = self.search([('employee_id', '=', slot.employee_id.id),('project_id', '=', slot.project_id.id)])
+ all_hours = 0
+ for r in rec:
+ all_hours += r.allocated_hours
+ slot.rem_all_hours = self.budgeted_hours - all_hours
else:
slot.budgeted_hours = 0
+ slot.rem_all_hours = 0
@api.onchange('task_id')
def _onchange_task_id(self):
diff --git a/project_forecast/views/planning_views.xml b/project_forecast/views/planning_views.xml
index b7dd760..d63574a 100755
--- a/project_forecast/views/planning_views.xml
+++ b/project_forecast/views/planning_views.xml
@@ -11,8 +11,9 @@
-
+
+
@@ -28,6 +29,7 @@
+
diff --git a/project_report/report/project_budget_amt_analysis.py b/project_report/report/project_budget_amt_analysis.py
index 898478f..a71caa4 100755
--- a/project_report/report/project_budget_amt_analysis.py
+++ b/project_report/report/project_budget_amt_analysis.py
@@ -46,7 +46,7 @@ class BudgetAmtAnalysis(models.Model):
PRO.create_date AS create_date,
PRO.partner_id AS partner_id,
'Actual Revenue' as amount_type,
- sum(AAL.amount * -1) + pro.total_expenses AS revenue
+ pro.total_expenses AS revenue
FROM project_project PRO
LEFT JOIN sale_order SO ON PRO.sale_order_id = SO.id
LEFT JOIN account_analytic_account AA ON PRO.analytic_account_id = AA.id
diff --git a/project_report/report/project_budget_amt_analysis_views.xml b/project_report/report/project_budget_amt_analysis_views.xml
index c5bde16..2374ae0 100755
--- a/project_report/report/project_budget_amt_analysis_views.xml
+++ b/project_report/report/project_budget_amt_analysis_views.xml
@@ -48,7 +48,7 @@
Projects Revenue Acutal Vs Budget
project.budget.amt.report
- pivot,graph
+ graph,pivot
{'search_default_group_by_project': 1,'search_default_group_by_amount_type': 1}
diff --git a/project_report/report/project_budget_hrs_analysis.py b/project_report/report/project_budget_hrs_analysis.py
index a7fe224..4ca619d 100755
--- a/project_report/report/project_budget_hrs_analysis.py
+++ b/project_report/report/project_budget_hrs_analysis.py
@@ -14,7 +14,7 @@ class BudgetHrsAnalysis(models.Model):
#analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', readonly=True)
project_id = fields.Many2one('project.project', string='Project', readonly=True)
partner_id = fields.Many2one('res.partner', string='Client', readonly=True)
- employee_id = fields.Many2one('hr.employee', string='Employee', readonly=True)
+ employee_id = fields.Many2one('hr.employee', string='Consultant', readonly=True)
hours_type = fields.Char(string="Hours Type", readonly=True)
hours = fields.Float("Hours", digits=(16, 2), readonly=True, group_operator="sum")
diff --git a/project_report/report/project_budget_hrs_analysis_views.xml b/project_report/report/project_budget_hrs_analysis_views.xml
index 5b90433..23ee61b 100755
--- a/project_report/report/project_budget_hrs_analysis_views.xml
+++ b/project_report/report/project_budget_hrs_analysis_views.xml
@@ -48,7 +48,7 @@
Projects Hours Acutal Vs Budget
project.budget.hrs.report
- pivot,graph
+ graph,pivot
{'search_default_group_by_project': 1,'search_default_group_by_hours_type': 1}