From cdcb2ad97faa92532945b5f431b9098f260024fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Fri, 24 Apr 2026 15:18:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=88=97=E8=A1=A8=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_contract/models/__init__.py | 1 + yuthon_contract/models/inherit_hr_employee.py | 14 ++++++++++++++ yuthon_hr_employee/models/yuthon_hr_employee.py | 1 - 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 yuthon_contract/models/inherit_hr_employee.py diff --git a/yuthon_contract/models/__init__.py b/yuthon_contract/models/__init__.py index b02a0e56e..57079bb8a 100644 --- a/yuthon_contract/models/__init__.py +++ b/yuthon_contract/models/__init__.py @@ -1 +1,2 @@ from . import inherit_hr_contract +from . import inherit_hr_employee diff --git a/yuthon_contract/models/inherit_hr_employee.py b/yuthon_contract/models/inherit_hr_employee.py new file mode 100644 index 000000000..fa1d6b90f --- /dev/null +++ b/yuthon_contract/models/inherit_hr_employee.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +from odoo import fields, models + + +class HrEmployee(models.Model): + _inherit = "hr.employee" + + # 从当前合同取甲方(用人单位),依赖 yuthon_contract 模块中 hr.contract.party_id 字段 + party_id = fields.Many2one( + related='contract_id.party_id', + string="甲方(用人单位)", + store=True, + ) diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py index 3146c6340..d5b0b3356 100644 --- a/yuthon_hr_employee/models/yuthon_hr_employee.py +++ b/yuthon_hr_employee/models/yuthon_hr_employee.py @@ -38,7 +38,6 @@ class YuthonHrEmployee(models.Model): ('formal_none', '正式合同(无固定)'), ('part_time', '兼职协议'), ('employment', '用工协议'), ('internship', '实习协议')], string="用工形式") contract_type_id = fields.Many2one(related='contract_id.contract_type_id', string="用工形式") - party_id = fields.Many2one(related='contract_id.party_id', string="甲方(用人单位)", store=True) date_end = fields.Date(string="合同结束日期", compute='_compute_date_end') # version = fields.Char(related='contract_id.version', string="版本") end_comparison = fields.Selection([('red', '小于30天'), ('yellow', '小于60天'), ('blue', '小于90天')], string="结束时间对比(颜色)",