diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index b49e4aac2..23b81938c 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -189,19 +189,25 @@ class YuthonVacationReports(models.Model): @api.model def meal_line(self): today = date.today() - start_date = date(today.year, today.month, 1) - next_month = today.month + 1 if today.month < 12 else 1 + next_month = today.month if today.month < 12 else 1 next_year = today.year if today.month < 12 else today.year + 1 end_date = date(next_year, next_month, 1) - timedelta(days=1) + active_records = self.env['vacation.meal.active'].search([('select_revoke', '=', 'to_do')]) + line_ids = [rec.line_id.id for rec in active_records if rec.line_id] return { 'type': 'ir.actions.act_window', 'name': '误餐情况', "views": [(False, "tree")], 'res_model': 'vacation.meal.line', 'domain': [ - ('vacation_date', '>=', start_date), + ('meal', '=', 'yes'), + ('vacation_id', '!=', False), + ('workflow_id', '!=', False), + ('id', 'not in', line_ids), + ('update_type', '>=', 'add'), ('vacation_date', '<=', end_date), - ('company_id', 'in', self.env.companies.ids) + ('company_id', 'in', self.env.companies.ids), + ('text', '!=', '上月额度继承') ], 'target': 'current', 'context': {'tree_view_ref': "yuthon_hr_attendance.view_vacation_meal_line_tree"} @@ -1302,6 +1308,7 @@ 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,