From b94ea9cd5b24adfdcc8319e7e90d602e9252fef8 Mon Sep 17 00:00:00 2001 From: zhouzhou <123@qq.com> Date: Sun, 15 Dec 2024 18:21:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_contract/models/inherit_hr_contract.py | 5 +++++ yuthon_contract/views/inherit_hr_contract_views.xml | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/yuthon_contract/models/inherit_hr_contract.py b/yuthon_contract/models/inherit_hr_contract.py index c764d5164..e81698484 100644 --- a/yuthon_contract/models/inherit_hr_contract.py +++ b/yuthon_contract/models/inherit_hr_contract.py @@ -59,3 +59,8 @@ class HrContract(models.Model): "target": "new", } + def refresh_contract_action(self): + resource_calendar_id = self.env['resource.calendar'].search([('name', '=', '行政考勤')], limit=1) + for rec in self: + rec.write({ + 'resource_calendar_id': resource_calendar_id.id,}) diff --git a/yuthon_contract/views/inherit_hr_contract_views.xml b/yuthon_contract/views/inherit_hr_contract_views.xml index 87718dbdc..fc1d4a6f8 100644 --- a/yuthon_contract/views/inherit_hr_contract_views.xml +++ b/yuthon_contract/views/inherit_hr_contract_views.xml @@ -81,4 +81,11 @@ code action = model.action_hr_contract() + + 刷新部门 + + + code + action = model.refresh_contract_action() +