Merge pull request !9371 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2026-03-06 11:31:50 +00:00
committed by Gitee
5 changed files with 28 additions and 58 deletions
-26
View File
@@ -1,19 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<!-- <record forcecreate="True" id="yuthon_catering_time" model="ir.cron">-->
<!-- <field name="name">定时任务:餐饮收集任务</field>-->
<!-- <field name="model_id" ref="model_yuthon_catering"/>-->
<!-- <field name="state">code</field>-->
<!-- <field name="code">model.catering_task()</field>-->
<!-- <field eval="True" name="active"/>-->
<!-- <field name="user_id" ref="base.user_root"/>-->
<!-- <field name="interval_number">1</field>-->
<!-- <field name="interval_type">weeks</field>-->
<!-- <field name="nextcall" eval="(DateTime.now()).strftime('%Y-%m-%d 00:00:00')"/>-->
<!-- <field name="numbercall">-1</field>-->
<!-- <field eval="False" name="doall"/>-->
<!-- </record>-->
<record forcecreate="True" id="yuthon_task_catering_time" model="ir.cron">
<field name="name">定时任务:餐饮通知</field>
<field name="model_id" ref="model_yuthon_catering"/>
@@ -27,18 +14,5 @@
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
</record>
<record forcecreate="True" id="yuthon_task_conf_time" model="ir.cron">
<field name="name">定时任务:生成餐饮</field>
<field name="model_id" ref="model_yuthon_catering"/>
<field name="state">code</field>
<field name="code">model.task_conf()</field>
<field eval="True" name="active"/>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">-1</field>
<field name="interval_type">days</field>
<field name="nextcall" eval="(DateTime.now()).strftime('%Y-%m-%d 08:00:00')"/>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
</record>
</data>
</odoo>
+1 -4
View File
@@ -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="详细信息"
)
@@ -294,8 +294,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({
@@ -342,7 +340,6 @@ class YuthonCatering(models.Model):
(2026, 1),
(2026, 2),
]
all_dates = []
for y, m in target_months:
d = date_cls(y, m, 1)
@@ -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'),
@@ -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='有效期至')
@@ -72,7 +72,7 @@
<field name="late_allowed" options='{ "fg_color": "white: late_allowed == False"}'/>
<field name="done_leave" options='{ "fg_color": "white: done_leave == False"}'/>
<field name="done_working_overtime" options='{ "fg_color": "white: done_working_overtime == False"}'/>
<field name="meal_fee" options='{ "fg_color": "white: meal_fee == False"}'/>
<field name="remain_missed_meals" options='{ "fg_color": "white: meal_fee == False"}' string="误餐次数"/>
<field name="medical_fee" options='{ "fg_color": "white: medical_fee == False"}'/>
<field name="compensatory_leave" options='{ "fg_color": "white: compensatory_leave == False"}' column_invisible="1"/>
<field name="leave_of_absence" options='{ "fg_color": "white: leave_of_absence == False"}'/>
@@ -139,7 +139,7 @@
<field name="late_allowed" options='{ "fg_color": "white: late_allowed == False"}'/>
<field name="done_leave" options='{ "fg_color": "white: done_leave == False"}'/>
<field name="done_working_overtime" options='{ "fg_color": "white: done_working_overtime == False"}'/>
<field name="meal_fee" options='{ "fg_color": "white: meal_fee == False"}'/>
<field name="remain_missed_meals" options='{ "fg_color": "white: meal_fee == False"}' string="误餐次数"/>
<field name="medical_fee" options='{ "fg_color": "white: medical_fee == False"}'/>
<field name="compensatory_leave" options='{ "fg_color": "white: compensatory_leave == False"}' column_invisible="1"/>
<field name="leave_of_absence" options='{ "fg_color": "white: leave_of_absence == False"}'/>