Merge branch 'development' of http://103.74.223.20:8085/prakash.jain/cor-odoo into pawan_branch

This commit is contained in:
Pawan Kumar 2021-01-27 11:25:56 +05:30
commit 92286476c8
4 changed files with 93 additions and 8 deletions

View File

@ -20,7 +20,7 @@
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base', 'crm', 'sale_timesheet', 'analytic', 'hr'],
'depends': ['base', 'crm', 'sale_timesheet', 'analytic', 'hr', 'hr_timesheet'],
# always loaded
'data': [

View File

@ -15,6 +15,18 @@
</field>
</record>-->
<record id="view_hr_task_timesheet_inherit_time" model="ir.ui.view">
<field name="name">Start and End time task timesheets</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='timesheet_ids']//tree//field[@name='name']" position="after">
<field name="start_time" widget="float_time"/>
<field name="end_time" widget="float_time"/>
</xpath>
</field>
</record>
<record id="view_account_analytic_line_inherit1" model="ir.ui.view">
<field name="name">Analytic line</field>
<field name="model">account.analytic.line</field>

View File

@ -33,9 +33,9 @@ class BudgetHrsAnalysis(models.Model):
"""@api.model
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
if 'hours_type' not in groupby:
groupby.append('hours_type')
res = super().read_group(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy)
for a in res:
print("A",a)
return res"""
def init(self):
@ -61,7 +61,25 @@ class BudgetHrsAnalysis(models.Model):
Left JOIN project_sale_line_employee_map pro_emp ON pro_emp.project_id = pro.id
Where
pro.active = 't'
and PRO.pricing_type = 'employee_rate'
and PRO.pricing_type = 'employee_rate' and PRO.project_type = 'hours_in_consultant'
Union
SELECT
pro.id AS project_id,
pro.date_start AS start_date,
pro.date AS end_date,
pro.pricing_type as pricing_type,
pro.project_type as project_type,
pro.partner_id AS partner_id,
null::int AS employee_id,
'Budgeted Hours' as hours_type,
null::date AS timesheet_date,
pro.budgeted_hours2 as hours
FROM
project_project PRO
--Left JOIN project_sale_line_employee_map pro_emp ON pro_emp.project_id = pro.id
Where
pro.active = 't'
and PRO.pricing_type = 'employee_rate' and PRO.project_type = 'hours_no_limit'
Union
SELECT
pro.id AS project_id,

View File

@ -250,6 +250,61 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
return legendOptions;
},
/**
* Extracts the important information from a tooltipItem generated by Charts.js
* (a tooltip item corresponds to a line (different from measure name) of a tooltip)
*
* @private
* @param {Object} item
* @param {Object} data
* @returns {Object}
*/
_getTooltipItemContent: function (item, data) {
var dataset = data.datasets[item.datasetIndex];
var label = data.labels[item.index];
var value;
var boxColor;
if (this.state.mode === 'bar') {
label = this._relabelling(label, dataset.originIndex);
if (this.state.processedGroupBy.length > 1 || this.state.origins.length > 1) {
label = label + "/" + dataset.label;
}
value = this._formatValue(item.yLabel);
boxColor = dataset.backgroundColor;
} else if (this.state.mode === 'horizontalBar') {
label = this._relabelling(label, dataset.originIndex);
if (this.state.processedGroupBy.length > 1 || this.state.origins.length > 1) {
label = label + "/" + dataset.label;
}
value = this._formatValue(item.xLabel);
boxColor = dataset.backgroundColor;
}
else if (this.state.mode === 'line') {
label = this._relabelling(label, dataset.originIndex);
if (this.state.processedGroupBy.length > 1 || this.state.origins.length > 1) {
label = label + "/" + dataset.label;
}
value = this._formatValue(item.yLabel);
boxColor = dataset.borderColor;
} else {
if (label.isNoData) {
value = this._formatValue(0);
} else {
value = this._formatValue(dataset.data[item.index]);
}
label = this._relabelling(label, dataset.originIndex);
if (this.state.origins.length > 1) {
label = dataset.label + "/" + label;
}
boxColor = dataset.backgroundColor[item.index];
}
return {
label: label,
value: value,
boxColor: boxColor,
};
},
_isRedirectionEnabled: function () {
return !this.disableLinking &&
(this.state.mode === 'bar' || this.state.mode === 'horizontalBar' || this.state.mode === 'pie');
@ -394,7 +449,7 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
duration: "1",
"onComplete": function() {
var chartInstance = this.chart,
ctx = chartInstance.ctx;
ctx = chartInstance.ctx;
ctx.font = Chart.helpers.fontString(12, 'bold', "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif");
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
@ -403,7 +458,7 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
meta.data.forEach(function(bar, index) {
var data = dataset.data[index];
var value;
if(!!data){
if(!!data && chartInstance.isDatasetVisible(i)){
value = GraphVal._formatValue(data);
ctx.fillText(value, bar._model.x, bar._model.y - 5);
}
@ -431,9 +486,9 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
var meta = chartInstance.controller.getDatasetMeta(i);
meta.data.forEach(function(bar, index) {
var data = dataset.data[index];
//console.log("data", JSON.stringify(data))
//console.log("data", JSON.stringify(data), chartInstance.isDatasetVisible(i), !chartInstance.isDatasetVisible(i))
var value;
if(!!data){
if(!!data && chartInstance.isDatasetVisible(i)){
value = GraphVal._formatValue(data);
ctx.fillText(value, bar._model.x, bar._model.y + 5);
}