From 525043e6e9e5289449fe6ff6480b6f80650295c0 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Wed, 23 Jul 2025 19:03:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_contract/models/inherit_hr_contract.py | 4 ++ .../views/inherit_hr_contract_views.xml | 1 + .../models/yuthon_vacation_reports.py | 40 ++++++++++++++----- yuthon_holiday/views/hr_leave_batch.xml | 2 +- .../views/yuthon_vacation_reports_views.xml | 19 +++++---- yuthon_hr_attendance/__manifest__.py | 2 +- .../controllers/applet_address.py | 2 +- .../controllers/applet_attendance.py | 4 +- yuthon_hr_attendance/models/__init__.py | 2 +- .../{wife_message.py => wifi_message.py} | 6 +-- .../security/ir.model.access.csv | 2 +- .../views/applet_address_views.xml | 2 +- .../views/wife_message_view.xml | 19 --------- .../views/wifi_message_view.xml | 19 +++++++++ .../views/yuthon_interview_approval_views.xml | 14 +++---- .../views/yuthon_onboard_approval_views.xml | 4 +- .../views/yuthon_office_supplies_views.xml | 2 +- yuthon_work_brand/views/hr_menus.xml | 2 +- 18 files changed, 87 insertions(+), 59 deletions(-) rename yuthon_hr_attendance/models/{wife_message.py => wifi_message.py} (68%) delete mode 100644 yuthon_hr_attendance/views/wife_message_view.xml create mode 100644 yuthon_hr_attendance/views/wifi_message_view.xml diff --git a/yuthon_contract/models/inherit_hr_contract.py b/yuthon_contract/models/inherit_hr_contract.py index 56e8f9937..506e7bad6 100644 --- a/yuthon_contract/models/inherit_hr_contract.py +++ b/yuthon_contract/models/inherit_hr_contract.py @@ -24,6 +24,10 @@ class HrContract(models.Model): is_internship = fields.Boolean(string="实习期", compute='_compute_name', store=True) date_end = fields.Date(string="合同结束时间", compute='_compute_date_end', store=True) termination_date = fields.Date(string="中止时间") + reason_suspension = fields.Selection([ + ('turnover', '离职'), + ('died', '意外离世'), + ], string='中止原因') work_entry_source = fields.Selection([ ('calendar', '考勤安排'), ('attendance', 'Attendances'), diff --git a/yuthon_contract/views/inherit_hr_contract_views.xml b/yuthon_contract/views/inherit_hr_contract_views.xml index 668819f43..fbad622cf 100644 --- a/yuthon_contract/views/inherit_hr_contract_views.xml +++ b/yuthon_contract/views/inherit_hr_contract_views.xml @@ -38,6 +38,7 @@ + diff --git a/yuthon_holiday/models/yuthon_vacation_reports.py b/yuthon_holiday/models/yuthon_vacation_reports.py index 9bb23ccf3..9ddc69f51 100644 --- a/yuthon_holiday/models/yuthon_vacation_reports.py +++ b/yuthon_holiday/models/yuthon_vacation_reports.py @@ -16,9 +16,24 @@ class YuthonVacationReports(models.Model): meal_fee_ids = fields.One2many('vacation.meal.line', 'vacation_id', string='误餐明细') medical_fee_ids = fields.One2many('vacation.medical.line', 'vacation_id', string='体检费明细') - leave = fields.Float(string='年假', compute='_compute_leave', store=True) - working_overtime = fields.Float(string='加班时', compute='_compute_working_overtime', store=True) + leave = fields.Char(string='年假', compute='_compute_leave', store=True) + working_overtime = fields.Char(string='加班时', compute='_compute_working_overtime', store=True) meal_fee = fields.Integer(string="误餐次数", compute='_compute_meal_fee', store=True) + medical_fee = fields.Float(string="体检费", compute='_compute_medical_fee', store=True) + + @api.depends('medical_fee_ids.update_type', 'medical_fee_ids.lines', 'medical_fee_ids.is_void') + def _compute_medical_fee(self): + for record in self: + total = 0.0 + valid_lines = record.medical_fee_ids.filtered(lambda l: not l.is_void) + + for line in valid_lines: + if line.update_type == 'add': + total += line.lines + elif line.update_type == 'reduce': + total -= line.lines + + record.medical_fee = max(total, 0.0) def action_open_my_form(self): employee = self.env.user.employee_id @@ -87,14 +102,17 @@ class YuthonVacationReports(models.Model): @api.depends('leave_ids.update_lines', 'leave_ids.update_type', 'leave_ids.is_void') def _compute_leave(self): for record in self: - leave_total = 0.0 + leave_hours = 0.0 for line in record.leave_ids: if not line.is_void: + line_value = line.update_lines or 0 if line.update_type == 'add': - leave_total += line.update_lines or 0 + leave_hours += line_value elif line.update_type == 'reduce': - leave_total -= line.update_lines or 0 - record.leave = leave_total + leave_hours -= line_value + + leave_days = leave_hours / 8 + record.leave = f"{leave_hours:.2f}小时({leave_days:.2f}天)" @api.depends( 'overtime_ids.workday', @@ -105,15 +123,17 @@ class YuthonVacationReports(models.Model): ) def _compute_working_overtime(self): for record in self: - overtime_total = 0.0 + overtime_hours = 0.0 for line in record.overtime_ids: if not line.is_void: line_total = (line.workday or 0) + (line.legal_day or 0) + (line.public_holidays or 0) if line.update_type == 'add': - overtime_total += line_total + overtime_hours += line_total elif line.update_type == 'reduce': - overtime_total -= line_total - record.working_overtime = overtime_total + overtime_hours -= line_total + + overtime_days = overtime_hours / 8 + record.working_overtime = f"{overtime_hours:.2f}小时({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): diff --git a/yuthon_holiday/views/hr_leave_batch.xml b/yuthon_holiday/views/hr_leave_batch.xml index 47321f615..e5bbbaa32 100644 --- a/yuthon_holiday/views/hr_leave_batch.xml +++ b/yuthon_holiday/views/hr_leave_batch.xml @@ -47,7 +47,7 @@ - + diff --git a/yuthon_holiday/views/yuthon_vacation_reports_views.xml b/yuthon_holiday/views/yuthon_vacation_reports_views.xml index 67f24d247..fbe045909 100644 --- a/yuthon_holiday/views/yuthon_vacation_reports_views.xml +++ b/yuthon_holiday/views/yuthon_vacation_reports_views.xml @@ -22,15 +22,18 @@
- + - + - + - + + + + @@ -128,15 +131,15 @@ - + - + - + - + diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py index 67019f3d7..e425d747b 100644 --- a/yuthon_hr_attendance/__manifest__.py +++ b/yuthon_hr_attendance/__manifest__.py @@ -52,7 +52,7 @@ 'views/yuthon_customer_planning_views.xml', 'views/planning_slot_template_views.xml', 'views/hr_attendance_month_views.xml', - 'views/wife_message_view.xml', + 'views/wifi_message_view.xml', 'views/hr_attendance_portal_templates.xml', 'wizard/hr_attendance_month_wizard_views.xml', 'wizard/yuthon_delete_planning_wizard_views.xml', diff --git a/yuthon_hr_attendance/controllers/applet_address.py b/yuthon_hr_attendance/controllers/applet_address.py index 037cb7911..1c69286f2 100644 --- a/yuthon_hr_attendance/controllers/applet_address.py +++ b/yuthon_hr_attendance/controllers/applet_address.py @@ -15,7 +15,7 @@ class AppletAddress(models.Model): company_id = fields.Many2one('res.company', string="公司") longitude = fields.Float(string="经度", digits=(16, 10)) latitude = fields.Float(string="纬度", digits=(16, 10)) - wife_name_ids = fields.Many2many('wife.message', string="wife名称") + wifi_name_ids = fields.Many2many('wifi.message', string="wifi名称") card_rice = fields.Integer(string="打卡范围(米)") def update_employee(self): diff --git a/yuthon_hr_attendance/controllers/applet_attendance.py b/yuthon_hr_attendance/controllers/applet_attendance.py index c103e1e36..0d1bc709c 100644 --- a/yuthon_hr_attendance/controllers/applet_attendance.py +++ b/yuthon_hr_attendance/controllers/applet_attendance.py @@ -102,12 +102,12 @@ class AppletAttendance(Controller): self_address = self.get_address_from_coords(kw['att_latitude'], kw['att_longitude']) for address_id in address_ids: - wife_name_list = address_id.wife_name_ids.mapped('name') + wifi_name_list = address_id.wifi_name_ids.mapped('name') card_rice = address_id.card_rice * 0.001 # 打卡范围 _logger.info(f"\n应打卡地址 地址验证: {address_id.address_name} 详细: {address_id.address_name2}___") _logger.info(f"\n人员: {employee_id.name} 当前所在地址: {self_address['formatted_address']}__________") _logger.info(f"\n可打卡 当前经度: {kw['att_longitude']} 当前纬度: {kw['att_latitude']} 范围:{address_id.card_rice}米__________") - if self.is_within_radius_geopy(kw['att_latitude'], kw['att_longitude'], address_id.latitude, address_id.longitude, card_rice) and kw['wife_name'] in wife_name_list: + if self.is_within_radius_geopy(kw['att_latitude'], kw['att_longitude'], address_id.latitude, address_id.longitude, card_rice) and kw['wifi_name'] in wifi_name_list: message = '可以打卡' state = 'yes' _logger.info(f"\n可打卡") diff --git a/yuthon_hr_attendance/models/__init__.py b/yuthon_hr_attendance/models/__init__.py index 17a21ffac..2f34dff75 100644 --- a/yuthon_hr_attendance/models/__init__.py +++ b/yuthon_hr_attendance/models/__init__.py @@ -25,7 +25,7 @@ from . import yuthon_customer_planning from . import hr_attendance_wechat from . import hr_attendance_detail_wechat from . import hr_attendance_month -from . import wife_message +from . import wifi_message # from odoo.tools import SQL diff --git a/yuthon_hr_attendance/models/wife_message.py b/yuthon_hr_attendance/models/wifi_message.py similarity index 68% rename from yuthon_hr_attendance/models/wife_message.py rename to yuthon_hr_attendance/models/wifi_message.py index 59e66b4bf..69faf010e 100644 --- a/yuthon_hr_attendance/models/wife_message.py +++ b/yuthon_hr_attendance/models/wifi_message.py @@ -4,9 +4,9 @@ from datetime import datetime, time, timedelta from odoo.exceptions import UserError -class WifeMessage(models.Model): - _name = 'wife.message' - _description = 'wife名称管理' +class WifiMessage(models.Model): + _name = 'wifi.message' + _description = 'wifi名称管理' ip = fields.Char(string='IP') name = fields.Char(string='名称') diff --git a/yuthon_hr_attendance/security/ir.model.access.csv b/yuthon_hr_attendance/security/ir.model.access.csv index b50207e9f..2d63f7179 100644 --- a/yuthon_hr_attendance/security/ir.model.access.csv +++ b/yuthon_hr_attendance/security/ir.model.access.csv @@ -59,4 +59,4 @@ access_yuthon_integrated_wizard,yuthon.integrated.wizard,model_yuthon_integrated access_applet_address,applet.address,model_applet_address,base.group_user,1,1,1,1 access_applet_security,applet.security,model_applet_security,base.group_user,1,1,1,1 access_applet_security_setting,applet.security.setting,model_applet_security_setting,base.group_user,1,1,1,1 -access_wife_message,wife.message,model_wife_message,base.group_user,1,1,1,1 +access_wifi_message,wifi.message,model_wifi_message,base.group_user,1,1,1,1 diff --git a/yuthon_hr_attendance/views/applet_address_views.xml b/yuthon_hr_attendance/views/applet_address_views.xml index 8caf5bb4d..954620b78 100644 --- a/yuthon_hr_attendance/views/applet_address_views.xml +++ b/yuthon_hr_attendance/views/applet_address_views.xml @@ -8,7 +8,7 @@ - + diff --git a/yuthon_hr_attendance/views/wife_message_view.xml b/yuthon_hr_attendance/views/wife_message_view.xml deleted file mode 100644 index 8382fb574..000000000 --- a/yuthon_hr_attendance/views/wife_message_view.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - wife.message.tree - wife.message - - - - - - - - - - Wife名称管理 - wife.message - tree - - \ No newline at end of file diff --git a/yuthon_hr_attendance/views/wifi_message_view.xml b/yuthon_hr_attendance/views/wifi_message_view.xml new file mode 100644 index 000000000..09b4f3e95 --- /dev/null +++ b/yuthon_hr_attendance/views/wifi_message_view.xml @@ -0,0 +1,19 @@ + + + + wifi.message.tree + wifi.message + + + + + + + + + + wifi名称管理 + wifi.message + tree + + \ No newline at end of file diff --git a/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml b/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml index 403acd3ab..f2e664974 100644 --- a/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml +++ b/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml @@ -49,9 +49,9 @@ - - - + + + @@ -61,9 +61,9 @@ - - - + + +