@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,})
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -33,4 +33,16 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_holiday_allocation_form2" model="ir.ui.view">
|
||||
<field name="name">yuthon.holiday.allocation.form2</field>
|
||||
<field name="model">hr.leave.allocation</field>
|
||||
<field name="inherit_id" ref="hr_holidays.hr_leave_allocation_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='duration_display']" position="after">
|
||||
<group>
|
||||
<field name="remarks"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -18,19 +18,21 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="假期修正审批">
|
||||
<sheet>
|
||||
<group string="个人信息" col="3">
|
||||
<button name="bottom_allocation" string="修正申请" type="object"/>
|
||||
<group string="个人信息" col="2">
|
||||
<group>
|
||||
<field name="users_id"/>
|
||||
<field name="is_issues"/>
|
||||
<field name="is_issues" invisible="1"/>
|
||||
<field name="related_issues_id" invisible="not is_issues"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="yuthon_company"/>
|
||||
<field name="department_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="original_days"/>
|
||||
<field name="now_days"/>
|
||||
<field name="remarks" invisible="1"/>
|
||||
<field name="yuthon_company" invisible="1"/>
|
||||
<field name="department_id" invisible="1"/>
|
||||
<field name="now_type" invisible="1"/>
|
||||
<field name="leave_id" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="审批事项">
|
||||
|
||||
@@ -6,16 +6,17 @@ class YuthonFixesWizard(models.TransientModel):
|
||||
_name = 'yuthon.fixes.wizard'
|
||||
_description = '修正按钮弹窗'
|
||||
|
||||
remediate_days = fields.Char(string='修正天数')
|
||||
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):
|
||||
for record in self:
|
||||
partner_ids = record.users_id.partner_id.ids
|
||||
record.with_context(lang=record.env.lang)._message_auto_subscribe_notify(partner_ids,
|
||||
f'{record.remarks},{record.remediate_days}天')
|
||||
form_id = self.env.ref('yuthon_holiday.view_yuthon_fixes_approval_form').id
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
@@ -23,9 +24,14 @@ class YuthonFixesWizard(models.TransientModel):
|
||||
"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.remediate_days,
|
||||
'default_original_days': self.duration_display
|
||||
'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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
<form string="修正">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="now_type" invisible="1"/>
|
||||
<field name="now_days" invisible="now_type != 'days'"/>
|
||||
<field name="now_hours" invisible="now_type != 'hours'"/>
|
||||
<field name="users_id" invisible="1"/>
|
||||
<field name="duration_display" invisible="1"/>
|
||||
<field name="remediate_days"/>
|
||||
<field name="original_days" invisible="1"/>
|
||||
<field name="original_hours" invisible="1"/>
|
||||
<field name="remarks" required="1"/>
|
||||
</group>
|
||||
</sheet>
|
||||
|
||||
Reference in New Issue
Block a user