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="结束时间对比(颜色)",