diff --git a/yuthon_will_task/models/yuthon_will_task.py b/yuthon_will_task/models/yuthon_will_task.py index a91cdfa41..a756094eb 100644 --- a/yuthon_will_task/models/yuthon_will_task.py +++ b/yuthon_will_task/models/yuthon_will_task.py @@ -57,6 +57,7 @@ class YuthonWillTask(models.Model): company_id = fields.Many2one('res.company', string="公司", default=lambda self: self.env.company) name = fields.Text(string='任务内容') remarks = fields.Text(string='备注') + employee_ids_short = fields.Char(string='参与人简略', compute='_compute_employee_ids_short') creation_time = fields.Date(string='创建时间', default=fields.Date.today()) employee_ids = fields.Many2many('hr.employee', 'will_task_employee_rel', 'custom_id', 'employee_id', string='人员', store=True, index=True) @@ -122,6 +123,12 @@ class YuthonWillTask(models.Model): } + @api.depends('employee_ids') + def _compute_employee_ids_short(self): + for record in self: + names = record.employee_ids.mapped('name')[:2] + record.employee_ids_short = '、'.join(names) + @api.depends('start_date') def _compute_task_week(self): weekdays = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"] diff --git a/yuthon_will_task/views/yuthon_will_task_views.xml b/yuthon_will_task/views/yuthon_will_task_views.xml index c43a0640a..c14b7818d 100644 --- a/yuthon_will_task/views/yuthon_will_task_views.xml +++ b/yuthon_will_task/views/yuthon_will_task_views.xml @@ -281,6 +281,7 @@ + @@ -311,11 +312,7 @@ - 参与人 - - 、 - - 等共人 + 参与人 等共人