Merge pull request !8824 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2026-02-09 04:19:55 +00:00
committed by Gitee
3 changed files with 42 additions and 29 deletions
@@ -996,7 +996,7 @@ class YuthonVacationReports(models.Model):
'used_this_year1': last_month_record.used_this_year1,
}
rec.write(inherit_vals)
if rec.meal_number:
if rec.meal_fee:
self._update_meal_lines(rec, [rec], rec.meal_number)
if rec.leave:
leave_hours = rec.leave * 8
@@ -1957,22 +1957,28 @@ class VacationMealLine(models.Model):
rec_month = rec.start_time.month
rec.write({'is_filing': True})
emp_id = rec.employee_id.id
meal_active_vals = {
'line_id': rec.id,
'meal_name': rec.meal_name,
'employee_id': emp_id,
'workflow_id': rec.workflow_id.id if rec.workflow_id else False,
'start_time': rec.start_time,
'end_time': rec.end_time,
'duration': rec.duration,
'update_lines': rec.update_lines,
'reasons': rec.reasons,
'meal': rec.meal,
'carry_forward_date': fields.Date.today(),
'carry_forward_state': 'completed',
'select_revoke': 'to_do'
}
self.env['vacation.meal.active'].create(meal_active_vals)
active_exists = self.env['vacation.meal.active'].search([
('line_id', '=', rec.id),
('employee_id', '=', emp_id),
('carry_forward_state', '=', 'completed')
], limit=1)
if not active_exists:
meal_active_vals = {
'line_id': rec.id,
'meal_name': rec.meal_name,
'employee_id': emp_id,
'workflow_id': rec.workflow_id.id if rec.workflow_id else False,
'start_time': rec.start_time,
'end_time': rec.end_time,
'duration': rec.duration,
'update_lines': rec.update_lines,
'reasons': rec.reasons,
'meal': rec.meal,
'carry_forward_date': fields.Date.today(),
'carry_forward_state': 'completed',
'select_revoke': 'to_do'
}
self.env['vacation.meal.active'].create(meal_active_vals)
summary_key = (emp_id, rec_year, rec_month)
if summary_key not in emp_month_summary:
@@ -1988,15 +1994,22 @@ class VacationMealLine(models.Model):
('vacation_date', '=', fields.Date.from_string(f'{rec_year}-{rec_month}-01'))
], limit=1)
if report_id:
self.env['vacation.meal.line'].create([{
'vacation_id': report_id.id,
'employee_id': emp_id,
'update_type': 'reduce',
'update_lines': total_amount,
'update_date': fields.Date.today(),
'is_void': False,
'text': f'{rec_month}月份误餐结转',
}])
over_exists = self.env['vacation.over.line'].search([
('vacation_id', '=', report_id.id),
('employee_id', '=', emp_id),
('update_type', '=', 'reduce'),
('text', '=', f'{rec_month}月份误餐结转'),
], limit=1)
if not over_exists:
self.env['vacation.meal.line'].create([{
'vacation_id': report_id.id,
'employee_id': emp_id,
'update_type': 'reduce',
'update_lines': total_amount,
'update_date': fields.Date.today(),
'is_void': False,
'text': f'{rec_month}月份误餐结转',
}])
@api.depends('workflow_record_id')
def _compute_overtime(self):
@@ -6,7 +6,7 @@
<field name="arch" type="xml">
<tree string="误餐记录" editable="bottom" js_class="custom_meal_active_export_button" create="false" delete="false" edit="false">
<header>
<button name="revoke" type="object" string="批量撤销" class="oe_highlight"/>
<button name="all_revoke" type="object" string="批量撤销" class="oe_highlight"/>
</header>
<field name="meal_name"/>
<field name="employee_id"/>
@@ -10,12 +10,12 @@ class ExportDateWizard(models.TransientModel):
_name = 'export.date.wizard'
_description = '导出日期选择向导'
year = fields.Integer(string='年份', required=True, default=lambda self: datetime.now().year)
year = fields.Integer(string='结转年份', required=True, default=lambda self: datetime.now().year)
month = fields.Selection([
('1', '1月'), ('2', '2月'), ('3', '3月'), ('4', '4月'),
('5', '5月'), ('6', '6月'), ('7', '7月'), ('8', '8月'),
('9', '9月'), ('10', '10月'), ('11', '11月'), ('12', '12月'),
], string='月份', required=True, default=lambda self: str(datetime.now().month))
], string='结转月份', required=True, default=lambda self: str(datetime.now().month))
export_type = fields.Char(string='导出类型')
model_name = fields.Char(string='模型名称')