diff --git a/cor_custom/report/project_hours_report.py b/cor_custom/report/project_hours_report.py index b4c6005..b347d84 100755 --- a/cor_custom/report/project_hours_report.py +++ b/cor_custom/report/project_hours_report.py @@ -1,13 +1,14 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import fields, models, tools +from odoo import api, fields, models, tools class BudgetHrsAnalysis(models.Model): _name = "project.consultant.hrs.report" _description = "Project consultant hours analysis report" + _rec_name = "project_id" #_order = 'project_id desc, hours_type asc, end_date desc, employee_id' _auto = False @@ -21,6 +22,16 @@ class BudgetHrsAnalysis(models.Model): #roworder = fields.Integer("Row Order") #ptime = fields.Char(string="Time", readonly=True) + @api.depends('project_id', 'employee_id') + def name_get(self): + res = [] + for record in self: + name = record.project_id and record.project_id.name or '' + if record.employee_id.name: + name = record.employee_id.name + '/' + name + res.append((record.id, name)) + return res + """def _generate_order_by(self, order_spec, query): order_by = super(BudgetHrsAnalysis, self)._generate_order_by(order_spec, query) print("order by>>>>>>>>>>>>>>", order_by) diff --git a/cor_custom/report/project_hours_report_view.xml b/cor_custom/report/project_hours_report_view.xml index cc6cc0c..1c7c010 100755 --- a/cor_custom/report/project_hours_report_view.xml +++ b/cor_custom/report/project_hours_report_view.xml @@ -65,6 +65,23 @@ + + Consultant Allocation ir.actions.act_window @@ -80,6 +97,9 @@ + Project Consul Report Hours diff --git a/cor_custom/security/cor_custom_security.xml b/cor_custom/security/cor_custom_security.xml index 1d80a04..18376d2 100755 --- a/cor_custom/security/cor_custom_security.xml +++ b/cor_custom/security/cor_custom_security.xml @@ -66,5 +66,18 @@ + + Project: view Consultant: Own User + + [('employee_id.user_id', '=', user.id)] + + + + + Project: view Consultant: see all + + [(1, '=', 1)] + +