diff --git a/yuthon_hr_attendance/models/yuthon_adjustments_approval.py b/yuthon_hr_attendance/models/yuthon_adjustments_approval.py index 34bbd0c2d..cd9ec5940 100644 --- a/yuthon_hr_attendance/models/yuthon_adjustments_approval.py +++ b/yuthon_hr_attendance/models/yuthon_adjustments_approval.py @@ -17,7 +17,7 @@ class YuthonAdjustmentsApproval(models.Model): is_issues = fields.Boolean(string='是否上会') related_issues_id = fields.Many2one('issue.library', string="关联议题") reason_application = fields.Html(string="申请事由") - replacement_time = fields.Datetime(string="值班时间") + replacement_data = fields.Date(string="值班时间") documents_ids = fields.Many2many('ir.attachment', string="附件") active = fields.Boolean('Active', default=True, tracking=True) diff --git a/yuthon_hr_attendance/models/yuthon_duty_arrangement.py b/yuthon_hr_attendance/models/yuthon_duty_arrangement.py index 5336f93dc..a114b0168 100644 --- a/yuthon_hr_attendance/models/yuthon_duty_arrangement.py +++ b/yuthon_hr_attendance/models/yuthon_duty_arrangement.py @@ -49,4 +49,19 @@ class YuthonDutyArrangement(models.Model): pass def bottom_adjustment(self): - pass + form_id = self.env.ref("yuthon_hr_attendance.view_yuthon_adjustments_approval_form").id + start_date = fields.Date.from_string(self.start_time) + if start_date.weekday() not in (5, 6): + raise UserError("只有在开始日期为周六或周日时才可以调休") + else: + use_id = self.employee_id.user_id.id + return { + 'type': 'ir.actions.act_window', + 'name': '调休申请', + 'res_model': 'yuthon.adjustments.approval', + "views": [[form_id, "form"]], + "context": { + 'default_users_id':use_id, + 'default_replacement_data':self.start_time + } + } diff --git a/yuthon_hr_attendance/views/yuthon_adjustments_approval_views.xml b/yuthon_hr_attendance/views/yuthon_adjustments_approval_views.xml index 7fd1f734d..d35fc84e4 100644 --- a/yuthon_hr_attendance/views/yuthon_adjustments_approval_views.xml +++ b/yuthon_hr_attendance/views/yuthon_adjustments_approval_views.xml @@ -26,7 +26,7 @@ - + diff --git a/yuthon_hr_attendance/wizard/__init__.py b/yuthon_hr_attendance/wizard/__init__.py index 6e146630b..beb9d2d47 100644 --- a/yuthon_hr_attendance/wizard/__init__.py +++ b/yuthon_hr_attendance/wizard/__init__.py @@ -1,3 +1,3 @@ from . import attendance_iot_manager_wizard - +from . import yuthon_duty_arrangement_wizard diff --git a/yuthon_hr_attendance/wizard/yuthon_duty_arrangement_wizard.py b/yuthon_hr_attendance/wizard/yuthon_duty_arrangement_wizard.py new file mode 100644 index 000000000..5b5dd1056 --- /dev/null +++ b/yuthon_hr_attendance/wizard/yuthon_duty_arrangement_wizard.py @@ -0,0 +1,9 @@ +from odoo import api, fields, models, tools +from odoo.exceptions import ValidationError + + +class YuthonDutyArrangementWizard(models.TransientModel): + _name = 'yuthon.duty.arrangement.wizard' + _description = '自动安排值班弹窗' + + diff --git a/yuthon_hr_attendance/wizard/yuthon_duty_arrangement_wizard_views.xml b/yuthon_hr_attendance/wizard/yuthon_duty_arrangement_wizard_views.xml new file mode 100644 index 000000000..e69de29bb