From e0baa8ef03ec9d6c992cf8bcfc2da33d6df3dcaf Mon Sep 17 00:00:00 2001
From: zhouzhou <123@qq.com>
Date: Mon, 4 Nov 2024 11:53:19 +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_property/models/yuthon_property.py | 53 ++-
yuthon_property/views/menuitem.xml | 29 +-
.../views/yuthon_property_views.xml | 386 +++++++++++++++++-
yuthon_property_approval/__manifest__.py | 2 +
.../data/sale_renting_code_data.xml | 10 +
yuthon_property_approval/models/__init__.py | 4 +-
.../models/property_merge_approval.py | 71 ++++
.../models/property_split_approval.py | 69 ++++
.../security/ir.model.access.csv | 6 +-
.../views/property_menu_all.xml | 13 +-
.../views/property_merge_approval_views.xml | 78 ++++
.../views/property_split_approval_views.xml | 80 ++++
12 files changed, 777 insertions(+), 24 deletions(-)
create mode 100644 yuthon_property_approval/models/property_merge_approval.py
create mode 100644 yuthon_property_approval/models/property_split_approval.py
create mode 100644 yuthon_property_approval/views/property_merge_approval_views.xml
create mode 100644 yuthon_property_approval/views/property_split_approval_views.xml
diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py
index 095447071..0a5f7ec51 100644
--- a/yuthon_property/models/yuthon_property.py
+++ b/yuthon_property/models/yuthon_property.py
@@ -24,6 +24,10 @@ class YuthonProperty(models.Model):
vr_link = fields.Char(string="VR链接")
notice_documents_ids = fields.Many2many('ir.attachment', string='议题附件')
current_rent = fields.Float(string="现租金")
+ is_merge = fields.Boolean(string="是否可合并")
+ is_split = fields.Boolean(string="是否可拆分")
+ is_done_split = fields.Boolean(string="已拆分")
+ is_done_merge = fields.Boolean(string="已合并")
abbreviation = fields.Char(string="简称")
property_floor = fields.Integer(string="楼层")
@@ -39,7 +43,7 @@ class YuthonProperty(models.Model):
('signed', '已备案'), ('leased', '已出租'), ('idle', '闲置')], string='状态', default='to')
is_meter = fields.Boolean(string="是否有水表")
is_electricity_meter = fields.Boolean(string="是否有电表")
- company_page = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储'), ('tj', '天河投建')],
+ yuthon_company = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储'), ('tj', '天河投建')],
string="所属公司")
admin_id = fields.Many2one('res.users', string="管理员")
purpose_id = fields.Many2one('yuthon.resource.purpose', string="资产用途")
@@ -67,7 +71,6 @@ class YuthonProperty(models.Model):
manage_standard = fields.Char(string="物业管理费标准")
title_address = fields.Char(string="产权地址")
rental_address = fields.Char(string="出租地址")
-
ame = fields.Char(string='标题')
decoration_type = fields.Selection([('blank', '毛坯'), ('hardcover', '精装'), ('brands', '简装'), ('rsz', '豪装')],
string="装修类型")
@@ -77,7 +80,8 @@ class YuthonProperty(models.Model):
manage_information_ids = fields.One2many('manage.information.line', 'yuthon_property_id',
string='关联管理信息明细行')
disassembly_information_ids = fields.One2many('disassembly.information.line', 'yuthon_property_id',
- string='关联拆合信息明细行')
+ string='关联拆分信息明细行')
+ property_merge_approval_id = fields.Many2one('yuthon.property', string='关联物业信息')
@api.onchange('building_area')
def _onchange_building_area(self):
@@ -134,6 +138,7 @@ class YuthonProperty(models.Model):
'default_property_id': self.id
}
}
+
def put_adjustment_approval(self):
form_id = self.env.ref('yuthon_property_approval.view_property_rental_conditions_form').id
return {
@@ -146,6 +151,7 @@ class YuthonProperty(models.Model):
'default_property_id': self.id
}
}
+
def put_property_handover(self):
property_ids = self.env["yuthon.property"].browse(
self._context.get('active_ids', self._context.get('active_id')))
@@ -193,7 +199,6 @@ class YuthonProperty(models.Model):
'rental_conditions': record.rental_conditions,
'state':record.state,
'remarks': record.remarks}])
-
return {
'name': '提交物业评估',
'view_mode': 'form',
@@ -204,6 +209,37 @@ class YuthonProperty(models.Model):
'default_evaluate_application_ids': property_list
}
}
+ # 拆分
+ 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
+ }}
+ # 合并
+ def put_merge_approval(self):
+ property_ids = self.env["yuthon.property"].browse(
+ self._context.get('active_ids', self._context.get('active_id')))
+ form_id = self.env.ref('yuthon_property_approval.view_property_merge_approval_form').id
+ property_list = []
+ for record in property_ids:
+ property_list.append([0, 0, {
+ 'property_id': record.id
+ }])
+ return {
+ 'name': '合并物业审批',
+ 'view_mode': 'form',
+ 'res_model': 'property.merge.approval',
+ 'type': 'ir.actions.act_window',
+ 'views': [(form_id, 'form')],
+ 'context': {
+ 'default_property_merge_approval_line_ids':property_list
+ }}
class YuthonPropertyWater(models.Model):
_name = 'yuthon.property.water'
@@ -269,7 +305,7 @@ class ManageInformationLine(models.Model):
purpose_id = fields.Many2one('yuthon.resource.purpose', string="资产用途")
precinct = fields.Char(string="片区")
admin_id = fields.Many2one('res.users', string="管理员")
- company_page = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储'), ('tj', '天河投建')],
+ yuthon_company = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储'), ('tj', '天河投建')],
string="所属公司")
start_time = fields.Date(string="生效日期")
end_date = fields.Date(string="失效日期")
@@ -277,10 +313,11 @@ class ManageInformationLine(models.Model):
class DisassemblyInformationLine(models.Model):
_name = 'disassembly.information.line'
- _description = '拆合信息明细行'
+ _description = '拆分信息明细行'
yuthon_property_id = fields.Many2one('yuthon.property', string="关联物业信息")
- property_name = fields.Char(string="物业名称") # 逻辑没搞清,暂时先放这里
- rent_area = fields.Float(string="可租面积")
+ property_id = fields.Many2one('yuthon.property', string="物业名称")
+ rent_area = fields.Float(related='property_id.rentable_area', string="可租面积")
start_time = fields.Date(string="生效日期")
end_date = fields.Date(string="失效日期")
+
diff --git a/yuthon_property/views/menuitem.xml b/yuthon_property/views/menuitem.xml
index 6ba1ebe9b..bafcd0e1c 100644
--- a/yuthon_property/views/menuitem.xml
+++ b/yuthon_property/views/menuitem.xml
@@ -298,17 +298,34 @@
parent="resource_management_menu"
name="客户信息"
sequence="2"/>
-
+
+
+
+
+
+
@@ -40,6 +42,10 @@
+
+
+
+
@@ -57,11 +63,12 @@
+
-
+
@@ -115,23 +122,26 @@
-
+
-
+
-
+
+
+
+
@@ -170,7 +180,7 @@
yuthon.property
-
+
@@ -249,7 +259,7 @@
-
+
@@ -276,7 +286,7 @@
-
+
@@ -309,4 +319,366 @@
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_property.yuthon_property_tree')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_property.yuthon_property_form')})]"/>
+
+
+ yuthon.property.tree
+ yuthon.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ yuthon.property.form
+ yuthon.property
+
+
+
+
+
+ 物业
+ yuthon.property
+ ir.actions.act_window
+ tree,form
+ [('is_split','=',True)]
+
+
+
+
+ yuthon.property.tree
+ yuthon.property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ yuthon.property.form
+ yuthon.property
+
+
+
+
+
+ 物业
+ yuthon.property
+ tree,form
+ ir.actions.act_window
+ [('is_merge','=',True)]
+
+
\ No newline at end of file
diff --git a/yuthon_property_approval/__manifest__.py b/yuthon_property_approval/__manifest__.py
index ba737b579..5b33f7382 100644
--- a/yuthon_property_approval/__manifest__.py
+++ b/yuthon_property_approval/__manifest__.py
@@ -45,6 +45,8 @@
'views/property_record_views.xml',
'views/property_equity_views.xml',
'views/property_handover_views.xml',
+ 'views/property_merge_approval_views.xml',
+ 'views/property_split_approval_views.xml',
'views/property_evaluate_application_views.xml',
'wizard/property_inducts_wizard.xml',
'views/property_menu_all.xml',
diff --git a/yuthon_property_approval/data/sale_renting_code_data.xml b/yuthon_property_approval/data/sale_renting_code_data.xml
index 9201d44b4..84abdbb17 100644
--- a/yuthon_property_approval/data/sale_renting_code_data.xml
+++ b/yuthon_property_approval/data/sale_renting_code_data.xml
@@ -231,4 +231,14 @@
property_rental_conditions_code
CT%(y)s%(month)s%(day)s
+
+ 合并申报编号
+ property_merge_approval_code
+ HB%(y)s%(month)s%(day)s
+
+
+ 拆分申报编号
+ property_split_approval_code
+ CF%(y)s%(month)s%(day)s
+
\ No newline at end of file
diff --git a/yuthon_property_approval/models/__init__.py b/yuthon_property_approval/models/__init__.py
index ab20c7953..beb43d9ba 100644
--- a/yuthon_property_approval/models/__init__.py
+++ b/yuthon_property_approval/models/__init__.py
@@ -33,4 +33,6 @@ from . import property_approval
from . import property_handover
from . import property_offline_registration
from . import property_rental_form
-from . import property_rental_conditions
\ No newline at end of file
+from . import property_rental_conditions
+from . import property_merge_approval
+from . import property_split_approval
\ No newline at end of file
diff --git a/yuthon_property_approval/models/property_merge_approval.py b/yuthon_property_approval/models/property_merge_approval.py
new file mode 100644
index 000000000..cc539f25c
--- /dev/null
+++ b/yuthon_property_approval/models/property_merge_approval.py
@@ -0,0 +1,71 @@
+from odoo import models, fields, api, exceptions, _
+
+
+class PropertyMergeApproval(models.Model):
+ _name = 'property.merge.approval'
+ _inherit = 'soong.workflow.mixin'
+ _description = '物业合并审批'
+
+ name = fields.Char(string='标题')
+ reason = fields.Html(string="正文")
+ notice_documents_ids = fields.Many2many('ir.attachment', string="附件")
+ code = fields.Char(string="编号",
+ default=lambda self: self.env['ir.sequence'].next_by_code('property_merge_approval_code'))
+ property_merge_approval_line_ids = fields.One2many('property.merge.approval.line', 'property_merge_approval_id', string='关联物业合并审批行')
+ # 合并后
+ property_name = fields.Char(string='物业名称')
+ merge_units = fields.Char(string='单元')
+ merge_property_floor = fields.Char(string='楼层')
+ merge_asset_type_id = fields.Many2one('yuthon.resource.type', string='资产类型')
+ merge_building_area = fields.Float(string='建筑面积')
+ merge_rent_area = fields.Float(string='可租面积')
+ merge_remarks = fields.Char(string='备注')
+ is_issues = fields.Boolean(string='是否上会')
+ related_issues_id = fields.Many2one('issue.library', string="关联议题")
+
+ @api.onchange('property_merge_approval_line_ids')
+ def _onchange_property_merge_approval_line_ids(self):
+ name = []
+ merge_building_area = 0
+ merge_rent_area = 0
+ for property_margin in self.property_merge_approval_line_ids:
+ name.append(property_margin.property_id.name)
+ merge_building_area += property_margin.building_area
+ merge_rent_area += property_margin.rent_area
+ self.property_name = ','.join(name)
+ self.merge_building_area = merge_building_area
+ self.merge_rent_area = merge_rent_area
+
+
+ def put_merge_message(self):
+ property_list = []
+ property_id = self.env['yuthon.property'].create({
+ 'name': self.property_name,
+ 'building_area': self.merge_building_area,
+ 'rentable_area': self.merge_rent_area,
+ 'asset_type_id': self.merge_asset_type_id.id,
+ 'is_done_split':True,
+ })
+ for record in self.property_merge_approval_line_ids:
+ record.property_id.write({'is_done_merge': True})
+ record.property_id.property_merge_approval_id = property_id.id
+ property_list.append([0, 0, {
+ 'yuthon_property_id':property_id.id,
+ 'property_id': record.property_id.id}])
+ property_id.write({'disassembly_information_ids': property_list})
+
+
+class PropertyMergeApprovalLine(models.Model):
+ _name = 'property.merge.approval.line'
+ _description = '物业合并明细行'
+
+ property_merge_approval_id = fields.Many2one('property.merge.approval', string='关联物业合并审批')
+ property_id = fields.Many2one('yuthon.property', string='物业名称')
+ units = fields.Char(related='property_id.units', string='单元')
+ property_floor = fields.Integer(related='property_id.property_floor', string='楼层')
+ asset_type_id = fields.Many2one(related='property_id.asset_type_id', string='资产类型')
+ building_area = fields.Float(related='property_id.building_area', string='建筑面积')
+ rent_area = fields.Float(related='property_id.rentable_area', string='可租面积')
+ remarks = fields.Char(string='备注')
+
+
diff --git a/yuthon_property_approval/models/property_split_approval.py b/yuthon_property_approval/models/property_split_approval.py
new file mode 100644
index 000000000..5da47a667
--- /dev/null
+++ b/yuthon_property_approval/models/property_split_approval.py
@@ -0,0 +1,69 @@
+from odoo import models, fields, api, exceptions, _
+
+
+class PropertySplitApproval(models.Model):
+ _name = 'property.split.approval'
+ _inherit = 'soong.workflow.mixin'
+ _description = '物业拆分审批'
+
+ code = fields.Char(string="编号",
+ default=lambda self: self.env['ir.sequence'].next_by_code('property_split_approval_code'))
+ property_id = fields.Many2one('yuthon.property', string='物业名称')
+ units = fields.Char(related='property_id.units', string='单元')
+ property_floor = fields.Integer(related='property_id.property_floor', string='楼层')
+ asset_type_id = fields.Many2one(related='property_id.asset_type_id', string='资产类型')
+ building_area = fields.Float(related='property_id.building_area', string='建筑面积')
+ rent_area = fields.Float(related='property_id.rentable_area', string='可租面积')
+ remarks = fields.Char(string='备注')
+ is_issues = fields.Boolean(string='是否上会')
+ related_issues_id = fields.Many2one('issue.library', string="关联议题")
+ name = fields.Char(string='标题')
+ reason = fields.Html(string="正文")
+ notice_documents_ids = fields.Many2many('ir.attachment', string="附件")
+ property_split_approval_line_ids = fields.One2many('property.split.approval.line', 'property_split_approval_id', string='关联物业拆分明细行')
+ split_quantity = fields.Integer(string='拆分数量')
+
+ #自由拆分
+ def put_free_splitting(self):
+ for i in range(self.split_quantity):
+ self.env['property.split.approval.line'].create({
+ 'property_split_approval_id': self.id,
+ 'split_property':self.property_id.name + '-'+str(i+1)})
+
+ #平均拆分
+ def put_evaluation_splitting(self):
+ for i in range(self.split_quantity):
+ self.env['property.split.approval.line'].create({
+ 'property_split_approval_id': self.id,
+ 'split_property': self.property_id.name + '-' + str(i + 1),
+ 'split_building_area': self.property_id.building_area/self.split_quantity,
+ 'split_rent_area': self.property_id.rent_area/self.split_quantity})
+
+ def put_split_message(self):
+ property_list = []
+ for i in self.property_split_approval_line_ids:
+ property_id = self.env['yuthon.property'].create({
+ 'name': i.split_property,
+ 'building_area': i.split_building_area,
+ 'rentable_area': i.split_rent_area,
+ 'asset_type_id': i.split_asset_type_id.id,
+ 'property_merge_approval_id':self.property_id.id,
+ 'is_done_merge': True
+ })
+ property_list.append([0, 0, {'property_id':property_id.id}])
+ self.property_id.write({'is_done_split': True})
+ self.property_id.disassembly_information_ids = property_list
+
+class PropertySplitApprovalLine(models.Model):
+ _name = 'property.split.approval.line'
+ _description = '物业拆分明细行'
+
+ property_split_approval_id = fields.Many2one('property.split.approval', string='关联物业拆分审批')
+ split_property = fields.Char(string='物业名称')
+ split_units = fields.Char(string='单元')
+ split_property_floor = fields.Char(string='楼层')
+ split_asset_type_id = fields.Many2one('yuthon.resource.type', string='资产类型')
+ split_building_area = fields.Float(string='建筑面积')
+ split_rent_area = fields.Float(string='可租面积')
+ split_remarks = fields.Char(string='备注')
+
diff --git a/yuthon_property_approval/security/ir.model.access.csv b/yuthon_property_approval/security/ir.model.access.csv
index ede9779d7..9ad8328e7 100644
--- a/yuthon_property_approval/security/ir.model.access.csv
+++ b/yuthon_property_approval/security/ir.model.access.csv
@@ -51,4 +51,8 @@ access_now_rental_conditions_line,now_rental_conditions_line,model_now_rental_co
access_property_rental_conditions,property_rental_conditions,model_property_rental_conditions,base.group_user,1,1,1,1
access_rental_adjustment_line,rental_adjustment_line,model_rental_adjustment_line,base.group_user,1,1,1,1
access_evaluated_application_line,evaluated_application_line,model_evaluated_application_line,base.group_user,1,1,1,1
-access_property_rental_form_line,property_rental_form_line,model_property_rental_form_line,base.group_user,1,1,1,1
\ No newline at end of file
+access_property_rental_form_line,property_rental_form_line,model_property_rental_form_line,base.group_user,1,1,1,1
+access_property_merge_approval,property_merge_approval,model_property_merge_approval,base.group_user,1,1,1,1
+access_property_merge_approval_line,property_merge_approval_line,model_property_merge_approval_line,base.group_user,1,1,1,1
+access_property_split_approval,property_split_approval,model_property_split_approval,base.group_user,1,1,1,1
+access_property_split_approval_line,property_split_approval_line,model_property_split_approval_line,base.group_user,1,1,1,1
\ No newline at end of file
diff --git a/yuthon_property_approval/views/property_menu_all.xml b/yuthon_property_approval/views/property_menu_all.xml
index 34c392225..25234c4f8 100644
--- a/yuthon_property_approval/views/property_menu_all.xml
+++ b/yuthon_property_approval/views/property_menu_all.xml
@@ -173,7 +173,18 @@
name="物业移交审批"
action="property_handover_action"
sequence="7"/>
-
+
+