@@ -375,6 +375,30 @@ class HolidaysRequestBatch(models.Model):
|
||||
def action_submit(self):
|
||||
self.leave_ids.action_validate()
|
||||
self.hour_leave_ids.action_validate()
|
||||
days = 0
|
||||
leave_list = []
|
||||
reports_id = self.env['yuthon.vacation.reports'].search([
|
||||
('employee_id', '=', self.users_id.employee_id.id),
|
||||
])
|
||||
workflow_record_id = self.env['soong.workflow.record'].search([
|
||||
('code', '=', self.code)
|
||||
])
|
||||
for line in self.hour_leave_ids:
|
||||
if line.holiday_status_id.name == '年假':
|
||||
match = re.search(r'(\d+(?:\.\d+)?)', line.number_of_hours_text or '')
|
||||
days += float(match.group(1)) / 8 if match else 0
|
||||
for leave in self.leave_ids:
|
||||
if leave.holiday_status_id.name == '年假':
|
||||
days += leave.number_of_days
|
||||
leave_list.append((0, 0, {
|
||||
'vacation_id': reports_id.id,
|
||||
'update_type': 'reduce',
|
||||
'workflow_record_id':workflow_record_id.id,
|
||||
'update_date': fields.Datetime.now(),
|
||||
'update_lines': days,
|
||||
'text': '审批'
|
||||
}))
|
||||
reports_id.write({'leave_ids': leave_list})
|
||||
|
||||
@api.constrains('is_day', 'is_hour', 'leave_ids', 'hour_leave_ids')
|
||||
def _check_leave_type_and_details(self):
|
||||
|
||||
@@ -85,9 +85,11 @@ class VacationLeaveLine(models.Model):
|
||||
_description = '年假明细'
|
||||
|
||||
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期报表')
|
||||
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
|
||||
update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
|
||||
update_date = fields.Date(string='更新时间')
|
||||
update_lines = fields.Text(string='更新额度')
|
||||
text = fields.Text(string='备注')
|
||||
|
||||
|
||||
class VacationOverline(models.Model):
|
||||
@@ -95,18 +97,19 @@ class VacationOverline(models.Model):
|
||||
_description = '加班明细'
|
||||
|
||||
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期报表')
|
||||
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
|
||||
update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
|
||||
update_date = fields.Date(string='更新时间')
|
||||
update_lines = fields.Text(string='更新额度')
|
||||
text = fields.Text(string='备注')
|
||||
|
||||
|
||||
|
||||
class VacationMealLine(models.Model):
|
||||
_name = 'vacation.meal.line'
|
||||
_description = '误餐明细'
|
||||
|
||||
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期报表')
|
||||
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
|
||||
update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
|
||||
update_date = fields.Date(string='更新时间')
|
||||
update_lines = fields.Text(string='更新额度')
|
||||
|
||||
@@ -27,9 +27,11 @@
|
||||
<field name="leave_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="vacation_id" column_invisible="1"/>
|
||||
<field name="workflow_record_id"/>
|
||||
<field name="update_type"/>
|
||||
<field name="update_date"/>
|
||||
<field name="update_lines"/>
|
||||
<field name="text"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
@@ -37,6 +39,7 @@
|
||||
<field name="overtime_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="vacation_id" column_invisible="1"/>
|
||||
<field name="workflow_record_id"/>
|
||||
<field name="update_type"/>
|
||||
<field name="update_date"/>
|
||||
<field name="update_lines"/>
|
||||
@@ -48,6 +51,7 @@
|
||||
<field name="meal_fee_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="vacation_id" column_invisible="1"/>
|
||||
<field name="workflow_record_id"/>
|
||||
<field name="update_type"/>
|
||||
<field name="update_date"/>
|
||||
<field name="update_lines"/>
|
||||
|
||||
@@ -134,6 +134,28 @@ class GoApprovals(models.Model):
|
||||
# 计算结束时间
|
||||
self.date_end = self.date_start + delta
|
||||
|
||||
def end_approval(self):
|
||||
if self.meal:
|
||||
self.users_id.employee_id.meal_number += 1
|
||||
# 创建日志
|
||||
go_approval_list = []
|
||||
reports_id = self.env['yuthon.vacation.reports'].search([
|
||||
('employee_id', '=', self.users_id.employee_id.id),
|
||||
])
|
||||
workflow_record_id = self.env['soong.workflow.record'].search([
|
||||
('code', '=', self.code)
|
||||
])
|
||||
go_approval_list.append((0, 0, {
|
||||
'vacation_id': reports_id.id,
|
||||
'update_type': 'add',
|
||||
'workflow_record_id': workflow_record_id.id,
|
||||
'update_date': fields.Datetime.now(),
|
||||
'update_lines': 1 ,
|
||||
'text': '审批'
|
||||
}))
|
||||
reports_id.write({'meal_fee_ids': go_approval_list})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -179,6 +179,23 @@ class OvertimeApprovals(models.Model):
|
||||
})
|
||||
if allocation:
|
||||
allocation.sudo().action_validate()
|
||||
# 创建日志
|
||||
overtime_list = []
|
||||
reports_id = self.env['yuthon.vacation.reports'].search([
|
||||
('employee_id', '=', self.users_id.employee_id.id),
|
||||
])
|
||||
workflow_record_id = self.env['soong.workflow.record'].search([
|
||||
('code', '=', self.code)
|
||||
])
|
||||
overtime_list.append((0, 0, {
|
||||
'vacation_id': reports_id.id,
|
||||
'update_type': 'reduce',
|
||||
'workflow_record_id': workflow_record_id.id,
|
||||
'update_date': fields.Datetime.now(),
|
||||
'update_lines': self.duration,
|
||||
'text': '审批'
|
||||
}))
|
||||
reports_id.write({'overtime_ids': overtime_list})
|
||||
|
||||
@api.depends('users_id', 'duration')
|
||||
def _compute_name(self):
|
||||
|
||||
@@ -205,7 +205,7 @@ class YuthonHrEmployee(models.Model):
|
||||
# 获取部门名称
|
||||
department_name = record.department_id.name if record.department_id else ''
|
||||
# 1. 财务部会计、出纳每月有100元补贴
|
||||
if '会计岗' in (primary_role_name, *secondary_role_names) or '出纳' in (
|
||||
if '会计' in (primary_role_name, *secondary_role_names) or '出纳' in (
|
||||
primary_role_name, *secondary_role_names):
|
||||
amount += 100
|
||||
# 2. 司机分别有600元补贴(仅司机)
|
||||
|
||||
Reference in New Issue
Block a user