From cc3afcd36ed57071282ec276fc7f986ffb1a25c1 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Fri, 6 Jun 2025 16:33:04 +0800
Subject: [PATCH 1/2] =?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_hr_employee/models/inherit_hr_job.py | 24 +++++++++++++++++++
.../views/inherit_hr_job_views.xml | 1 +
.../models/inherit_hr_payroll_structure.py | 22 +++++++++++++++++
.../models/yuthon_payroll_project.py | 10 ++++----
.../inherit_hr_payroll_structure_views.xml | 2 ++
5 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/yuthon_hr_employee/models/inherit_hr_job.py b/yuthon_hr_employee/models/inherit_hr_job.py
index b5468f1c4..e67a3a91f 100644
--- a/yuthon_hr_employee/models/inherit_hr_job.py
+++ b/yuthon_hr_employee/models/inherit_hr_job.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
import datetime
+from odoo.exceptions import UserError
class HrJob(models.Model):
@@ -44,6 +45,29 @@ class HrJob(models.Model):
other_notes = fields.Text(string="任职要求")
function = fields.Text(string="岗位职责")
+ is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company',
+ search='_search_part_of_company')
+
+ @api.depends_context('uid', 'company')
+ @api.depends('company_id')
+ def _compute_is_company(self):
+ active_company_ids = self.env.companies
+ for employee in self:
+ employee.is_company = employee.company_id in active_company_ids
+
+ def _search_part_of_company(self, operator, value):
+ if operator not in ('=', '!=') or not isinstance(value, bool):
+ raise UserError(('Operation not supported'))
+ company_ids = self.env.companies.ids # 获取公司ID列表
+ # 处理反向操作符
+ if not value:
+ operator = '!=' if operator == '=' else '='
+ # 使用company_id in company_ids的结构
+ if operator == '=':
+ return [('company_id', 'in', company_ids)]
+ else: # operator == '!='
+ return [('company_id', 'not in', company_ids)]
+
def action_create_new_job(self):
action = self.env.ref("hr_recruitment.hr_applicant_view_form")
return {
diff --git a/yuthon_hr_employee/views/inherit_hr_job_views.xml b/yuthon_hr_employee/views/inherit_hr_job_views.xml
index 8fed581ce..2c87611ee 100644
--- a/yuthon_hr_employee/views/inherit_hr_job_views.xml
+++ b/yuthon_hr_employee/views/inherit_hr_job_views.xml
@@ -53,6 +53,7 @@
+
diff --git a/yuthon_salary/models/inherit_hr_payroll_structure.py b/yuthon_salary/models/inherit_hr_payroll_structure.py
index 7153613f1..df0724af9 100644
--- a/yuthon_salary/models/inherit_hr_payroll_structure.py
+++ b/yuthon_salary/models/inherit_hr_payroll_structure.py
@@ -1,6 +1,7 @@
from odoo import api, fields, models, _
import re
from pypinyin import pinyin, Style
+from odoo.exceptions import UserError, ValidationError
class HrPayrollStructure(models.Model):
@@ -25,6 +26,27 @@ class HrPayrollStructure(models.Model):
position_subsidy = fields.Monetary(string="岗位补贴", currency_field="currency_id")
integrated_subsidy = fields.Monetary(string="综合补贴", currency_field="currency_id")
advance_performance_bonuses = fields.Monetary(string="预发绩效奖金", currency_field="currency_id")
+ is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company',search='_search_part_of_company')
+
+ @api.depends_context('uid', 'company')
+ @api.depends('company_id')
+ def _compute_is_company(self):
+ active_company_ids = self.env.companies
+ for employee in self:
+ employee.is_company = employee.company_id in active_company_ids
+
+ def _search_part_of_company(self, operator, value):
+ if operator not in ('=', '!=') or not isinstance(value, bool):
+ raise UserError(('Operation not supported'))
+ company_ids = self.env.companies.ids # 获取公司ID列表
+ # 处理反向操作符
+ if not value:
+ operator = '!=' if operator == '=' else '='
+ # 使用company_id in company_ids的结构
+ if operator == '=':
+ return [('company_id', 'in', company_ids)]
+ else: # operator == '!='
+ return [('company_id', 'not in', company_ids)]
@api.model
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
diff --git a/yuthon_salary/models/yuthon_payroll_project.py b/yuthon_salary/models/yuthon_payroll_project.py
index 3fcc37b99..f2166c665 100644
--- a/yuthon_salary/models/yuthon_payroll_project.py
+++ b/yuthon_salary/models/yuthon_payroll_project.py
@@ -76,13 +76,13 @@ class YuthonPayrollCommon(models.Model):
formula_salary = "result = 0"
if ins.name == '岗位绩效':
formula_salary = "result = 0"
- if ins.name == '优秀员工':
+ if ins.name == '优秀部门经理/员工':
formula_salary = "result = 0"
- if ins.name == '值班':
+ if ins.name == '值班费':
formula_salary = "result = 0"
- if ins.name == '年金':
+ if ins.name == '年金(系数)':
formula_salary = "result = 0"
- if ins.name == '六一儿童节福利':
+ if ins.name == '六一儿童节福利费':
formula_salary = "result = 0"
if ins.name == '环境作业津贴':
formula_salary = "result = 0"
@@ -95,7 +95,7 @@ class YuthonPayrollCommon(models.Model):
10 if employee.job_id.name else 0"
if ins.name == '岗位补贴':
formula_salary = "result = 100 if employee.job_id.name == '会计' else \
- 600 if '司机' in [role.name for role in user_role_ids] else \
+ 600 if '司机' in [role.name for role in employee.user_role_ids] else \
200 if employee.department_id.name in ['高压班', '运行班'] else \
0"
if ins.name not in sal.rule_ids.mapped('name'):
diff --git a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml
index 35576f498..ba58e8ea3 100644
--- a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml
+++ b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml
@@ -38,6 +38,7 @@
+
@@ -96,6 +97,7 @@
职级
hr.payroll.structure
tree,form,search
+ [('is_company','=', True)]
From dcedd5bb6f38d4beb5f0b4499e5cd44a907fea74 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Fri, 6 Jun 2025 16:34:17 +0800
Subject: [PATCH 2/2] =?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_hr_employee/models/inherit_hr_job.py | 24 -------------------
.../views/inherit_hr_job_views.xml | 1 -
.../models/inherit_hr_payroll_structure.py | 22 -----------------
.../inherit_hr_payroll_structure_views.xml | 2 --
4 files changed, 49 deletions(-)
diff --git a/yuthon_hr_employee/models/inherit_hr_job.py b/yuthon_hr_employee/models/inherit_hr_job.py
index e67a3a91f..b5468f1c4 100644
--- a/yuthon_hr_employee/models/inherit_hr_job.py
+++ b/yuthon_hr_employee/models/inherit_hr_job.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
import datetime
-from odoo.exceptions import UserError
class HrJob(models.Model):
@@ -45,29 +44,6 @@ class HrJob(models.Model):
other_notes = fields.Text(string="任职要求")
function = fields.Text(string="岗位职责")
- is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company',
- search='_search_part_of_company')
-
- @api.depends_context('uid', 'company')
- @api.depends('company_id')
- def _compute_is_company(self):
- active_company_ids = self.env.companies
- for employee in self:
- employee.is_company = employee.company_id in active_company_ids
-
- def _search_part_of_company(self, operator, value):
- if operator not in ('=', '!=') or not isinstance(value, bool):
- raise UserError(('Operation not supported'))
- company_ids = self.env.companies.ids # 获取公司ID列表
- # 处理反向操作符
- if not value:
- operator = '!=' if operator == '=' else '='
- # 使用company_id in company_ids的结构
- if operator == '=':
- return [('company_id', 'in', company_ids)]
- else: # operator == '!='
- return [('company_id', 'not in', company_ids)]
-
def action_create_new_job(self):
action = self.env.ref("hr_recruitment.hr_applicant_view_form")
return {
diff --git a/yuthon_hr_employee/views/inherit_hr_job_views.xml b/yuthon_hr_employee/views/inherit_hr_job_views.xml
index 2c87611ee..8fed581ce 100644
--- a/yuthon_hr_employee/views/inherit_hr_job_views.xml
+++ b/yuthon_hr_employee/views/inherit_hr_job_views.xml
@@ -53,7 +53,6 @@
-
diff --git a/yuthon_salary/models/inherit_hr_payroll_structure.py b/yuthon_salary/models/inherit_hr_payroll_structure.py
index df0724af9..7153613f1 100644
--- a/yuthon_salary/models/inherit_hr_payroll_structure.py
+++ b/yuthon_salary/models/inherit_hr_payroll_structure.py
@@ -1,7 +1,6 @@
from odoo import api, fields, models, _
import re
from pypinyin import pinyin, Style
-from odoo.exceptions import UserError, ValidationError
class HrPayrollStructure(models.Model):
@@ -26,27 +25,6 @@ class HrPayrollStructure(models.Model):
position_subsidy = fields.Monetary(string="岗位补贴", currency_field="currency_id")
integrated_subsidy = fields.Monetary(string="综合补贴", currency_field="currency_id")
advance_performance_bonuses = fields.Monetary(string="预发绩效奖金", currency_field="currency_id")
- is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company',search='_search_part_of_company')
-
- @api.depends_context('uid', 'company')
- @api.depends('company_id')
- def _compute_is_company(self):
- active_company_ids = self.env.companies
- for employee in self:
- employee.is_company = employee.company_id in active_company_ids
-
- def _search_part_of_company(self, operator, value):
- if operator not in ('=', '!=') or not isinstance(value, bool):
- raise UserError(('Operation not supported'))
- company_ids = self.env.companies.ids # 获取公司ID列表
- # 处理反向操作符
- if not value:
- operator = '!=' if operator == '=' else '='
- # 使用company_id in company_ids的结构
- if operator == '=':
- return [('company_id', 'in', company_ids)]
- else: # operator == '!='
- return [('company_id', 'not in', company_ids)]
@api.model
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
diff --git a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml
index ba58e8ea3..35576f498 100644
--- a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml
+++ b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml
@@ -38,7 +38,6 @@
-
@@ -97,7 +96,6 @@
职级
hr.payroll.structure
tree,form,search
- [('is_company','=', True)]