This commit is contained in:
李鹏宇
2026-04-08 14:47:07 +08:00
3 changed files with 27 additions and 2 deletions
@@ -192,7 +192,6 @@ class YuthonVacationReports(models.Model):
'duty_date': duty_date,
'is_adjustment': False
})
# 批量创建(效率更高)
if create_vals:
duty_schedule_env.create(create_vals)
record.duty_ids = duty_schedule_env.search([
@@ -201,7 +200,6 @@ class YuthonVacationReports(models.Model):
('duty_date', '<=', month_end)
])
@api.depends('duty_ids.is_adjustment')
def _compute_duty_fee(self):
for record in self:
@@ -1247,6 +1245,23 @@ class YuthonVacationReports(models.Model):
day = day.lstrip('0')
return f'{month}月{day}日'
@api.model
def put_vacation(self):
today = fields.Date.today()
first_day = today.replace(day=1)
last_month_first = first_day - relativedelta(months=1)
report_objs = self.env['yuthon.vacation.reports'].search([
('vacation_date', '=', last_month_first),
('vacation_state', '=', 'not_sent'),
])
for report in report_objs:
resource_user_ids = report.employee_id.resource_calendar_id.resource_user_ids.ids
if report.employee_id.id in resource_user_ids:
report.write({'vacation_state': 'confirmed'})
else:
report.button_put()
def att_button_put_task(self):
today = fields.Date.today()
first_day = today.replace(day=1)
@@ -22,6 +22,11 @@ export class CustomAttendanceVacationPutController extends ListController {
const res = await this.orm.call('yuthon.vacation.reports', 'meal_line', []);
this.actionService.doAction(res)
}
async getPutAction() {
const res = await this.orm.call('yuthon.vacation.reports', 'put_vacation', []);
this.actionService.doAction(res)
}
}
registry.category("views").add("custom_vacation_put_button", {
@@ -16,5 +16,10 @@
误餐情况
</button>
</xpath>
<xpath expr="//div[hasclass('o_list_buttons')]" position="after">
<button type="button" class="btn btn-primary" style="margin-left: 10px;" t-on-click="getPutAction">
一键发送
</button>
</xpath>
</t>
</templates>