42 lines
1.7 KiB
Python
42 lines
1.7 KiB
Python
# -*- coding: utf-8 -*
|
|
from odoo import models, fields, api
|
|
|
|
|
|
class YuthonFixesWizard(models.TransientModel):
|
|
_name = 'yuthon.fixes.wizard'
|
|
_description = '修正按钮弹窗'
|
|
|
|
now_days = fields.Float(string="修正时长(天)")
|
|
now_hours = fields.Float(string="修正时长(小时)")
|
|
original_days = fields.Float(string="原休假时长(天)")
|
|
original_hours = fields.Float(string="原休假时长(小时)")
|
|
now_type = fields.Selection([('days', '按天'), ('hours', '按小时')], string="修正类型")
|
|
users_id = fields.Many2one('res.users')
|
|
duration_display = fields.Char(string='假期余额')
|
|
leave_id = fields.Many2one('hr.leave.allocation')
|
|
remarks = fields.Text(string='备注')
|
|
|
|
def confirm(self):
|
|
form_id = self.env.ref('yuthon_holiday.view_yuthon_fixes_approval_form').id
|
|
return {
|
|
"type": "ir.actions.act_window",
|
|
"name": "修正申请",
|
|
"res_model": "yuthon.fixes.approval",
|
|
"views": [[form_id, "form"]],
|
|
"context": {
|
|
'default_now_type': self.now_type,
|
|
'default_users_id': self.users_id.id,
|
|
'default_now_days': self.now_days if self.now_type == 'days' else 0,
|
|
'default_now_hours': self.now_hours if self.now_type == 'hours' else 0,
|
|
'default_leave_id': self.leave_id.id,
|
|
'default_original_days': self.leave_id.number_of_days_display if self.now_type == 'days' else 0,
|
|
'default_original_hours': self.leave_id.number_of_days_display if self.now_type == 'hours' else 0,
|
|
'default_remarks': self.remarks,
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|