Merge branch 'development' into 'master'

Development

See merge request prakash.jain/cor-odoo!172
This commit is contained in:
prakash.jain 2021-04-07 01:43:52 -07:00
commit e28b2b38a4
3 changed files with 20 additions and 11 deletions

View File

@ -13,6 +13,8 @@ import dateutil.parser
class AccountAnalyticLine(models.Model):
_inherit = 'account.analytic.line'
#_order = 'date desc, id desc'
_order = 'date desc, unit_amount'
@api.depends('project_id', 'employee_id')
def name_get(self):
@ -37,6 +39,7 @@ class AccountAnalyticLine(models.Model):
#end_time = fields.Float(string='End Time', digits=(16, 2))
start_datetime = fields.Datetime("Start Time", required=True)
end_datetime = fields.Datetime("End Time", required=True)
date = fields.Date('Date', required=True, index=True, compute='_compute_start_end_date', store=True)
unit_amount = fields.Float('Duration', default=0.0)
parent_project = fields.Many2one('project.project', related='project_id.parent_project', string='Parent Project')
sub_project = fields.Many2one('project.project', domain="[('is_sub_project', '=', True)]",
@ -216,7 +219,8 @@ class AccountAnalyticLine(models.Model):
self.project_id._onchange_calculate_timesheet_hours()
return res
@api.onchange('start_datetime', 'end_datetime')
def _onchange_start_end_date(self):
if self.start_datetime:
self.date = self.start_datetime.date()
@api.depends('start_datetime', 'end_datetime')
def _compute_start_end_date(self):
for rec in self:
if rec.start_datetime:
rec.date = rec.start_datetime.date()

View File

@ -9,7 +9,7 @@ class ProjectTimelineReport(models.Model):
_name = "project.timesheet.report"
_description = "Project Timesheet Report"
_order = 'start_date desc, project_id desc'
_order = 'start_date desc, duration, project_id desc'
_auto = False
start_date = fields.Date(string='Start Time', readonly=True)
@ -70,17 +70,20 @@ class ProjectTimelineReport(models.Model):
CREATE OR REPLACE VIEW %s AS (
SELECT
ROW_NUMBER() OVER() as id,
start_datetime::date as start_date,
employee_id,
project_id,
sub_project,
aal.start_datetime::date as start_date,
aal.employee_id,
aal.project_id,
aal.sub_project,
unit_amount as duration,
CONCAT(to_char((start_datetime at time zone 'utc') at time zone 'Asia/Jerusalem', 'HH24:MI'), '-',
to_char((end_datetime at time zone 'utc') at time zone 'Asia/Jerusalem', 'HH24:MI')) as timestamp,
--CONCAT(to_char(start_datetime at time zone 'utc', 'HH24:MI'), '-', to_char(end_datetime at time zone 'utc', 'HH24:MI')) as timestamp,
task_id,
name as description
from account_analytic_line
aal.name as description
from account_analytic_line aal
left join project_project pro on pro.id = aal.project_id
--left join hr_employee emp on emp.id = aal.employee_id
where pro.active = True
)""" % (self._table,))

View File

@ -297,6 +297,8 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
var label = data.labels[item.index];
var value;
var boxColor;
console.log('11111', dataset);
console.log('222222', dataset.originIndex);
if (this.state.mode === 'bar') {
label = this._relabelling(label, dataset.originIndex);
if (this.state.processedGroupBy.length > 1 || this.state.origins.length > 1) {