From 0a38e8348a8a5ae6f8884839fc75e3f9ddd35202 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?=
<9664676+pengyuthon@user.noreply.gitee.com>
Date: Fri, 6 Mar 2026 19:30:49 +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_catering/data/catering_time.xml | 26 ----------
yuthon_catering/models/yuthon_catering.py | 5 +-
.../controllers/applet_attendance.py | 2 +-
.../models/yuthon_vacation_reports.py | 49 +++++++++----------
.../views/yuthon_vacation_reports_views.xml | 4 +-
5 files changed, 28 insertions(+), 58 deletions(-)
diff --git a/yuthon_catering/data/catering_time.xml b/yuthon_catering/data/catering_time.xml
index a6bcad612..dac3f6859 100644
--- a/yuthon_catering/data/catering_time.xml
+++ b/yuthon_catering/data/catering_time.xml
@@ -1,19 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
定时任务:餐饮通知
@@ -27,18 +14,5 @@
-1
-
- 定时任务:生成餐饮
-
- code
- model.task_conf()
-
-
- -1
- days
-
- -1
-
-
\ No newline at end of file
diff --git a/yuthon_catering/models/yuthon_catering.py b/yuthon_catering/models/yuthon_catering.py
index 9a3c5f13f..b20011d28 100644
--- a/yuthon_catering/models/yuthon_catering.py
+++ b/yuthon_catering/models/yuthon_catering.py
@@ -51,7 +51,7 @@ class YuthonCatering(models.Model):
category='can',
user_id=emp.wecom_userid,
title="餐饮通知",
- description="请在 18:00 前登记次日用餐,18点后未填的系统将自动视为就餐。可在 21 点前进行修改。如有疑问,联系办公室。",
+ description="请在 18:00 前登记次日用餐,18点后未填的系统将自动视为就餐,如有疑问,联系办公室。",
url=url,
btntxt="详细信息"
)
@@ -286,8 +286,6 @@ class YuthonCatering(models.Model):
'lunch': True,
})
-
-
def batch_confirm_catering(self):
records = self.env['yuthon.catering'].browse(self._context.get('active_ids', []))
records.write({
@@ -334,7 +332,6 @@ class YuthonCatering(models.Model):
(2026, 1),
(2026, 2),
]
-
all_dates = []
for y, m in target_months:
d = date_cls(y, m, 1)
diff --git a/yuthon_hr_attendance/controllers/applet_attendance.py b/yuthon_hr_attendance/controllers/applet_attendance.py
index 1958064ab..dd8b73067 100644
--- a/yuthon_hr_attendance/controllers/applet_attendance.py
+++ b/yuthon_hr_attendance/controllers/applet_attendance.py
@@ -603,7 +603,7 @@ class AppletAttendance(Controller):
('试用天数', 'test_days'),
('年假', 'done_leave'),
('加班时', 'done_working_overtime'),
- ('误餐次数', 'meal_fee'),
+ ('误餐次数', 'remain_missed_meals'),
('体检费', 'medical_fee'),
('调休', 'compensatory_leave'),
('事假', 'leave_of_absence'),
diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py
index fd310a10e..4965ec11e 100644
--- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py
+++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py
@@ -66,7 +66,6 @@ class YuthonVacationReports(models.Model):
leave = fields.Float(string='剩余年假d', compute='_compute_leave', store=True, digits=(16, 3), group_operator=None)
working_overtime = fields.Float(string='剩余补休d', compute='_compute_working_overtime', store=True,
digits=(16, 3), group_operator=None)
- meal_fee = fields.Float(string="误餐次数", compute='_compute_meal_fee', store=True, group_operator=None)
remain_missed_meals = fields.Float(string="剩余误餐次数", compute='_compute_meal_fee', store=True, group_operator=None)
medical_fee = fields.Float(string="体检费", compute='_compute_medical_fee', store=True, group_operator=None)
compensatory_leave = fields.Float(string="调休d", compute='_compute_other_leave', store=True, group_operator=None)
@@ -227,26 +226,31 @@ class YuthonVacationReports(models.Model):
vacation.update_line()
def update_is_visible(self):
- target_calendar_names = [
- '行政考勤-本部',
- '行政考勤-物管',
- '行政考勤-粮储'
- ]
- target_calendars = self.env['resource.calendar'].search([
- ('name', 'in', target_calendar_names)
- ])
- target_employee_ids = set()
- if target_calendars:
- for calendar in target_calendars:
- employee_ids = calendar.resource_user_ids.ids
- target_employee_ids.update(employee_ids)
over_ids = self.env["yuthon.vacation.reports"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for rec in over_ids:
- if rec.employee_id.id in target_employee_ids:
- rec.remaining_number_card = 0
+ inherit_lines = rec.meal_fee_ids.filtered(lambda l: l.text == '上月额度继承')
+ if not inherit_lines:
+ continue
+
+ current_date = rec.vacation_date
+ if current_date.month == 1:
+ last_month = current_date.replace(year=current_date.year - 1, month=12, day=1)
else:
- rec.remaining_number_card = 3
+ last_month = current_date.replace(month=current_date.month - 1, day=1)
+ last_month_report = self.env["yuthon.vacation.reports"].search([
+ ('employee_id', '=', rec.employee_id.id),
+ ('vacation_date', '=', last_month)
+ ], limit=1)
+ if not last_month_report:
+ inherit_lines.unlink()
+ else:
+ last_remain = last_month_report.remain_missed_meals or 0.0
+ inherit_lines.write({
+ 'update_lines': last_remain,
+ })
+
+
def all_update_line(self):
records = self.env["yuthon.vacation.reports"].browse(
@@ -1227,15 +1231,14 @@ class YuthonVacationReports(models.Model):
'last_holiday': last_month_record.last_holiday,
'last_workday': last_month_record.last_workday,
'valid_date1': last_month_record.valid_date1,
- 'meal_fee': last_month_record.meal_fee,
'year_holiday': last_month_record.year_holiday,
'year_workday': last_month_record.year_workday,
'previous_year1': last_month_record.previous_year1,
'used_this_year1': last_month_record.used_this_year1,
}
rec.write(inherit_vals)
- if rec.meal_fee:
- self._update_meal_lines(rec, [rec], rec.meal_fee)
+ if rec.remain_missed_meals:
+ self._update_meal_lines(rec, [rec], rec.remain_missed_meals)
if rec.leave:
leave_hours = rec.leave * 8
self._update_leave_lines(rec, [rec], leave_hours)
@@ -1342,7 +1345,6 @@ class YuthonVacationReports(models.Model):
record.write({
'leave': 0.0,
'working_overtime': 0.0,
- 'meal_fee': 0,
})
return {
'type': 'ir.actions.client',
@@ -1459,16 +1461,13 @@ class YuthonVacationReports(models.Model):
@api.depends('meal_fee_ids.update_lines', 'meal_fee_ids.update_type', 'meal_fee_ids.is_void')
def _compute_meal_fee(self):
for record in self:
- meal_add = 0
meal_total = 0
for line in record.meal_fee_ids:
if not line.is_void:
if line.update_type == 'add':
meal_total += int(line.update_lines or 0)
- meal_add += int(line.update_lines or 0)
elif line.update_type == 'reduce':
meal_total -= int(line.update_lines or 0)
- record.meal_fee = meal_add
record.remain_missed_meals = meal_total
def all_confirm(self):
@@ -2211,7 +2210,7 @@ class VacationMealLine(models.Model):
reasons = fields.Text(string="申请事由", compute="_compute_overtime", store=True)
meal = fields.Selection([('yes', '是'), ('no', '否')], compute="_compute_overtime", string='是否误餐', default=None)
update_date = fields.Date(string='更新时间')
- update_lines = fields.Float(string='更新额度h')
+ update_lines = fields.Float(string='更新额度')
is_soon = fields.Boolean(string="流程修改")
is_void = fields.Boolean(string='是否作废', default=False)
valid_date = fields.Date(string='有效期至')
diff --git a/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml b/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml
index 101e84cea..7eb1fc231 100644
--- a/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml
+++ b/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml
@@ -72,7 +72,7 @@
-
+
@@ -139,7 +139,7 @@
-
+