diff --git a/yuthon_holiday/models/inherit_hr_leave_allocation.py b/yuthon_holiday/models/inherit_hr_leave_allocation.py index e09becbba..e877017d6 100644 --- a/yuthon_holiday/models/inherit_hr_leave_allocation.py +++ b/yuthon_holiday/models/inherit_hr_leave_allocation.py @@ -15,6 +15,7 @@ class HrLeaveAllocation(models.Model): holiday_month = fields.Selection(selection=[(str(i), str(i)) for i in range(1, 13)], string="入职月份", help='入职时长小于此月份时,不可申请此假期') holiday_expiration_date = fields.Selection([('never', '永久'), ('no_never', '不固定')], string="新员工请假") + remarks = fields.Text(string='备注', tracking=True) start_time = fields.Date(string="开始时间") end_time = fields.Date(string="结束时间") @@ -81,6 +82,10 @@ class HrLeaveAllocation(models.Model): self.linked_request_ids.filtered(lambda c: c.state != 'validate').action_validate() def button_fixes_wizard(self): + if self.type_request_unit == 'hour': + now_type = 'hours' + else: + now_type = 'days' return { "type": "ir.actions.act_window", "name": "修正申请", @@ -89,7 +94,8 @@ class HrLeaveAllocation(models.Model): 'target': 'new', "context": { 'default_users_id': self.employee_id.user_id.id, - 'default_duration_display': self.duration_display, + 'default_leave_id': self.id, + 'default_now_type': now_type, } } diff --git a/yuthon_holiday/models/yuthon_fixes_approval.py b/yuthon_holiday/models/yuthon_fixes_approval.py index f160934a4..cc32f4356 100644 --- a/yuthon_holiday/models/yuthon_fixes_approval.py +++ b/yuthon_holiday/models/yuthon_fixes_approval.py @@ -11,12 +11,36 @@ class YuthonFixesApproval(models.Model): name = fields.Char(string="标题") code = fields.Char(string="编号") users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) - original_days = fields.Char(string="原休假天数") - now_days = fields.Char(string="现休假天数") + original_days = fields.Float(string="原休假时长(天)") + original_hours = fields.Float(string="原休假时长(小时)") + now_type = fields.Selection([('days', '按天'), ('hours', '按小时')], string="修正类型") + now_days = fields.Float(string="现休假时长(天)") + now_hours = fields.Float(string="现休假时长(小时)") department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门") is_issues = fields.Boolean(string='是否上会') related_issues_id = fields.Many2one('issue.library', string="关联议题") reason_application = fields.Html(string="申请事由") documents_ids = fields.Many2many('ir.attachment', string="附件") + leave_id = fields.Many2one('hr.leave.allocation') active = fields.Boolean('Active', default=True, tracking=True) + remarks = fields.Text(string="备注") + + def bottom_allocation(self): + for record in self: + if record.now_type == 'days': + type_request_unit = 'day' + number_of_days = record.now_days + elif record.now_type == 'hours': + type_request_unit = 'hour' + number_of_days = record.now_days/8 + else: + type_request_unit = 'day' + number_of_days = record.now_days + + record.leave_id.write({ + 'remarks':record.remarks, + 'number_of_days': number_of_days, + 'type_request_unit':type_request_unit,}) + + diff --git a/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml b/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml index a11a693e7..a6e8c05ab 100644 --- a/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml +++ b/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml @@ -33,4 +33,16 @@ + + yuthon.holiday.allocation.form2 + hr.leave.allocation + + + + + + + + + \ No newline at end of file diff --git a/yuthon_holiday/views/yuthon_fixes_approval_views.xml b/yuthon_holiday/views/yuthon_fixes_approval_views.xml index 82f551c3d..fad0f1794 100644 --- a/yuthon_holiday/views/yuthon_fixes_approval_views.xml +++ b/yuthon_holiday/views/yuthon_fixes_approval_views.xml @@ -18,19 +18,21 @@
- +