From 352f4c1af2d3b8f4082e40a6512e9be6bc1d88ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?=
<9664676+pengyuthon@user.noreply.gitee.com>
Date: Mon, 1 Sep 2025 10:58:53 +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 | 10 ++++++
.../views/inherit_hr_contract_views.xml | 26 +++++++++++++++-
.../models/yuthon_service_approval.py | 4 ++-
yuthon_property/models/yuthon_property.py | 31 ++++++++++++-------
.../models/property_split_approval.py | 1 -
5 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/yuthon_contract/models/inherit_hr_contract.py b/yuthon_contract/models/inherit_hr_contract.py
index 8d65fd1dc..cb2f0ef25 100644
--- a/yuthon_contract/models/inherit_hr_contract.py
+++ b/yuthon_contract/models/inherit_hr_contract.py
@@ -49,8 +49,18 @@ class HrContract(models.Model):
contact = fields.Char(related='party_id.contact', string='联系人')
phone = fields.Char(related='party_id.phone', string='电话')
documents_ids = fields.Many2many('ir.attachment', string="合同附件")
+ current_contract = fields.Boolean(string="当前合同", default=True, compute='_compute_current_contract', store=True)
is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company', search='_search_part_of_company')
+ @api.depends('date_start', 'date_end')
+ def _compute_current_contract(self):
+ today = date.today()
+ for contract in self:
+ start_valid = contract.date_start and contract.date_start <= today
+ end_valid = not contract.date_end or contract.date_end >= today
+ contract.current_contract = start_valid and end_valid
+
+
@api.onchange('date_start')
def _onchange_date_end(self):
for record in self:
diff --git a/yuthon_contract/views/inherit_hr_contract_views.xml b/yuthon_contract/views/inherit_hr_contract_views.xml
index 81994c96a..1dd0f4515 100644
--- a/yuthon_contract/views/inherit_hr_contract_views.xml
+++ b/yuthon_contract/views/inherit_hr_contract_views.xml
@@ -11,6 +11,15 @@
+
+ false
+
+
+ 1
+
+
+ 1
+
@@ -42,6 +51,9 @@
1
+
+ false
+
@@ -92,7 +104,19 @@
-
+
+ hr.contract.search.inherit
+ hr.contract
+
+
+
+
+
+
+
+
+
+
批量导入合同
diff --git a/yuthon_hr_employee_approval/models/yuthon_service_approval.py b/yuthon_hr_employee_approval/models/yuthon_service_approval.py
index 0096d773e..2ba7ce6d4 100644
--- a/yuthon_hr_employee_approval/models/yuthon_service_approval.py
+++ b/yuthon_hr_employee_approval/models/yuthon_service_approval.py
@@ -13,9 +13,11 @@ class YuthonServiceApproval(models.Model):
service_type = fields.Selection([('done', '在职证明'), ('leaving', '离职证明'), ('income', '收入证明')], string="服务类型")
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
documents_ids = fields.Many2many('ir.attachment', string="附件")
- department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
+ department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门", store=True)
employee_id = fields.Many2one('hr.employee', string="员工姓名")
+ company_id = fields.Many2one(related="users_id.employee_id.company_id", string="公司", store=True)
tenant_user_card = fields.Many2one('ir.attachment', string="身份证")
+
onboarding_time = fields.Date(related='employee_id.open_start_time', string="入职时间")
job_id = fields.Many2one(related='employee_id.job_id', string="岗位")
reason_issuance = fields.Char(string="开证原因")
diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py
index 7b5bbc8a9..a58910d7c 100644
--- a/yuthon_property/models/yuthon_property.py
+++ b/yuthon_property/models/yuthon_property.py
@@ -55,10 +55,10 @@ class YuthonProperty(models.Model):
rental_unit_price = fields.Float(string="评估单价")
title_number = fields.Char(string="产权编号")
suite_area = fields.Float(string="套内面积", digits=(16, 4))
- purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
+ purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型", compute="_compute_information_fields", store=True)
admin_id = fields.Many2one('res.users', string="片区管理员", compute="_compute_information_fields", store=True)
lessee_id = fields.Many2one('property.tenant.information', string='承租方')
- title_address = fields.Many2one('yuthon.property.message', string="产权地址")
+ title_address = fields.Many2one('yuthon.property.message', string="产权地址", compute="_compute_title_information_fields", store=True)
company_id = fields.Many2one('yuthon.property.company', string="公司", compute="_compute_information_fields", store=True)
rental_address = fields.Text(string="出租地址")
tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型', compute="_compute_information_fields", store=True)
@@ -129,12 +129,14 @@ class YuthonProperty(models.Model):
@api.depends('title_information_ids.start_time', 'title_information_ids.owner_id',
'title_information_ids.title_certificate', 'title_information_ids.registered_id',
+ 'title_information_ids.property_message_id',
'title_information_ids.equity_area')
def _compute_title_information_fields(self):
for rec in self:
if rec.title_information_ids:
latest_title = rec.title_information_ids.sorted('start_time', reverse=True)[0]
rec.update({
+ 'title_address': latest_title.property_message_id,
'owner_id': latest_title.owner_id,
'title_deed': latest_title.title_certificate,
'registered_id': latest_title.registered_id,
@@ -144,12 +146,14 @@ class YuthonProperty(models.Model):
@api.depends('manage_information_ids.start_time', 'manage_information_ids.precinct_id',
'manage_information_ids.tenure_type', 'manage_information_ids.management_area',
'manage_information_ids.rent_area', 'manage_information_ids.admin_id',
+ 'manage_information_ids.purpose_id',
'manage_information_ids.company_id')
def _compute_information_fields(self):
for rec in self:
if rec.manage_information_ids:
latest_info = rec.manage_information_ids.sorted('start_time', reverse=True)[0]
rec.update({
+ 'purpose_id': latest_info.purpose_id,
'precinct_id': latest_info.precinct_id,
'tenure_type': latest_info.tenure_type,
'management_area': latest_info.management_area,
@@ -358,16 +362,19 @@ class YuthonProperty(models.Model):
# 拆分
def put_split_approval(self):
- form_id = self.env.ref('yuthon_property_approval.view_property_split_approval_form').id
- return {
- 'name': '拆分物业审批',
- 'view_mode': 'form',
- 'res_model': 'property.split.approval',
- 'type': 'ir.actions.act_window',
- 'views': [(form_id, 'form')],
- 'context': {
- 'default_property_id': self.id
- }}
+ property_ids = self.env["yuthon.property"].browse(
+ self._context.get('active_ids', self._context.get('active_id')))
+ for record in property_ids:
+ form_id = self.env.ref('yuthon_property_approval.view_property_split_approval_form').id
+ return {
+ 'name': '拆分物业审批',
+ 'view_mode': 'form',
+ 'res_model': 'property.split.approval',
+ 'type': 'ir.actions.act_window',
+ 'views': [(form_id, 'form')],
+ 'context': {
+ 'default_property_id': record.id
+ }}
# 合并
def put_merge_approval(self):
property_ids = self.env["yuthon.property"].browse(
diff --git a/yuthon_property_approval/models/property_split_approval.py b/yuthon_property_approval/models/property_split_approval.py
index 87e1da0d7..7380f8ec1 100644
--- a/yuthon_property_approval/models/property_split_approval.py
+++ b/yuthon_property_approval/models/property_split_approval.py
@@ -108,7 +108,6 @@ class PropertySplitApproval(models.Model):
if main_property.manage_information_ids:
manage_vals = [
(0, 0, {
- # 核心:设置拆分后的管理面积和可租面积
'management_area': property_split.split_building_area,
'rent_area': property_split.split_rent_area,
'purpose_id': line.purpose_id.id,