diff --git a/planning_gantt/__manifest__.py b/planning_gantt/__manifest__.py index 88629423c..01e6986a8 100644 --- a/planning_gantt/__manifest__.py +++ b/planning_gantt/__manifest__.py @@ -4,8 +4,6 @@ 'summary': "Planning Gantt", 'description': 'Planning Gantt', 'author': 'XSK', - 'website': '', - 'website': '', 'category': 'Tools', 'version': '17.0', 'depends': ['base', 'planning'], diff --git a/planning_gantt/static/src/js/planning_gantt_renderer.js b/planning_gantt/static/src/js/planning_gantt_renderer.js index 8013ffcea..98b828345 100644 --- a/planning_gantt/static/src/js/planning_gantt_renderer.js +++ b/planning_gantt/static/src/js/planning_gantt_renderer.js @@ -48,7 +48,9 @@ patch(PlanningGanttRenderer.prototype, { if (!groupBy) { groupPills.push({id: 0, name: "未知班次", pill: pill}) } else { - groupPills.push({id: parseInt(groupBy[0], 10), name: groupBy[1], pill: pill}) + console.log(pill) + // groupPills.push({id: parseInt(groupBy[0], 10), name: groupBy[1], pill: pill}) + groupPills.push({id: parseInt(groupBy[0], 10), name: `${pill.record.department_id[1]} ${pill.record.planning_name}`, pill: pill}) } }); // 遍历groupPills,根据type进行分组,并计算数量 @@ -223,6 +225,7 @@ patch(PlanningGanttRenderer.prototype, { groupPills[key].pills = aggregatePills; }); // 填充模板信息 + console.log(groupPills) this.fetchSlotTemplate(groupPills); return Object.values(groupPills); }, diff --git a/planning_gantt/views/plan_views.xml b/planning_gantt/views/plan_views.xml index 7c42bf474..ad48d161c 100644 --- a/planning_gantt/views/plan_views.xml +++ b/planning_gantt/views/plan_views.xml @@ -1,16 +1,16 @@ - - - planning.slot.gantt.inherit - planning.slot - - - - - - - + + + planning.slot.gantt.inherit + planning.slot + + + + + + + - + \ No newline at end of file diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py index 75a573742..d99e63101 100644 --- a/yuthon_hr_attendance/__manifest__.py +++ b/yuthon_hr_attendance/__manifest__.py @@ -13,7 +13,7 @@ 'sequence': 240, 'website': 'https://www.pengyuthon.com', 'depends': ['hr_attendance', 'resource', 'base', 'hr', 'mail', - 'soong_workflow', 'yuthon_issue', 'planning', 'calendar', 'web_gantt', 'yuthon_wechat', 'yuthon_hr_employee'], + 'soong_workflow', 'yuthon_issue', 'planning', 'calendar', 'web_gantt', 'yuthon_wechat', 'yuthon_hr_employee','planning'], 'data': [ 'security/ir.model.access.csv', 'security/planning_group.xml', @@ -78,6 +78,7 @@ 'yuthon_hr_attendance/static/src/css/*.css', 'yuthon_hr_attendance/static/src/js/planning_gantt_renderer.js', 'yuthon_hr_attendance/static/src/xml/planning_gantt_renderer.xml', + 'yuthon_hr_attendance/static/src/planning_gantt/planning_gantt_controller.xml', ], }, 'installable': True, diff --git a/yuthon_hr_attendance/models/planning_template_inherit.py b/yuthon_hr_attendance/models/planning_template_inherit.py index 5d2ac9ba6..1d7ef4f80 100644 --- a/yuthon_hr_attendance/models/planning_template_inherit.py +++ b/yuthon_hr_attendance/models/planning_template_inherit.py @@ -101,13 +101,23 @@ class PlanningSlotTemplate(models.Model): # else: # record.display_name = "Unknown" + @api.depends('role_id','planning_name') + def _compute_display_name(self): + for shift_template in self: + name = '{} {} {}'.format( + shift_template.planning_name, + shift_template.name, + shift_template.role_id.name if shift_template.role_id.name is not False else '', + ) + shift_template.display_name = name + class Planning(models.Model): _inherit = 'planning.slot' department_id = fields.Many2one('hr.department', string='部门') color = fields.Integer("Color", compute='_compute_color') - planning_name = fields.Char("班次名称", related='template_id.planning_name') + planning_name = fields.Char("班次名称", related='template_id.planning_name', store=True) display_sequence = fields.Integer(string=" ") active = fields.Boolean('Active', default=True, tracking=True) diff --git a/yuthon_hr_attendance/static/src/planning_gantt/planning_gantt_controller.xml b/yuthon_hr_attendance/static/src/planning_gantt/planning_gantt_controller.xml new file mode 100644 index 000000000..70c3e438a --- /dev/null +++ b/yuthon_hr_attendance/static/src/planning_gantt/planning_gantt_controller.xml @@ -0,0 +1,14 @@ + + + + + + + o_hidden + + + o_hidden + + + + diff --git a/yuthon_hr_attendance/views/planning_slot_template_views.xml b/yuthon_hr_attendance/views/planning_slot_template_views.xml index 49c51117e..2216ec3bd 100644 --- a/yuthon_hr_attendance/views/planning_slot_template_views.xml +++ b/yuthon_hr_attendance/views/planning_slot_template_views.xml @@ -17,7 +17,7 @@ planning.slot.template - + 0 @@ -28,4 +28,17 @@ + + + planning.slot.gantt.inherit + planning.slot + + + + + + + + + \ No newline at end of file