diff --git a/soong_workflow/views/soong_user_role_views.xml b/soong_workflow/views/soong_user_role_views.xml index 40e871ebe..3acc48e71 100644 --- a/soong_workflow/views/soong_user_role_views.xml +++ b/soong_workflow/views/soong_user_role_views.xml @@ -4,7 +4,7 @@ soong.user.role.tree soong.user.role - + diff --git a/yuthon_holiday/__manifest__.py b/yuthon_holiday/__manifest__.py index 6a6a9b8f3..1c1d9e763 100644 --- a/yuthon_holiday/__manifest__.py +++ b/yuthon_holiday/__manifest__.py @@ -9,11 +9,9 @@ 'security/ir.model.access.csv', 'security/yuthon_holiday_group.xml', 'data/yuthon_holiday_data.xml', - 'data/mothly_report_time.xml', 'views/inherit_hr_type_views.xml', 'views/inherit_hr_leave_allocation_views.xml', 'views/inherit_hr_leave_accrual_plan_views.xml', - 'views/yuthon_vacation_reports_views.xml', 'views/hr_leave_accrual_views.xml', 'views/yuthon_fixes_approval_views.xml', 'views/hr_leave_batch.xml', diff --git a/yuthon_holiday/models/__init__.py b/yuthon_holiday/models/__init__.py index 0164de29d..b45a80492 100644 --- a/yuthon_holiday/models/__init__.py +++ b/yuthon_holiday/models/__init__.py @@ -3,5 +3,4 @@ from . import inherit_hr_leave_type from . import inherit_hr_leave from . import inherit_hr_leave_accrual_plan from . import yuthon_fixes_approval -from . import yuthon_holiday_setting -from . import yuthon_vacation_reports \ No newline at end of file +from . import yuthon_holiday_setting \ No newline at end of file diff --git a/yuthon_holiday/security/ir.model.access.csv b/yuthon_holiday/security/ir.model.access.csv index 583d690e2..0b7747768 100644 --- a/yuthon_holiday/security/ir.model.access.csv +++ b/yuthon_holiday/security/ir.model.access.csv @@ -6,10 +6,3 @@ access_yuthon_fixes_wizard,yuthon_fixes_wizard,model_yuthon_fixes_wizard,base.gr access_yuthon_holiday_setting,yuthon_holiday_setting,model_yuthon_holiday_setting,base.group_user,1,1,1,1 access_leave_allocation_wizard,leave_allocation_wizard,model_leave_allocation_wizard,base.group_user,1,1,1,1 access_yuthon_leave_wizard,yuthon_leave_wizard,model_yuthon_leave_wizard,base.group_user,1,1,1,1 -access_yuthon_vacation_reports,yuthon_vacation_reports,model_yuthon_vacation_reports,base.group_user,1,1,1,1 -access_vacation_leave_line,vacation_leave_line,model_vacation_leave_line,base.group_user,1,1,1,1 -access_vacation_meal_line,vacation_meal_line,model_vacation_meal_line,base.group_user,1,1,1,1 -access_vacation_over_line,vacation_over_line,model_vacation_over_line,base.group_user,1,1,1,1 -access_details_tree, details_tree,model_details_tree,base.group_user,1,1,1,1 -access_vacation_medical_line,vacation_medical_line,model_vacation_medical_line,base.group_user,1,1,1,1 -access_vacation_other_line,vacation_other_line,model_vacation_other_line,base.group_user,1,1,1,1 diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py index e425d747b..75a573742 100644 --- a/yuthon_hr_attendance/__manifest__.py +++ b/yuthon_hr_attendance/__manifest__.py @@ -18,6 +18,7 @@ 'security/ir.model.access.csv', 'security/planning_group.xml', 'data/hr_attendance_time.xml', + 'data/mothly_report_time.xml', 'data/attendance_code_data.xml', 'data/attendance_time_data.xml', 'data/attendance_month_date.xml', @@ -31,6 +32,7 @@ 'views/yuthon_customer_approval_views.xml', 'views/yuthon_shift_planning_views.xml', 'views/yuthon_run_planning_views.xml', + 'views/yuthon_vacation_reports_views.xml', 'views/hr_attendance_wechat_views.xml', 'views/hr_attendance_detail_wechat_views.xml', 'views/overtime_approval.xml', diff --git a/yuthon_holiday/data/mothly_report_time.xml b/yuthon_hr_attendance/data/mothly_report_time.xml similarity index 100% rename from yuthon_holiday/data/mothly_report_time.xml rename to yuthon_hr_attendance/data/mothly_report_time.xml diff --git a/yuthon_hr_attendance/models/__init__.py b/yuthon_hr_attendance/models/__init__.py index 2f34dff75..2d2cbfa36 100644 --- a/yuthon_hr_attendance/models/__init__.py +++ b/yuthon_hr_attendance/models/__init__.py @@ -8,6 +8,7 @@ from . import remove_holiday_approval from . import card_approval from . import planning_template_inherit from . import overtime_page +from . import yuthon_vacation_reports from . import inherit_planning_role from . import yuthon_shift_planning from . import yuthon_run_planning diff --git a/yuthon_holiday/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py similarity index 91% rename from yuthon_holiday/models/yuthon_vacation_reports.py rename to yuthon_hr_attendance/models/yuthon_vacation_reports.py index 9b814fff6..31323f057 100644 --- a/yuthon_holiday/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -2,6 +2,8 @@ from datetime import datetime, timedelta, time from email.policy import default from odoo import models, fields, api, _ from odoo.exceptions import ValidationError +import calendar +from datetime import date class YuthonVacationReports(models.Model): @@ -41,10 +43,12 @@ class YuthonVacationReports(models.Model): recovery_sick_leave = fields.Float(string='病假(出院恢复期)') exam_leave = fields.Integer(string='考试假') - come_late = fields.Integer(string="迟到") - is_early_card = fields.Integer(string="早退") - is_no_card = fields.Integer(string="缺卡") - is_work = 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) + is_no_card = fields.Integer(string="缺卡", compute='_compute_attendance_fields', store=True) + is_work = fields.Integer(string='旷工', compute='_compute_attendance_fields', store=True) + is_abnormal = fields.Boolean(string="异常", compute='_compute_attendance_fields', store=True) + vacation_state = fields.Selection( selection=[ ('unconfirmed', "未确认"), @@ -56,6 +60,43 @@ class YuthonVacationReports(models.Model): tracking=3, default='unconfirmed') + @api.depends('employee_id', 'vacation_date') + def _compute_attendance_fields(self): + for rec in self: + # 初始化字段值 + is_late = 0 + is_early = 0 + is_no = 0 + is_work = 0 + is_abnormal = False + if rec.employee_id and rec.vacation_date: + year = rec.vacation_date.year + month = rec.vacation_date.month + days_in_month = calendar.monthrange(year, month)[1] + for day in range(1, days_in_month + 1): + current_date = date(year, month, day) + attendances = self.env["hr.attendance"].sudo().search([ + ('employee_id', '=', rec.employee_id.id), + ("current_data", '=', current_date) + ]) + for att in attendances: + if att.is_late_card: + is_late += 1 + if att.is_early_card: + is_early += 1 + if att.is_no_card: + is_no += 1 + if att.absenteeism_card: + is_work += 1 + if att.is_abnormal: + is_abnormal = True + + rec.is_late_card = is_late + rec.is_early_card = is_early + rec.is_no_card = is_no + rec.is_work = is_work + rec.is_abnormal = is_abnormal + def button_put(self): menu_id = self.env['ir.ui.menu'].search([('name', '=', '考勤确认'), ('parent_id', '!=', False)]) url = f'https://oa.thtzjt.com/web#id={self.id}&cids=2&action={menu_id.action.id}&model=hr.attendance.month.detail&view_type=list&menu_id={menu_id.id}' diff --git a/yuthon_hr_attendance/security/ir.model.access.csv b/yuthon_hr_attendance/security/ir.model.access.csv index ed36d674e..b442ac26d 100644 --- a/yuthon_hr_attendance/security/ir.model.access.csv +++ b/yuthon_hr_attendance/security/ir.model.access.csv @@ -8,6 +8,13 @@ access_overtime_page,overtime.page,model_overtime_page,base.group_user,1,1,1,1 access_duty_approval,duty.approval,model_duty_approval,base.group_user,1,1,1,1 access_duty_approval_line,duty.approval.line,model_duty_approval_line,base.group_user,1,1,1,1 access_mac_line, mac.line,model_mac_line,base.group_user,1,1,1,1 +access_yuthon_vacation_reports,yuthon_vacation_reports,model_yuthon_vacation_reports,base.group_user,1,1,1,1 +access_vacation_leave_line,vacation_leave_line,model_vacation_leave_line,base.group_user,1,1,1,1 +access_vacation_meal_line,vacation_meal_line,model_vacation_meal_line,base.group_user,1,1,1,1 +access_vacation_over_line,vacation_over_line,model_vacation_over_line,base.group_user,1,1,1,1 +access_details_tree, details_tree,model_details_tree,base.group_user,1,1,1,1 +access_vacation_medical_line,vacation_medical_line,model_vacation_medical_line,base.group_user,1,1,1,1 +access_vacation_other_line,vacation_other_line,model_vacation_other_line,base.group_user,1,1,1,1 access_yuthon_shift_planning,yuthon.shift.planning,model_yuthon_shift_planning,base.group_user,1,1,1,1 diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml index 9cb4f42be..390adeac8 100644 --- a/yuthon_hr_attendance/views/hr_attendance_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_views.xml @@ -7,7 +7,7 @@ + editable="bottom">
@@ -51,7 +51,7 @@ + editable="bottom" default_order="current_data desc"> diff --git a/yuthon_holiday/views/yuthon_vacation_reports_views.xml b/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml similarity index 97% rename from yuthon_holiday/views/yuthon_vacation_reports_views.xml rename to yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml index 0a8dc1925..76e8a22fc 100644 --- a/yuthon_holiday/views/yuthon_vacation_reports_views.xml +++ b/yuthon_hr_attendance/views/yuthon_vacation_reports_views.xml @@ -6,10 +6,10 @@ - - - - + + + + @@ -46,10 +46,10 @@ - - - - + + + + @@ -193,7 +193,7 @@ - + @@ -334,7 +334,7 @@ - + diff --git a/yuthon_property/views/property_accounting_unit_views.xml b/yuthon_property/views/property_accounting_unit_views.xml index a347dd820..6f8f68303 100644 --- a/yuthon_property/views/property_accounting_unit_views.xml +++ b/yuthon_property/views/property_accounting_unit_views.xml @@ -4,7 +4,7 @@ property.accounting.unit.tree property.accounting.unit - + diff --git a/yuthon_property/views/property_accounts_receivable_views.xml b/yuthon_property/views/property_accounts_receivable_views.xml index e73d10882..def59473f 100644 --- a/yuthon_property/views/property_accounts_receivable_views.xml +++ b/yuthon_property/views/property_accounts_receivable_views.xml @@ -4,8 +4,7 @@ property.accounts.receivable + decoration-success="is_reconciliation == True">
diff --git a/yuthon_property/views/property_bank_statements_views.xml b/yuthon_property/views/property_bank_statements_views.xml index cde93d9f6..2daf97cd2 100644 --- a/yuthon_property/views/property_bank_statements_views.xml +++ b/yuthon_property/views/property_bank_statements_views.xml @@ -4,7 +4,7 @@ property.bank.statements.tree property.bank.statements - + @@ -35,7 +35,7 @@ property.bank.statements.tree property.bank.statements - +
diff --git a/yuthon_property_approval/views/property_merge_approval_views.xml b/yuthon_property_approval/views/property_merge_approval_views.xml index ee80fd36d..e4bb3b821 100644 --- a/yuthon_property_approval/views/property_merge_approval_views.xml +++ b/yuthon_property_approval/views/property_merge_approval_views.xml @@ -4,7 +4,7 @@ property.merge.approval.tree property.merge.approval - + diff --git a/yuthon_property_approval/views/property_move_views.xml b/yuthon_property_approval/views/property_move_views.xml index 03c241bb8..e480cb69b 100644 --- a/yuthon_property_approval/views/property_move_views.xml +++ b/yuthon_property_approval/views/property_move_views.xml @@ -4,7 +4,7 @@ property.move.tree property.move - + diff --git a/yuthon_property_approval/views/property_offline_registration.xml b/yuthon_property_approval/views/property_offline_registration.xml index acd70105e..d18922685 100644 --- a/yuthon_property_approval/views/property_offline_registration.xml +++ b/yuthon_property_approval/views/property_offline_registration.xml @@ -4,7 +4,7 @@ property.offline.registration.tree property.offline.registration - + diff --git a/yuthon_property_approval/views/property_open_rent_views.xml b/yuthon_property_approval/views/property_open_rent_views.xml index f945e4cc4..10f7abe47 100644 --- a/yuthon_property_approval/views/property_open_rent_views.xml +++ b/yuthon_property_approval/views/property_open_rent_views.xml @@ -4,7 +4,7 @@ property.open.rent.tree property.open.rent - + diff --git a/yuthon_property_approval/views/property_penalty_proportion.xml b/yuthon_property_approval/views/property_penalty_proportion.xml index d4d358cec..faabcdce7 100644 --- a/yuthon_property_approval/views/property_penalty_proportion.xml +++ b/yuthon_property_approval/views/property_penalty_proportion.xml @@ -4,7 +4,7 @@ property.penalty.proportion.tree property.penalty.proportion - + diff --git a/yuthon_property_approval/views/property_penalty_relief.xml b/yuthon_property_approval/views/property_penalty_relief.xml index 414471ecd..aa4e20f9f 100644 --- a/yuthon_property_approval/views/property_penalty_relief.xml +++ b/yuthon_property_approval/views/property_penalty_relief.xml @@ -4,7 +4,7 @@ property.penalty.relief.tree property.penalty.relief - + diff --git a/yuthon_property_approval/views/property_project_approval_views.xml b/yuthon_property_approval/views/property_project_approval_views.xml index 2d116d62c..526ac337e 100644 --- a/yuthon_property_approval/views/property_project_approval_views.xml +++ b/yuthon_property_approval/views/property_project_approval_views.xml @@ -4,7 +4,7 @@ property.project.approval.tree property.project.approval - + diff --git a/yuthon_property_approval/views/property_project_works_viwes.xml b/yuthon_property_approval/views/property_project_works_viwes.xml index 95edd0f50..403f4dbc7 100644 --- a/yuthon_property_approval/views/property_project_works_viwes.xml +++ b/yuthon_property_approval/views/property_project_works_viwes.xml @@ -4,7 +4,7 @@ property.project.works.tree property.project.works - + diff --git a/yuthon_property_approval/views/property_record_views.xml b/yuthon_property_approval/views/property_record_views.xml index 9e26b8a38..bec1c77e5 100644 --- a/yuthon_property_approval/views/property_record_views.xml +++ b/yuthon_property_approval/views/property_record_views.xml @@ -4,7 +4,7 @@ views.property.record.tree property.record - +
diff --git a/yuthon_property_approval/views/property_renamed.xml b/yuthon_property_approval/views/property_renamed.xml index 2983b8665..7480caab3 100644 --- a/yuthon_property_approval/views/property_renamed.xml +++ b/yuthon_property_approval/views/property_renamed.xml @@ -4,7 +4,7 @@ property.renamed.tree property.renamed - + diff --git a/yuthon_property_approval/views/property_rent_relief.xml b/yuthon_property_approval/views/property_rent_relief.xml index 84e457d3a..76664aa85 100644 --- a/yuthon_property_approval/views/property_rent_relief.xml +++ b/yuthon_property_approval/views/property_rent_relief.xml @@ -4,7 +4,7 @@ property.rent.relief.tree property.rent.relief - + diff --git a/yuthon_property_approval/views/property_rental_conditions.xml b/yuthon_property_approval/views/property_rental_conditions.xml index f696a87a4..197729ed4 100644 --- a/yuthon_property_approval/views/property_rental_conditions.xml +++ b/yuthon_property_approval/views/property_rental_conditions.xml @@ -4,7 +4,7 @@ property.rental.conditions.tree property.rental.conditions - + diff --git a/yuthon_property_approval/views/property_rental_form_views.xml b/yuthon_property_approval/views/property_rental_form_views.xml index 16b67953a..3b069daa5 100644 --- a/yuthon_property_approval/views/property_rental_form_views.xml +++ b/yuthon_property_approval/views/property_rental_form_views.xml @@ -4,7 +4,7 @@ property.rental.form.tree property.rental.form - + diff --git a/yuthon_property_approval/views/property_service_approval_views.xml b/yuthon_property_approval/views/property_service_approval_views.xml index 614c90aac..7c4a53cb2 100644 --- a/yuthon_property_approval/views/property_service_approval_views.xml +++ b/yuthon_property_approval/views/property_service_approval_views.xml @@ -4,7 +4,7 @@ property.service.approval.tree property.service.approval - + diff --git a/yuthon_property_approval/views/property_split_approval_views.xml b/yuthon_property_approval/views/property_split_approval_views.xml index f9c4b5e37..045a23f9a 100644 --- a/yuthon_property_approval/views/property_split_approval_views.xml +++ b/yuthon_property_approval/views/property_split_approval_views.xml @@ -4,7 +4,7 @@ property.split.approval.tree property.split.approval - + diff --git a/yuthon_property_approval/views/property_sporadic_works_views.xml b/yuthon_property_approval/views/property_sporadic_works_views.xml index 85f918ecc..fbead6a71 100644 --- a/yuthon_property_approval/views/property_sporadic_works_views.xml +++ b/yuthon_property_approval/views/property_sporadic_works_views.xml @@ -4,7 +4,7 @@ property.sporadic.works.tree property.sporadic.works - + diff --git a/yuthon_property_approval/views/property_supervising_approval_views.xml b/yuthon_property_approval/views/property_supervising_approval_views.xml index 1634a97f0..1ac6c3b62 100644 --- a/yuthon_property_approval/views/property_supervising_approval_views.xml +++ b/yuthon_property_approval/views/property_supervising_approval_views.xml @@ -4,7 +4,7 @@ property.supervising.approval.tree property.supervising.approval - + diff --git a/yuthon_property_approval/views/property_transaction_confirmed.xml b/yuthon_property_approval/views/property_transaction_confirmed.xml index eb40095bf..6b23c303a 100644 --- a/yuthon_property_approval/views/property_transaction_confirmed.xml +++ b/yuthon_property_approval/views/property_transaction_confirmed.xml @@ -4,7 +4,7 @@ property.transaction.confirmed.tree property.transaction.confirmed - + diff --git a/yuthon_property_approval/views/property_transfer_views.xml b/yuthon_property_approval/views/property_transfer_views.xml index 704183d76..bbd976b84 100644 --- a/yuthon_property_approval/views/property_transfer_views.xml +++ b/yuthon_property_approval/views/property_transfer_views.xml @@ -4,7 +4,7 @@ property.transfer.approval.tree property.transfer.approval - + diff --git a/yuthon_property_approval/views/property_utility_bills.xml b/yuthon_property_approval/views/property_utility_bills.xml index bfb969108..21ea8f3dd 100644 --- a/yuthon_property_approval/views/property_utility_bills.xml +++ b/yuthon_property_approval/views/property_utility_bills.xml @@ -4,7 +4,7 @@ property.utility.bills.tree property.utility.bills - + diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml index a0e3279f1..dc22bcf5a 100644 --- a/yuthon_salary/views/inherit_hr_payslip_views.xml +++ b/yuthon_salary/views/inherit_hr_payslip_views.xml @@ -425,7 +425,7 @@ hr.payslip.tree.jtbb hr.payslip - +