diff --git a/yuthon_salary/models/yuthon_meal_expenses.py b/yuthon_salary/models/yuthon_meal_expenses.py
index 6f24f4124..d5419a19d 100644
--- a/yuthon_salary/models/yuthon_meal_expenses.py
+++ b/yuthon_salary/models/yuthon_meal_expenses.py
@@ -79,6 +79,40 @@ class YuthonMealExpenses(models.Model):
},
}
+ def action_generate_missing_feb(self):
+ target_year = '2026'
+ target_month = '2'
+ # 取全部参餐员工
+ all_confs = self.env['yuthon.catering.conf'].search([])
+ all_employees = all_confs.mapped('employee_ids')
+ # 已有记录的员工
+ existing = self.search([
+ ('select_year', '=', target_year),
+ ('select_time', '=', target_month),
+ ])
+ existing_emp_ids = existing.mapped('employee_id').ids
+ # 批量创建缺失记录
+ created = 0
+ for emp in all_employees:
+ if emp.id not in existing_emp_ids:
+ self.create({
+ 'employee_id': emp.id,
+ 'card': emp.identification_id or '',
+ 'select_year': target_year,
+ 'select_time': target_month,
+ })
+ created += 1
+ return {
+ 'type': 'ir.actions.client',
+ 'tag': 'display_notification',
+ 'params': {
+ 'title': '生成完成',
+ 'message': '共生成2026年2月缺失数据 %d 条' % created,
+ 'type': 'success',
+ 'sticky': False,
+ }
+ }
+
def action_view_detail(self):
self.ensure_one()
date_start, date_end = self._get_date_range()
diff --git a/yuthon_salary/views/yuthon_meal_expenses_views.xml b/yuthon_salary/views/yuthon_meal_expenses_views.xml
index f8a8f0be0..26a154c58 100644
--- a/yuthon_salary/views/yuthon_meal_expenses_views.xml
+++ b/yuthon_salary/views/yuthon_meal_expenses_views.xml
@@ -24,6 +24,9 @@
yuthon.meal.expenses
+