From 39c2913be9d24dd496036147823dd61a1199961f Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Mon, 24 Feb 2025 11:02:01 +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_holiday/__manifest__.py | 1 +
.../security/yuthon_holiday_group.xml | 17 +++++++++++++++++
yuthon_salary/models/yuthon_payroll_project.py | 17 ++++++++++++++---
yuthon_work_brand/views/hr_menus.xml | 1 +
4 files changed, 33 insertions(+), 3 deletions(-)
create mode 100644 yuthon_holiday/security/yuthon_holiday_group.xml
diff --git a/yuthon_holiday/__manifest__.py b/yuthon_holiday/__manifest__.py
index 930815d26..fe2800e7e 100644
--- a/yuthon_holiday/__manifest__.py
+++ b/yuthon_holiday/__manifest__.py
@@ -7,6 +7,7 @@
'license': 'LGPL-3',
'data': [
'security/ir.model.access.csv',
+ 'security/yuthon_holiday_group.xml',
'data/yuthon_holiday_data.xml',
'views/inherit_hr_type_views.xml',
'views/inherit_hr_leave_allocation_views.xml',
diff --git a/yuthon_holiday/security/yuthon_holiday_group.xml b/yuthon_holiday/security/yuthon_holiday_group.xml
new file mode 100644
index 000000000..76f799240
--- /dev/null
+++ b/yuthon_holiday/security/yuthon_holiday_group.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ 假期组
+
+
+ 假期:用户
+
+
+
+ 假期:管理员
+
+
+
+
+
\ No newline at end of file
diff --git a/yuthon_salary/models/yuthon_payroll_project.py b/yuthon_salary/models/yuthon_payroll_project.py
index 98143101c..574c82ff1 100644
--- a/yuthon_salary/models/yuthon_payroll_project.py
+++ b/yuthon_salary/models/yuthon_payroll_project.py
@@ -1,3 +1,5 @@
+from email.policy import default
+
from odoo import api, fields, models, _
@@ -32,8 +34,6 @@ class YuthonPayrollInsurances (models.Model):
name = fields.Char(string='工资项名称')
is_base = fields.Boolean(string='独立基数')
- yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')],
- string='公司')
proportion_company = fields.Float(string='公司缴纳比例')
proportion_employee = fields.Float(string='个人缴纳比例')
proportion_company_ceiling = fields.Float(string='公司缴纳比例上限')
@@ -45,4 +45,15 @@ class YuthonPayrollInsurances (models.Model):
documents_ids = fields.Many2many('ir.attachment', string="附件")
remarks = fields.Text(string="备注")
start_date = fields.Date(string="生效日期", default=fields.Date.today())
- end_date = fields.Date(string="失效日期")
\ No newline at end of file
+ end_date = fields.Date(string="失效日期")
+
+ def _get_default_yuthon_company(self):
+ current_user = self.env.user
+ employee = self.env['hr.employee'].search([('user_id', '=', current_user.id)], limit=1)
+ if employee:
+ if employee.yuthon_company:
+ return employee.yuthon_company
+ return ''
+
+ yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), ('thlc', '天河粮储')],
+ default=_get_default_yuthon_company, string = '公司')
\ No newline at end of file
diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml
index f41226efb..9eedb47b6 100644
--- a/yuthon_work_brand/views/hr_menus.xml
+++ b/yuthon_work_brand/views/hr_menus.xml
@@ -284,6 +284,7 @@
sequence="7"/>