1
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
'depends': ['base', 'web', 'yuthon_property'],
|
||||
'data': [
|
||||
'views/menu.xml',
|
||||
'views/yuthon_report_property.xml',
|
||||
'views/ledger_report_views.xml',
|
||||
'views/receivable_report_views.xml',
|
||||
'views/yuthon_report_res_partner.xml',
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import res_partner
|
||||
from . import report_property
|
||||
from . import ledger_report
|
||||
from . import receivable_report
|
||||
@@ -1,42 +0,0 @@
|
||||
from odoo import fields, models, api
|
||||
|
||||
|
||||
class YuthonProperty(models.Model):
|
||||
_inherit = 'yuthon.property'
|
||||
|
||||
@api.model
|
||||
def get_report_data(self, params):
|
||||
domain = []
|
||||
if params.get("keyword"):
|
||||
keyword = params["keyword"]
|
||||
# 获取权属类型的存储值与显示值映射(如:{'self': '自有', 'agency': '代管'})
|
||||
tenure_type_selection = self._fields['tenure_type']._description_selection(self.env)
|
||||
matched_tenure_values = [
|
||||
key for key, label in tenure_type_selection
|
||||
if keyword in label # 匹配中文显示值
|
||||
]
|
||||
conditions = [
|
||||
("name", "ilike", keyword),
|
||||
("company_id.name", "ilike", keyword),
|
||||
("admin_id.name", "ilike", keyword)
|
||||
]
|
||||
|
||||
if matched_tenure_values:
|
||||
conditions.append(("tenure_type", "in", matched_tenure_values))
|
||||
else:
|
||||
conditions.append(("tenure_type", "ilike", keyword))
|
||||
domain += ["|"] * (len(conditions) - 1) + conditions
|
||||
properties = self.search(domain, limit=100)
|
||||
# 构造返回数据列表
|
||||
return [
|
||||
{
|
||||
"资产名称": p.name or "",
|
||||
"管理面积": p.management_area or 0.0,
|
||||
"可租面积": p.rent_area or 0.0,
|
||||
"产权面积": p.equity_area or 0.0,
|
||||
"产权证号": p.title_deed or "",
|
||||
"产权地址": p.title_address.name or "" if p.title_address else "",
|
||||
"资产目前状态": dict(self._fields['property_state']._description_selection(self.env))[p.property_state]
|
||||
}
|
||||
for p in properties
|
||||
]
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="action_property_report" model="ir.actions.client">
|
||||
<field name="name">资产报表</field>
|
||||
<field name="tag">youthon_report_client</field>
|
||||
<field name="context">
|
||||
{
|
||||
"sideBar": true,
|
||||
"report_config": {
|
||||
"model": "yuthon.property",
|
||||
"method": "get_report_data",
|
||||
"search_fields": [
|
||||
{"name": "keyword", "type": "char", "label": "资产名称关键字"},
|
||||
{"name": "property_state", "type": "selection", "label": "资产状态",
|
||||
"selection": [
|
||||
('to', '待评估'), ('done', '已评估'), ('ing', '评估中'),
|
||||
('ing_handover', '移交中'), ('done_handover', '已移交'),
|
||||
('filing', '备案中'), ('net', '挂网'), ('signing', '签约中'),
|
||||
('signed', '已备案'), ('leased', '已租'), ('idle', '空置'),
|
||||
('no_lease', '不可租'), ('leasing', '在租'), ('self', '自用')
|
||||
]}
|
||||
],
|
||||
"columns": [
|
||||
{"headerName": "资产名称", "field": "资产名称", "flex": 1},
|
||||
{"headerName": "管理面积", "field": "管理面积", "flex": 1},
|
||||
{"headerName": "可租面积", "field": "可租面积", "flex": 1},
|
||||
{"headerName": "产权面积", "field": "产权面积", "flex": 1},
|
||||
{"headerName": "产权证号", "field": "产权证号", "flex": 1},
|
||||
{"headerName": "产权地址", "field": "产权地址", "flex": 1},
|
||||
{"headerName": "资产目前状态", "field": "资产目前状态", "flex": 1}
|
||||
]
|
||||
}
|
||||
}
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_property_report"
|
||||
name="资产报表"
|
||||
parent="yuthon_property_approval.property_approval_report_menu"
|
||||
action="action_property_report"
|
||||
sequence="5"
|
||||
/>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user