From ffe32bbd151f6967b8c47a98d0d430c9aabd9fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Thu, 5 Mar 2026 20:43:11 +0800 Subject: [PATCH] =?UTF-8?q?3=E6=9C=886=E5=8F=B7=E9=A4=90=E9=A5=AE=E6=94=B6?= =?UTF-8?q?=E9=9B=86=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_catering/models/yuthon_catering.py | 25 +++++++++++++++++++++++ yuthon_catering/views/yuthon_catering.xml | 1 + 2 files changed, 26 insertions(+) diff --git a/yuthon_catering/models/yuthon_catering.py b/yuthon_catering/models/yuthon_catering.py index 8b4eebbd6..d3f41f131 100644 --- a/yuthon_catering/models/yuthon_catering.py +++ b/yuthon_catering/models/yuthon_catering.py @@ -286,6 +286,31 @@ class YuthonCatering(models.Model): 'lunch': True, }) + def fill_march6_missing_catering(self): + """表3月6日缺失员工的餐饮收集任务数据""" + from datetime import date as date_cls + target_date = date_cls(2026, 3, 6) + conf_records = self.env['yuthon.catering.conf'].search([]) + if not conf_records: + return + employee_ids = conf_records.mapped('employee_ids') + if not employee_ids: + return + create_vals = [] + for employee in employee_ids: + existing = self.search([ + ('employee_id', '=', employee.id), + ('date', '=', target_date), + ], limit=1) + if not existing: + create_vals.append({ + 'date': target_date, + 'employee_id': employee.id, + 'state': 'unconfirmed', + }) + if create_vals: + self.create(create_vals) + def batch_generate_catering(self): """批量生成2025-12、2026-01、2026-02的餐饮收集任务数据,排除节假日""" from datetime import date as date_cls diff --git a/yuthon_catering/views/yuthon_catering.xml b/yuthon_catering/views/yuthon_catering.xml index 706a48611..0cb6ffe8f 100644 --- a/yuthon_catering/views/yuthon_catering.xml +++ b/yuthon_catering/views/yuthon_catering.xml @@ -13,6 +13,7 @@