diff --git a/cor_custom/models/project.py b/cor_custom/models/project.py index 5ccee2d..392338f 100755 --- a/cor_custom/models/project.py +++ b/cor_custom/models/project.py @@ -69,6 +69,28 @@ class Project(models.Model): copy=False, help="Consultant timesheet hours") project_cons_hrs = fields.One2many('project.consultant.hrs', 'project_id', 'Consultant Allocation', copy=False) comment = fields.Text(string='Comment') + tag_ids = fields.Many2many('custom.project.tags', string='Tags') + + @api.onchange('allowed_internal_user_ids') + def onchange_add_allowed_internal_users(self): + user_list = [] + consultant_list = [] + employee_obj = [] + if self.allowed_internal_user_ids: + user_list = self.allowed_internal_user_ids.ids + if self.sale_line_employee_ids: + for consultant in self.sale_line_employee_ids: + consultant_list.append(consultant.employee_id.user_id.id) + users = (set(user_list)) - (set(consultant_list)) + for record in list(users): + emp_obj = self.env['hr.employee'].search([('user_id', '=', record)]).id + if emp_obj: + employee_obj.append(emp_obj) + if employee_obj: + for employee in employee_obj: + self.sale_line_employee_ids.create({'project_id': self._origin.id, + 'employee_id': employee}) + def _onchange_calculate_timesheet_hours(self): self.consultant_timesheet_hrs = [(6, 0, False)] @@ -263,3 +285,14 @@ class InheritProjectProductEmployeeMap(models.Model): else: # line.price_unit = 0 line.currency_id = False + +class CustomProjectTags(models.Model): + """ Tags of project's tasks """ + _name = "custom.project.tags" + _description = "Project Tag" + + name = fields.Char('Name', required=True) + + _sql_constraints = [ + ('name_uniq', 'unique (name)', "Tag name already exists!"), + ] \ No newline at end of file diff --git a/cor_custom/security/ir.model.access.csv b/cor_custom/security/ir.model.access.csv index 872b016..2fe793a 100755 --- a/cor_custom/security/ir.model.access.csv +++ b/cor_custom/security/ir.model.access.csv @@ -9,4 +9,6 @@ access_model_project_multi_budget_assign_pmanager,project.multi.budget.assign,mo access_model_project_multi_budget_assign_line_puser,project.multi.budget.assign.line,model_project_multi_budget_assign_line,project.group_project_user,1,0,0,0 access_model_project_multi_budget_assign_line_pmanager,project.multi.budget.assign.line,model_project_multi_budget_assign_line,project.group_project_manager,1,1,1,1 access_project_consultant_hrs_report_puser,project.consultant.hrs.report,model_project_consultant_hrs_report,project.group_project_user,1,0,0,0 -access_project_consultant_hrs_report_pmanager,project.consultant.hrs.report,model_project_consultant_hrs_report,project.group_project_manager,1,1,1,1 \ No newline at end of file +access_project_consultant_hrs_report_pmanager,project.consultant.hrs.report,model_project_consultant_hrs_report,project.group_project_manager,1,1,1,1 +access_custom_project_tags_puser,custom.project.tags,model_custom_project_tags,project.group_project_user,1,1,1,1 + diff --git a/cor_custom/views/project_view.xml b/cor_custom/views/project_view.xml index 0f68c30..6f7e6ef 100755 --- a/cor_custom/views/project_view.xml +++ b/cor_custom/views/project_view.xml @@ -21,8 +21,9 @@ - - + + @@ -33,7 +34,10 @@ - + + + + @@ -60,9 +64,10 @@ widget="radio"/> - + - + @@ -107,7 +112,8 @@ domain="[('order_id','=',parent.sale_order_id), ('is_service', '=', True)]"/> --> - + @@ -190,6 +196,57 @@ + + + Tags + custom.project.tags + + + + + + + + + Tags + custom.project.tags + + + + + + + + + + + + + Tags + custom.project.tags + + + + + + + + + Project Tags + custom.project.tags + + + No tags found. Let's create one! + + + Tags are perfect to categorize your tasks. + + + + + + action="project.action_view_all_task" sequence="52" + groups="base.group_no_one,project.group_project_user"/>
+ No tags found. Let's create one! +
+ Tags are perfect to categorize your tasks. +