diff --git a/project_report/__manifest__.py b/project_report/__manifest__.py
index 2d16fb7..785de93 100755
--- a/project_report/__manifest__.py
+++ b/project_report/__manifest__.py
@@ -15,6 +15,7 @@
'data': [
'security/ir.model.access.csv',
'wizard/project_create_expenses_views.xml',
+ 'views/assets.xml',
#'views/project_view.xml',
'report/project_budget_hrs_analysis_views.xml',
'report/project_budget_amt_analysis_views.xml',
diff --git a/project_report/report/project_budget_hrs_analysis.py b/project_report/report/project_budget_hrs_analysis.py
index f7bf342..78aa89e 100755
--- a/project_report/report/project_budget_hrs_analysis.py
+++ b/project_report/report/project_budget_hrs_analysis.py
@@ -13,14 +13,16 @@ 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)
+ start_date = fields.Date(string='Start Date', readonly=True)
+ end_date = fields.Date(string='End Date', readonly=True)
partner_id = fields.Many2one('res.partner', string='Client', 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")
- project_type = fields.Selection([
- ('hours_in_consultant', 'Hours are budgeted according to a consultant'),
- ('hours_no_limit', 'Total hours are budgeted without division to consultant'),
- ], string="Project Type", readonly=True)
+ #project_type = fields.Selection([
+ # ('hours_in_consultant', 'Hours are budgeted according to a consultant'),
+ # ('hours_no_limit', 'Total hours are budgeted without division to consultant'),
+ #], string="Project Type", readonly=True)
#budgeted_hours = fields.Float("Budgeted Hours", digits=(16, 2), readonly=True, group_operator="sum")
#actual_hours = fields.Float("Actual Hours", digits=(16, 2), readonly=True, group_operator="sum")
@@ -30,36 +32,20 @@ class BudgetHrsAnalysis(models.Model):
tools.drop_view_if_exists(self._cr, self._table)
self._cr.execute("""
CREATE OR REPLACE VIEW %s AS (
- SELECT ROW_NUMBER() OVER() as id, project_id, partner_id, employee_id, hours_type, project_type, hours from (
+ SELECT ROW_NUMBER() OVER() as id, project_id, start_date, end_date, partner_id, employee_id, hours_type,
+ hours from (
SELECT
PRO.id AS project_id,
- PRO.create_date AS create_date,
+ Pro_emp_hours.start_date AS start_date,
+ Pro_emp_hours.end_date AS end_date,
PRO.partner_id AS partner_id,
- null::int AS employee_id,
+ Pro_emp_hours.employee_id AS employee_id,
'Budgeted Hours' as hours_type,
- PRO.project_type as project_type,
- PRO.budgeted_hours AS hours
- FROM
- project_project PRO
- --LEFT JOIN account_analytic_account AA ON Pro.analytic_account_id = AA.id
- --LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id
- --and AAL.project_id = Pro.id
- Where
- PRO.active = 't'
- and PRO.pricing_type != 'fixed_rate'
- and PRO.project_type = 'hours_no_limit'
- Union
- SELECT
- PRO.id AS project_id,
- PRO.create_date AS create_date,
- PRO.partner_id AS partner_id,
- Pro_emp.employee_id AS employee_id,
- 'Budgeted Hours' as hours_type,
- PRO.project_type as project_type,
- Pro_emp.budgeted_qty as hours
+ Pro_emp_hours.budgeted_hours as hours
FROM
project_project PRO
Left JOIN project_sale_line_employee_map Pro_emp ON Pro_emp.project_id = Pro.id
+ Left JOIN project_consultant_hrs Pro_emp_hours ON Pro_emp_hours.project_id = Pro.id
LEFT JOIN account_analytic_account AA ON Pro.analytic_account_id = AA.id
LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id
and AAL.project_id = Pro.id
@@ -70,29 +56,23 @@ class BudgetHrsAnalysis(models.Model):
Union
SELECT
PRO.id AS project_id,
- PRO.create_date AS create_date,
+ Pro_emp_hours.start_date AS start_date,
+ Pro_emp_hours.end_date AS end_date,
PRO.partner_id AS partner_id,
- AAL.employee_id AS employee_id,
+ Pro_emp_hours.employee_id AS employee_id,
'Actual Hours' as hours_type,
- PRO.project_type as project_type,
- AAL.unit_amount AS hours
+ Pro_emp_hours.actual_hours AS hours
FROM
project_project PRO
Left JOIN project_sale_line_employee_map Pro_emp ON Pro_emp.project_id = Pro.id
+ Left JOIN project_consultant_hrs Pro_emp_hours ON Pro_emp_hours.project_id = Pro.id
LEFT JOIN account_analytic_account AA ON Pro.analytic_account_id = AA.id
LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id
and AAL.project_id = Pro.id
- --and AAL.employee_id = Pro_emp.employee_id
Where
PRO.active = 't'
and PRO.pricing_type != 'fixed_rate'
- group by
- Pro.id,
- --Pro_emp.id,
- --PRO.partner_id,
- AAL.employee_id,
- AAL.unit_amount,
- hours_type
+ and PRO.project_type = 'hours_in_consultant'
) as res
order by
project_id desc,
diff --git a/project_report/report/project_budget_hrs_analysis_views.xml b/project_report/report/project_budget_hrs_analysis_views.xml
index eb27313..83ea9ac 100755
--- a/project_report/report/project_budget_hrs_analysis_views.xml
+++ b/project_report/report/project_budget_hrs_analysis_views.xml
@@ -34,12 +34,14 @@
-
-
+
+
+
diff --git a/project_report/static/src/js/graph_renderer.js b/project_report/static/src/js/graph_renderer.js
new file mode 100755
index 0000000..449b64a
--- /dev/null
+++ b/project_report/static/src/js/graph_renderer.js
@@ -0,0 +1,93 @@
+odoo.define("project_report.GraphRenderer", function(require) {
+var GraphRenderer = require("web.GraphRenderer");
+var config = require("web.config");
+var field_utils = require("web.field_utils");
+
+// Hide top legend when too many items for device size
+var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
+
+ GraphRenderer.include({
+ init: function(parent, state, params) {
+ this._super.apply(this, arguments);
+ console.log("Dataset Name", this);
+ this.title = 'Time line'
+ if (this.params && this.params.title) {
+ this.params.title = '111Time line'
+ }
+ console.log("Module Name", arguments);
+ console.log("this parent", parent);
+ console.log("this state", state);
+ console.log("this params", params);
+ },
+
+ _getElementOptions: function () {
+ var animationOptions = {};
+ if (this.state.mode === 'bar') {
+ var animationOptions = {
+ duration: "0.1",
+ "onComplete": function() {
+ var chartInstance = this.chart,
+ ctx = chartInstance.ctx;
+ ctx.font = Chart.helpers.fontString(12, 'bold', "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif");
+ ctx.textAlign = 'center';
+ ctx.textBaseline = 'bottom';
+ this.data.datasets.forEach(function(dataset, i) {
+ var meta = chartInstance.controller.getDatasetMeta(i);
+ meta.data.forEach(function(bar, index) {
+ var data = dataset.data[index];
+ if(!!data){
+ ctx.fillText(data, bar._model.x, bar._model.y - 5);
+ }
+ });
+ });
+ }
+ };
+ }
+ return animationOptions;
+ },
+
+ _prepareOptions: function (datasetsCount) {
+ const options = {
+ maintainAspectRatio: false,
+ scales: this._getScaleOptions(),
+ legend: this._getLegendOptions(datasetsCount),
+ tooltips: this._getTooltipOptions(),
+ elements: this._getElementOptions(),
+ animation: this._getElementOptions(),
+ };
+ if (this._isRedirectionEnabled()) {
+ options.onClick = this._onGraphClicked.bind(this);
+ }
+ return options;
+ },
+
+ _renderBarChart: function (dataPoints) {
+ var self = this;
+
+ // prepare data
+ var data = this._prepareData(dataPoints);
+
+ data.datasets.forEach(function (dataset, index) {
+ // used when stacked
+ dataset.stack = self.state.stacked ? self.state.origins[dataset.originIndex] : undefined;
+ // set dataset color
+ var color = self._getColor(index);
+ dataset.backgroundColor = color;
+ });
+
+ // prepare options
+ var options = this._prepareOptions(data.datasets.length);
+ console.log("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr chart data>>>>>>>>>>>>>>>>", data)
+ console.log("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr chart>>>>>>>>>>>>>>>>", options)
+ console.log("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr chart>>>>>>>>>>>>>>>>", JSON.stringify(options))
+ // create chart
+ var ctx = document.getElementById(this.chartId);
+ this.chart = new Chart(ctx, {
+ type: 'bar',
+ data: data,
+ options: options,
+ });
+ },
+
+ });
+});
diff --git a/project_report/views/assets.xml b/project_report/views/assets.xml
new file mode 100755
index 0000000..ac5abf2
--- /dev/null
+++ b/project_report/views/assets.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+