@@ -23,7 +23,7 @@ class YuthonVacationReports(models.Model):
|
||||
vacation_date = fields.Date(string='日期', default=lambda self: fields.Date.today())
|
||||
|
||||
leave = fields.Char(string='年假', compute='_compute_leave', store=True, digits=(16, 3))
|
||||
working_overtime = fields.Char(string='加班时', compute='_compute_working_overtime', store=True)
|
||||
working_overtime = fields.Char(string='加班时', compute='_compute_working_overtime', store=True, digits=(16, 3))
|
||||
meal_fee = fields.Integer(string="误餐次数", compute='_compute_meal_fee', store=True)
|
||||
medical_fee = fields.Float(string="体检费", compute='_compute_medical_fee', store=True)
|
||||
compensatory_leave = fields.Integer(string="调休")
|
||||
@@ -42,6 +42,10 @@ class YuthonVacationReports(models.Model):
|
||||
hospital_sick_leave = fields.Float(string='病假(住院期)')
|
||||
recovery_sick_leave = fields.Float(string='病假(出院恢复期)')
|
||||
exam_leave = fields.Integer(string='考试假')
|
||||
right_days = fields.Float(string='转正天数')
|
||||
internship_days = fields.Float(string='实习天数')
|
||||
should_attendance = fields.Integer(string="应到")
|
||||
actual_attendance = fields.Integer(string="实到")
|
||||
|
||||
is_late_card = fields.Integer(string="迟到", compute='_compute_attendance_fields', store=True)
|
||||
is_early_card = fields.Integer(string="早退", compute='_compute_attendance_fields', store=True)
|
||||
@@ -153,11 +157,13 @@ class YuthonVacationReports(models.Model):
|
||||
today = fields.Date.today()
|
||||
employees = self.env['hr.employee'].search([])
|
||||
for employee in employees:
|
||||
resource_user_ids = employee.resource_calendar_id.resource_user_ids.ids
|
||||
is_resource_user = True if employee.id in resource_user_ids else False
|
||||
existing_record = self.search([
|
||||
('employee_id', '=', employee.id),
|
||||
('vacation_date', '=', today)
|
||||
], limit=1)
|
||||
if not existing_record:
|
||||
if not existing_record and not is_resource_user:
|
||||
self.create({
|
||||
'employee_id': employee.id,
|
||||
'vacation_date': today,
|
||||
@@ -179,7 +185,6 @@ class YuthonVacationReports(models.Model):
|
||||
self.create({
|
||||
'employee_id': employee.id,
|
||||
'vacation_date': report_date,
|
||||
# 计算字段会自动触发,无需手动设置
|
||||
})
|
||||
|
||||
def overtime_allocation(self):
|
||||
@@ -212,9 +217,8 @@ class YuthonVacationReports(models.Model):
|
||||
elif line.update_type == 'reduce':
|
||||
leave_hours -= line_value
|
||||
leave_days = leave_hours / 8
|
||||
record.leave = f"{leave_hours:.2f}小时({leave_days:.2f}天)"
|
||||
record.leave = f"{leave_days:.3f}"
|
||||
|
||||
# 2. 计算加班时(复用原有逻辑)
|
||||
overtime_hours = 0.0
|
||||
for line in record.overtime_ids:
|
||||
if not line.is_void:
|
||||
@@ -224,7 +228,7 @@ class YuthonVacationReports(models.Model):
|
||||
elif line.update_type == 'reduce':
|
||||
overtime_hours -= line_total
|
||||
overtime_days = overtime_hours / 8
|
||||
record.working_overtime = f"{overtime_hours:.2f}小时({overtime_days:.2f}天)"
|
||||
record.working_overtime = f"{overtime_days:.3f}"
|
||||
|
||||
def vacation_delete(self):
|
||||
vacation_ids = self.env["yuthon.vacation.reports"].browse(
|
||||
@@ -264,7 +268,7 @@ class YuthonVacationReports(models.Model):
|
||||
leave_hours -= line_value
|
||||
|
||||
leave_days = leave_hours / 8
|
||||
record.leave = f"{leave_hours:.2f}小时({leave_days:.2f}天)"
|
||||
record.leave = f"{leave_days:.2f}"
|
||||
|
||||
@api.depends(
|
||||
'overtime_ids.workday',
|
||||
@@ -284,7 +288,7 @@ class YuthonVacationReports(models.Model):
|
||||
elif line.update_type == 'reduce':
|
||||
overtime_hours -= line_total
|
||||
overtime_days = overtime_hours / 8
|
||||
record.working_overtime = f"{overtime_hours:.2f}小时({overtime_days:.2f}天)"
|
||||
record.working_overtime = f"{overtime_days:.2f}"
|
||||
|
||||
@api.depends('meal_fee_ids.update_lines', 'meal_fee_ids.update_type', 'meal_fee_ids.is_void')
|
||||
def _compute_meal_fee(self):
|
||||
|
||||
@@ -9,30 +9,35 @@
|
||||
<field name="department_id" column_invisible="1"/>
|
||||
<field name="company_id" column_invisible="1"/>
|
||||
<field name="vacation_date" column_invisible="1"/>
|
||||
<field name="is_late_card"/>
|
||||
<field name="is_early_card"/>
|
||||
<field name="is_no_card"/>
|
||||
<field name="is_work"/>
|
||||
<field name="leave"/>
|
||||
<field name="working_overtime"/>
|
||||
<field name="meal_fee"/>
|
||||
<field name="medical_fee"/>
|
||||
<field name="compensatory_leave"/>
|
||||
<field name="leave_of_absence"/>
|
||||
<field name="statutory_leave"/>
|
||||
<field name="cop_leave"/>
|
||||
<field name="duty_off_leave"/>
|
||||
<field name="marriage_leave"/>
|
||||
<field name="maternity_leave"/>
|
||||
<field name="paternity_leave"/>
|
||||
<field name="family_planning_leave"/>
|
||||
<field name="bereavement_leave"/>
|
||||
<field name="home_visit_leave"/>
|
||||
<field name="parents_meeting_leave"/>
|
||||
<field name="general_sick_leave"/>
|
||||
<field name="hospital_sick_leave"/>
|
||||
<field name="recovery_sick_leave"/>
|
||||
<field name="exam_leave"/>
|
||||
<field name="is_late_card" decoration-muted="is_late_card == 0"/>
|
||||
<field name="is_early_card" decoration-muted="is_early_card == 0"/>
|
||||
<field name="is_no_card" decoration-muted="is_no_card == 0"/>
|
||||
<field name="is_work" decoration-muted="is_work == 0"/>
|
||||
<field name="is_abnormal" decoration-muted="not is_abnormal"/>
|
||||
<field name="should_attendance" decoration-muted="should_attendance == 0"/>
|
||||
<field name="actual_attendance" decoration-muted="actual_attendance == 0"/>
|
||||
<field name="right_days" decoration-muted="right_days == 0"/>
|
||||
<field name="internship_days" decoration-muted="internship_days == 0"/>
|
||||
<field name="leave" decoration-muted="leave == 0"/>
|
||||
<field name="working_overtime" decoration-muted="working_overtime == 0"/>
|
||||
<field name="meal_fee" decoration-muted="meal_fee == 0"/>
|
||||
<field name="medical_fee" decoration-muted="medical_fee == 0"/>
|
||||
<field name="compensatory_leave" decoration-muted="compensatory_leave == 0"/>
|
||||
<field name="leave_of_absence" decoration-muted="leave_of_absence == 0"/>
|
||||
<field name="statutory_leave" decoration-muted="statutory_leave == 0"/>
|
||||
<field name="cop_leave" decoration-muted="cop_leave == 0"/>
|
||||
<field name="duty_off_leave" decoration-muted="duty_off_leave == 0"/>
|
||||
<field name="marriage_leave" decoration-muted="marriage_leave == 0"/>
|
||||
<field name="maternity_leave" decoration-muted="maternity_leave == 0"/>
|
||||
<field name="paternity_leave" decoration-muted="paternity_leave == 0"/>
|
||||
<field name="family_planning_leave" decoration-muted="family_planning_leave == 0"/>
|
||||
<field name="bereavement_leave" decoration-muted="bereavement_leave == 0"/>
|
||||
<field name="home_visit_leave" decoration-muted="home_visit_leave == 0"/>
|
||||
<field name="parents_meeting_leave" decoration-muted="parents_meeting_leave == 0"/>
|
||||
<field name="general_sick_leave" decoration-muted="general_sick_leave == 0"/>
|
||||
<field name="hospital_sick_leave" decoration-muted="hospital_sick_leave == 0"/>
|
||||
<field name="recovery_sick_leave" decoration-muted="recovery_sick_leave == 0"/>
|
||||
<field name="exam_leave" decoration-muted="exam_leave == 0"/>
|
||||
<field name="vacation_state" widget="badge" decoration-info="vacation_state == 'unconfirmed'"
|
||||
decoration-success="vacation_state == 'confirmed'"/>
|
||||
<button name="log" type="object" string="详情" class="oe_highlight"/>
|
||||
@@ -49,34 +54,38 @@
|
||||
<field name="department_id" column_invisible="1"/>
|
||||
<field name="company_id" column_invisible="1"/>
|
||||
<field name="vacation_date" column_invisible="1"/>
|
||||
<field name="is_late_card"/>
|
||||
<field name="is_early_card"/>
|
||||
<field name="is_no_card"/>
|
||||
<field name="is_work"/>
|
||||
<field name="leave"/>
|
||||
<field name="working_overtime"/>
|
||||
<field name="meal_fee"/>
|
||||
<field name="medical_fee"/>
|
||||
<field name="compensatory_leave"/>
|
||||
<field name="leave_of_absence"/>
|
||||
<field name="statutory_leave"/>
|
||||
<field name="cop_leave"/>
|
||||
<field name="duty_off_leave"/>
|
||||
<field name="marriage_leave"/>
|
||||
<field name="maternity_leave"/>
|
||||
<field name="paternity_leave"/>
|
||||
<field name="family_planning_leave"/>
|
||||
<field name="bereavement_leave"/>
|
||||
<field name="home_visit_leave"/>
|
||||
<field name="parents_meeting_leave"/>
|
||||
<field name="general_sick_leave"/>
|
||||
<field name="hospital_sick_leave"/>
|
||||
<field name="recovery_sick_leave"/>
|
||||
<field name="exam_leave"/>
|
||||
<field name="is_late_card" decoration-muted="is_late_card == 0"/>
|
||||
<field name="is_early_card" decoration-muted="is_early_card == 0"/>
|
||||
<field name="is_no_card" decoration-muted="is_no_card == 0"/>
|
||||
<field name="is_work" decoration-muted="is_work == 0"/>
|
||||
<field name="is_abnormal" decoration-muted="not is_abnormal"/>
|
||||
<field name="should_attendance" decoration-muted="should_attendance == 0"/>
|
||||
<field name="actual_attendance" decoration-muted="actual_attendance == 0"/>
|
||||
<field name="right_days" decoration-muted="right_days == 0"/>
|
||||
<field name="internship_days" decoration-muted="internship_days == 0"/>
|
||||
<field name="leave" decoration-muted="leave == 0"/>
|
||||
<field name="working_overtime" decoration-muted="working_overtime == 0"/>
|
||||
<field name="meal_fee" decoration-muted="meal_fee == 0"/>
|
||||
<field name="medical_fee" decoration-muted="medical_fee == 0"/>
|
||||
<field name="compensatory_leave" decoration-muted="compensatory_leave == 0"/>
|
||||
<field name="leave_of_absence" decoration-muted="leave_of_absence == 0"/>
|
||||
<field name="statutory_leave" decoration-muted="statutory_leave == 0"/>
|
||||
<field name="cop_leave" decoration-muted="cop_leave == 0"/>
|
||||
<field name="duty_off_leave" decoration-muted="duty_off_leave == 0"/>
|
||||
<field name="marriage_leave" decoration-muted="marriage_leave == 0"/>
|
||||
<field name="maternity_leave" decoration-muted="maternity_leave == 0"/>
|
||||
<field name="paternity_leave" decoration-muted="paternity_leave == 0"/>
|
||||
<field name="family_planning_leave" decoration-muted="family_planning_leave == 0"/>
|
||||
<field name="bereavement_leave" decoration-muted="bereavement_leave == 0"/>
|
||||
<field name="home_visit_leave" decoration-muted="home_visit_leave == 0"/>
|
||||
<field name="parents_meeting_leave" decoration-muted="parents_meeting_leave == 0"/>
|
||||
<field name="general_sick_leave" decoration-muted="general_sick_leave == 0"/>
|
||||
<field name="hospital_sick_leave" decoration-muted="hospital_sick_leave == 0"/>
|
||||
<field name="recovery_sick_leave" decoration-muted="recovery_sick_leave == 0"/>
|
||||
<field name="exam_leave" decoration-muted="exam_leave == 0"/>
|
||||
<field name="vacation_state" widget="badge" decoration-info="vacation_state == 'unconfirmed'"
|
||||
decoration-success="vacation_state == 'confirmed'"/>
|
||||
<button name="log" type="object" string="详情" class="oe_highlight"/>
|
||||
<button name="button_put" string="发送" type="object" class="oe_highlight"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -197,6 +206,11 @@
|
||||
<field name="is_early_card"/>
|
||||
<field name="is_no_card"/>
|
||||
<field name="is_work"/>
|
||||
<field name="is_abnormal"/>
|
||||
<field name="should_attendance"/>
|
||||
<field name="actual_attendance"/>
|
||||
<field name="right_days"/>
|
||||
<field name="internship_days"/>
|
||||
<field name="compensatory_leave"/>
|
||||
<field name="leave_of_absence"/>
|
||||
<field name="statutory_leave"/>
|
||||
@@ -339,6 +353,15 @@
|
||||
<field name="is_early_card"/>
|
||||
<field name="is_no_card"/>
|
||||
<field name="is_work"/>
|
||||
<field name="is_abnormal"/>
|
||||
<field name="should_attendance"/>
|
||||
<field name="actual_attendance"/>
|
||||
<field name="right_days"/>
|
||||
<field name="internship_days"/>
|
||||
<field name="should_attendance"/>
|
||||
<field name="actual_attendance"/>
|
||||
<field name="right_days"/>
|
||||
<field name="internship_days"/>
|
||||
<field name="compensatory_leave"/>
|
||||
<field name="leave_of_absence"/>
|
||||
<field name="statutory_leave"/>
|
||||
@@ -414,7 +437,7 @@
|
||||
<field name="model_id" ref="yuthon_hr_attendance.model_yuthon_vacation_reports"/>
|
||||
<field name="binding_model_id" ref="yuthon_hr_attendance.model_yuthon_vacation_reports"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.disposable_report()</field>
|
||||
<field name="code">action = model.batch_compute_leave_and_overtime()</field>
|
||||
</record>
|
||||
<record id="details_tree_view" model="ir.ui.view">
|
||||
<field name="name">details.tree.tree</field>
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -4,9 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/yuthon_maintain/static/h5/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>设备管理</title>
|
||||
<script type="module" crossorigin src="/yuthon_maintain/static/h5/assets/index-BClTJUrb.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/yuthon_maintain/static/h5/assets/index-DlBQ2vfe.css">
|
||||
<title>设备维护管理</title>
|
||||
<script type="module" crossorigin src="/yuthon_maintain/static/h5/assets/index-C2CWF1Od.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/yuthon_maintain/static/h5/assets/index-GMOHt_RF.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -144,11 +144,11 @@
|
||||
<!-- parent="hr_attendance_root_board_menu"-->
|
||||
<!-- sequence="7"-->
|
||||
<!-- action="yuthon_hr_attendance.hr_attendance_month_action"/>-->
|
||||
<menuitem id="menu_hr_attendance_month_detail_view_attendances"
|
||||
name="考勤确认单"
|
||||
parent="hr_attendance_root_board_menu"
|
||||
sequence="10"
|
||||
action="yuthon_hr_attendance.hr_attendance_month_detail_action"/>
|
||||
<!-- <menuitem id="menu_hr_attendance_month_detail_view_attendances"-->
|
||||
<!-- name="考勤确认单"-->
|
||||
<!-- parent="hr_attendance_root_board_menu"-->
|
||||
<!-- sequence="10"-->
|
||||
<!-- action="yuthon_hr_attendance.hr_attendance_month_detail_action"/>-->
|
||||
<!-- <menuitem id="holiday_overview_menu_board"-->
|
||||
<!-- name="假期管理"-->
|
||||
<!-- parent="hr_attendance_root_board_menu"-->
|
||||
|
||||
Reference in New Issue
Block a user