添加功能

This commit is contained in:
李鹏宇
2025-09-27 17:28:48 +08:00
parent 23f1deb318
commit 3e19edcb43
25 changed files with 838 additions and 67 deletions
@@ -35,17 +35,26 @@ class PropertyMeterArchives(models.Model):
def update_epitope_values(self):
meter_ids = self.env["property.meter.archives"].browse(
self._context.get('active_ids', self._context.get('active_id')))
self._context.get('active_ids', self._context.get('active_id'))
)
for meter in meter_ids:
if meter.epitope_values:
epitope_id = self.env['yuthon.epitope.values'].search([('name', '=', meter.epitope_values)])
if not epitope_id:
epitope_id = self.env['yuthon.epitope.values'].create({'name': meter.epitope_values,
'type': 'ammeter'
})
meter.epitope_values_id = epitope_id.id
for line in meter.line_ids:
line.epitope_values_id = epitope_id.id
for property in meter.yuthon_property_ids:
existing_energy = self.env['yuthon.property.energy'].search([
('yuthon_property_id', '=', property.id),
('property_meter_archives_id', '=', meter.id)
], limit=1)
if not existing_energy:
self.env['yuthon.property.energy'].create({
'property_meter_archives_id': meter.id,
'yuthon_property_id': property.id,
})
invalid_energy = self.env['yuthon.property.energy'].search([
('yuthon_property_id', '=', property.id),
('property_meter_archives_id', '=', False)
])
if invalid_energy:
invalid_energy.unlink()
@api.onchange('name')
def _onchange_line_ids(self):
+22 -4
View File
@@ -170,10 +170,28 @@ class MeterWaterLine(models.Model):
1 + record.line_loss) * record.gauge_magnification
def update_meter(self):
insurances_ids = self.env["meter.water.line"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for line in insurances_ids:
line.compute_meter_values()
meter_ids = self.env["property.meter.water"].browse(
self._context.get('active_ids', self._context.get('active_id'))
)
for meter in meter_ids:
for property in meter.yuthon_property_ids:
existing_water = self.env['yuthon.property.water'].search([
('yuthon_property_id', '=', property.id),
('property_meter_water_id', '=', meter.id)
], limit=1)
if not existing_water:
self.env['yuthon.property.water'].create({
'property_meter_water_id': meter.id,
'yuthon_property_id': property.id,
})
invalid_water = self.env['yuthon.property.water'].search([
('yuthon_property_id', '=', property.id),
('property_meter_water_id', '=', False)
])
if invalid_water:
invalid_water.unlink()
@api.depends('current_read', 'last_read', 'meter_date', 'maximum_count', 'water_id')
def compute_meter_values(self):
@@ -9,7 +9,7 @@
<field name="start_time" />
<field name="name_account" />
<field name="original_amount"/>
<field name="yes_amount" />
<field name="yes_amount" string="已对账"/>
<field name="no_amount"/>
<field name="property_ids" widget="many2many_tags"/>
<field name="bank_state" />
+2
View File
@@ -13,6 +13,8 @@
'security/ir.model.access.csv',
'report/lease_contract_report.xml',
'report/lease_contract_templates.xml',
'report/property_accounting_templates.xml',
'report/property_construction_templates.xml',
'views/property_billing_confirmation.xml',
'views/inherit_property_tenant_information_views.xml',
'views/property_approval_views.xml',
@@ -382,6 +382,8 @@ class PropertyAccountsReceivable(models.Model):
precinct_id = fields.Many2one(related='contract_id.precinct_id', string="所属片区", store=True)
penalty = fields.Float(string="违约金基数")
penalty_date = fields.Date(string="违约金日期")
invoice_type = fields.Selection(
[('ordinary_invoice', '普通发票'), ('vat_invoice', '增值税发票')], string='发票类型', default='ordinary_invoice')
# 报表新增字段
rent_owed = fields.Float(string="欠租金额")
per_day = fields.Float(string="每天违约金(元/天)")
@@ -251,6 +251,10 @@ class PropertyLeaseContract(models.Model):
contract_count = fields.Integer(string="联系人数量", compute='_compute_contract_count')
reconciliation_count = fields.Integer(string="对账数量", compute='_compute_reconciliation_count')
process_count = fields.Integer(string="流程数量", compute='_compute_process_count')
def _get_default_name_title(self):
return self._description if self._description else self._name
name_title = fields.Char(default=_get_default_name_title)
@api.depends('lease_ids.address_id.title_deed')
def _compute_title_information(self):
@@ -12,4 +12,26 @@
<field name="binding_type">report</field>
</record>
</data>
<data>
<record id="action_property_accounting_approval_report" model="ir.actions.report">
<field name="name">建设工程委托监理合同报表</field>
<field name="model">property.accounting.approval</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">yuthon_property_approval.report_property_accounting_approval</field>
<field name="report_file">yuthon_property_approval.report_property_accounting_approval</field>
<field name="print_report_name">建设工程委托监理合同报表</field>
<field name="binding_model_id" ref="model_property_accounting_approval"/>
<field name="binding_type">report</field>
</record>
</data>
<record id="action_property_construction_approval_report" model="ir.actions.report">
<field name="name">建设工程造价咨询合同报表</field>
<field name="model">property.construction.approval</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">yuthon_property_approval.report_property_construction_approval</field>
<field name="report_file">yuthon_property_approval.report_property_construction_approval</field>
<field name="print_report_name">建设工程造价咨询合同报表</field>
<field name="binding_model_id" ref="model_property_construction_approval"/>
<field name="binding_type">report</field>
</record>
</odoo>
@@ -0,0 +1,212 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_property_accounting_approval">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<style type="text/css">
td {
border:1px solid #000000;
padding:8px;
}
.title {
text-align:center;
font-weight:bold;
font-size:16px;
margin:15px 0;
}
.main-title {
font-weight:bold;
font-size:18px;
text-align:center;
margin:20px 0;
}
table {
border-collapse: collapse;
}
.approval-table td {
border:1px solid #000000 !important;
}
</style>
<div class="main-title">建设工程委托监理合同审批</div>
<!-- 基本信息 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>合同编号:</strong></td>
<td width="35%"><span t-field="o.name"/></td>
<td width="15%"><strong>流水号:</strong></td>
<td width="35%"><span t-field="o.code"/></td>
</tr>
</table>
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>申请人:</strong></td>
<td width="35%"><span t-field="o.users_id.name"/></td>
<td width="15%"><strong>部门:</strong></td>
<td width="35%"><span t-field="o.department_id.name"/></td>
</tr>
</table>
<!-- 合同双方信息 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>甲方:</strong></td>
<td width="35%">
<span t-if="o.company_a_id"><span t-field="o.company_a_id.name"/></span>
<span t-if="not o.company_a_id">无</span>
</td>
<td width="15%"><strong>乙方:</strong></td>
<td width="35%">
<span t-if="o.company_b_id"><span t-field="o.company_b_id.name"/></span>
<span t-if="not o.company_b_id">无</span>
</td>
</tr>
</table>
<!-- 项目信息 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>物业地址:</strong></td>
<td width="35%"><span t-field="o.property_address"/></td>
<td width="15%"><strong>业务类型:</strong></td>
<td width="35%"><span t-field="o.business_type"/></td>
</tr>
</table>
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>工程内容:</strong></td>
<td width="35%"><span t-field="o.project_content"/></td>
<td width="15%"><strong>合同金额:</strong></td>
<td width="35%"><span t-field="o.contract_amount"/></td>
</tr>
</table>
<!-- 日期信息 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>开始日期:</strong></td>
<td width="35%"><span t-field="o.start_date"/></td>
<td width="15%"><strong>结束日期:</strong></td>
<td width="35%"><span t-field="o.end_date"/></td>
</tr>
</table>
<!-- 付款信息 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>付款方式:</strong></td>
<td width="35%">
<span t-if="o.payment_methods == 'onetime'">一次性</span>
<span t-if="o.payment_methods == 'installment'">分期</span>
</td>
<td width="15%"><strong>合同附件:</strong></td>
<td width="35%">
<span t-if="o.contract_id"><a t-att-href="'/web/content/' + str(o.contract_id.id)" target="_blank">查看合同</a></span>
<span t-if="not o.contract_id">无</span>
</td>
</tr>
</table>
<!-- 预算清单 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>预算清单:</strong></td>
<td width="85%">
<span t-if="o.budget_list_id"><a t-att-href="'/web/content/' + str(o.budget_list_id.id)" target="_blank">查看预算清单</a></span>
<span t-if="not o.budget_list_id">无</span>
</td>
</tr>
</table>
<!-- 正文 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>正文:</strong></td>
<td width="85%"><span t-field="o.reason"/></td>
</tr>
</table>
<!-- 维修前图片 -->
<t t-if="o.image">
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>维修前图片:</strong></td>
<td width="85%">
<img t-att-src="'data:image/png;base64,' + o.image" style="max-width:300px;max-height:300px;"/>
</td>
</tr>
</table>
</t>
<!-- 支付方式明细行 -->
<t t-if="o.accounting_way_ids">
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="100%" class="section-title" style="text-align:center;">支付方式明细</td>
</tr>
</table>
<table width="100%" style="table-layout:fixed;" class="approval-table">
<thead>
<tr>
<td width="15%"><strong>支付节点</strong></td>
<td width="15%"><strong>支付比例</strong></td>
<td width="15%"><strong>金额</strong></td>
<td width="25%"><strong>备注</strong></td>
<td width="30%"><strong>支付说明</strong></td>
</tr>
</thead>
<tbody>
<t t-foreach="o.accounting_way_ids" t-as="line">
<tr>
<td>
<span t-if="line.payment_nodes == 'first'">一期</span>
<span t-if="line.payment_nodes == 'second'">二期</span>
<span t-if="line.payment_nodes == 'third'">三期</span>
<span t-if="line.payment_nodes == 'fourth'">四期</span>
</td>
<td><span t-field="line.payout_ratio"/><span>%</span></td>
<td><span t-field="line.amount"/></td>
<td><span t-field="line.remake"/></td>
<td><span t-field="line.payment_instructions"/></td>
</tr>
</t>
</tbody>
</table>
</t>
<!-- 审批明细 -->
<t t-if="o.log_ids">
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="100%" class="section-title" style="text-align:center;">审批明细</td>
</tr>
</table>
<table width="100%" style="table-layout:fixed;" class="approval-table">
<thead>
<tr>
<td width="20%"><strong>节点</strong></td>
<td width="30%"><strong>意见</strong></td>
<td width="20%"><strong>审批人</strong></td>
<td width="30%"><strong>操作时间</strong></td>
</tr>
</thead>
<tbody>
<t t-foreach="o.log_ids" t-as="log">
<tr>
<td><span t-field="log.name"/></td>
<td><span t-field="log.comment"/></td>
<td><span t-field="log.done_by"/></td>
<td><span t-field="log.date_create"/></td>
</tr>
</t>
</tbody>
</table>
</t>
</t>
</t>
</t>
</template>
</odoo>
@@ -0,0 +1,258 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_property_construction_approval">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<style type="text/css">
td {
border:1px solid #000000;
padding:8px;
}
.title {
text-align:center;
font-weight:bold;
font-size:16px;
margin:15px 0;
}
.main-title {
font-weight:bold;
font-size:18px;
text-align:center;
margin:20px 0;
}
table {
border-collapse: collapse;
}
.approval-table td {
border:1px solid #000000 !important;
}
</style>
<div class="main-title"><span t-field="o.name_title"/></div>
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>标题:</strong></td>
<td width="35%">
<span t-if="o.name"><span t-field="o.name"/></span>
<span t-if="not o.name">未设置标题</span>
</td>
<td width="15%"><strong>编号:</strong></td>
<td width="35%">
<span t-if="o.code"><span t-field="o.code"/></span>
<span t-if="not o.code">未生成编号</span>
</td>
</tr>
</table>
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>申请人:</strong></td>
<td width="35%">
<span t-if="o.user_id"><span t-field="o.user_id.name"/></span>
<span t-if="not o.user_id">未设置申请人</span>
</td>
<td width="15%"><strong>部门:</strong></td>
<td width="35%">
<span t-if="o.department_id"><span t-field="o.department_id.name"/></span>
<span t-if="not o.department_id">未关联部门</span>
</td>
</tr>
</table>
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>公司:</strong></td>
<td width="35%">
<span t-if="o.company_id"><span t-field="o.company_id.name"/></span>
<span t-if="not o.company_id">未关联公司</span>
</td>
<td width="15%"><strong>业务类型:</strong></td>
<td width="35%">
<span t-if="o.business_type"><span t-field="o.business_type"/></span>
<span t-if="not o.business_type">未设置</span>
</td>
</tr>
</table>
<!-- 合同双方信息 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>甲方:</strong></td>
<td width="35%">
<span t-if="o.company_a_id"><span t-field="o.company_a_id.name"/></span>
<span t-if="not o.company_a_id">未设置</span>
</td>
<td width="15%"><strong>乙方:</strong></td>
<td width="35%">
<span t-if="o.company_b_id"><span t-field="o.company_b_id.name"/></span>
<span t-if="not o.company_b_id">未设置</span>
</td>
</tr>
</table>
<!-- 项目信息 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>工程内容:</strong></td>
<td width="35%">
<span t-if="o.project_content"><span t-field="o.project_content"/></span>
<span t-if="not o.project_content">未填写</span>
</td>
<td width="15%"><strong>物业地址:</strong></td>
<td width="35%">
<span t-if="o.property_address"><span t-field="o.property_address"/></span>
<span t-if="not o.property_address">未填写</span>
</td>
</tr>
</table>
<!-- 时间信息 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>代理开始日期:</strong></td>
<td width="35%">
<span t-if="o.start_date"><span t-field="o.start_date"/></span>
<span t-if="not o.start_date">未设置</span>
</td>
<td width="15%"><strong>代理结束日期:</strong></td>
<td width="35%">
<span t-if="o.end_date"><span t-field="o.end_date"/></span>
<span t-if="not o.end_date">未设置</span>
</td>
</tr>
</table>
<!-- 金额与付款信息 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>合同金额:</strong></td>
<td width="35%">
<span t-if="o.contract_amount"><span t-field="o.contract_amount"/></span>
<span t-if="not o.contract_amount">0.00</span>
</td>
<td width="15%"><strong>付款方式:</strong></td>
<td width="35%">
<span t-if="o.payment_methods == 'onetime'">一次性</span>
<span t-if="o.payment_methods == 'installment'">分期</span>
<span t-if="not o.payment_methods">未设置</span>
</td>
</tr>
</table>
<!-- 附件信息 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>合同附件:</strong></td>
<td width="35%">
<span t-if="o.contract_id"><a t-att-href="'/web/content/' + str(o.contract_id.id)" target="_blank">查看合同</a></span>
<span t-if="not o.contract_id">无</span>
</td>
<td width="15%"><strong>预算清单:</strong></td>
<td width="35%">
<span t-if="o.budget_list_id"><a t-att-href="'/web/content/' + str(o.budget_list_id.id)" target="_blank">查看预算清单</a></span>
<span t-if="not o.budget_list_id">无</span>
</td>
</tr>
</table>
<!-- 正文内容 -->
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>正文:</strong></td>
<td width="85%">
<span t-if="o.reason"><span t-field="o.reason"/></span>
<span t-if="not o.reason">无内容</span>
</td>
</tr>
</table>
<!-- 开工前图片 -->
<t t-if="o.image">
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="15%"><strong>开工前图片:</strong></td>
<td width="85%" class="img-container">
<img t-att-src="'data:image/png;base64,' + o.image"/>
</td>
</tr>
</table>
</t>
<!-- 支付方式明细 -->
<t t-if="o.construction_way_ids">
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="100%" class="section-title">支付方式明细</td>
</tr>
</table>
<table width="100%" style="table-layout:fixed;" class="approval-table">
<thead>
<tr>
<td width="15%"><strong>支付节点</strong></td>
<td width="10%"><strong>支付比例</strong></td>
<td width="15%"><strong>应付日期</strong></td>
<td width="15%"><strong>金额</strong></td>
<td width="20%"><strong>备注</strong></td>
<td width="25%"><strong>支付说明</strong></td>
</tr>
</thead>
<tbody>
<t t-foreach="o.construction_way_ids" t-as="line">
<tr>
<td>
<span t-if="line.payment_nodes == 'first'">一期</span>
<span t-if="line.payment_nodes == 'second'">二期</span>
<span t-if="line.payment_nodes == 'third'">三期</span>
<span t-if="line.payment_nodes == 'fourth'">四期</span>
</td>
<td>
<span t-if="line.payout_ratio"><span t-field="line.payout_ratio"/><span>%</span></span>
<span t-if="not line.payout_ratio">0%</span>
</td>
<td><span t-field="line.coping_date"/></td>
<td><span t-field="line.amount"/></td>
<td><span t-field="line.remake"/></td>
<td><span t-field="line.payment_instructions"/></td>
</tr>
</t>
</tbody>
</table>
</t>
<!-- 审批明细 -->
<t t-if="o.log_ids">
<table width="100%" style="table-layout:fixed;">
<tr>
<td width="100%" class="section-title">审批明细</td>
</tr>
</table>
<table width="100%" style="table-layout:fixed;" class="approval-table">
<thead>
<tr>
<td width="20%"><strong>节点</strong></td>
<td width="30%"><strong>意见</strong></td>
<td width="20%"><strong>审批人</strong></td>
<td width="30%"><strong>操作时间</strong></td>
</tr>
</thead>
<tbody>
<t t-foreach="o.log_ids" t-as="log">
<tr>
<td><span t-field="log.name"/></td>
<td><span t-field="log.comment"/></td>
<td><span t-field="log.done_by"/></td>
<td><span t-field="log.date_create"/></td>
</tr>
</t>
</tbody>
</table>
</t>
</t>
</t>
</t>
</template>
</odoo>
@@ -54,7 +54,8 @@
<field name="work_end" invisible="1"/>
<field name="users_id"/>
<field name="property_address"/>
<notebook>
</group>
<notebook>
<page string="物业信息">
<button name="build_pop" string="添加物业" type="object"
class="btn-primary"/>
@@ -68,8 +69,7 @@
</tree>
</field>
</page>
</notebook>
</group>
</notebook>
<group>
<field name="reason"/>
<field name="image"/>
@@ -50,7 +50,7 @@
</group>
<div class="col-12 text-center">
<h1>
<field name="name" readonly="0"/>
<field name="name_title" readonly="1"/>
</h1>
</div>
<group col="3" string="基本信息">
@@ -70,6 +70,7 @@
</group>
<group>
<group>
<field name="name" invisible="1"/>
<field name="state" invisible="1"/>
<field name="work_end" invisible="1"/>
<field name="rent_company" string="出租方" readonly="1"/>
@@ -395,18 +395,7 @@
name="应收账单"
action="property_accounts_receivable_action"
sequence="1"/>
<menuitem
id="property_asset_information_report_menu"
parent="property_approval_report_menu"
name="资产信息"
action="yuthon_property.yuthon_property_action"
sequence="5"/>
<menuitem
id="yuthon_property_ledger_views_menu"
parent="property_approval_report_menu"
name="台账"
action="view_property_ledger_action"
sequence="10"/>
<menuitem
id="property_lessee_analysis_viwes_menu"
parent="property_approval_report_menu"
+1
View File
@@ -11,6 +11,7 @@
'views/menu.xml',
'views/yuthon_report_property.xml',
'views/ledger_report_views.xml',
'views/receivable_report_views.xml',
'views/yuthon_report_res_partner.xml',
],
'installable': True,
+2 -1
View File
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from . import res_partner
from . import report_property
from . import ledger_report
from . import ledger_report
from . import receivable_report
+5 -15
View File
@@ -11,21 +11,11 @@ class YuthonProperty(models.Model):
domain.append(
domain.append(("name", "ilike", params["keyword"]))
)
# 资产状态筛选
if params.get("property_state"):
domain.append(("property_state", "=", params["property_state"]))
# 片区管理员筛选
if params.get("admin_id"):
domain.append(("admin_id", "=", params["admin_id"]))
# 出租单位筛选
if params.get("lessor_id"):
domain.append(("property_contract_ids.lease_contract_id.lessor_id", "=", params["lessor_id"]))
# 承租方筛选
if params.get("lessee_id"):
domain.append(("lessee_id", "=", params["lessee_id"]))
# 出租用途筛选
if params.get("rental_purposes"):
domain.append(("property_contract_ids.lease_contract_id.rental_purposes", "=", params["rental_purposes"]))
if params.get("date_start"):
domain.append(("actual_start_time", ">=", params.get("date_start")))
if params.get("date_end"):
domain.append(("actual_end_time", "<=", params.get("date_end")))
# 查询数据,限制100条
properties = self.search(domain, limit=100)
+49
View File
@@ -0,0 +1,49 @@
from odoo import fields, models, api
class YuthonProperty(models.Model):
_inherit = 'property.accounts.receivable'
@api.model
def get_complete_ledger_report(self, params):
domain = []
if params.get("keyword"):
keyword = params["keyword"]
domain += [
'|', '|',
('lessee_id.name', 'ilike', keyword),
('property_name', 'ilike', keyword),
('title_deed', 'ilike', keyword)
]
if params.get("date_start"):
domain.append(("due_date_end", ">=", params.get("date_start")))
if params.get("date_end"):
domain.append(("due_date", "<=", params.get("date_end")))
# # 6. 排除无效账单(作废/红冲)
# domain += [
# ("is_invalid", "=", False),
# ("is_red", "=", False)
# ]
receivables = self.search(domain, limit=1000)
management_type_map = dict(
self.env['yuthon.management.type'].search([]).mapped(lambda r: (r.id, r.name))
)
invoice_type_map = dict(
self._fields['invoice_type']._description_selection(self.env)
)
return [
{
"应收类型": management_type_map.get(rec.management_type_id.id, "") if rec.management_type_id else "",
"应收开始": rec.due_date.strftime("%Y-%m-%d") if rec.due_date else "",
"应收结束": rec.due_date_end.strftime("%Y-%m-%d") if rec.due_date_end else "",
"承租方": rec.lessee_id.name or "" if rec.lessee_id else "",
"当期金额": rec.original_amount or 0.0,
"物业名称": rec.property_name or "",
"产权证号": rec.title_deed or "",
"发票类型": invoice_type_map.get(rec.invoice_type, ""),
"税率": f"{rec.tax}%" if rec.tax else "0%"
}
for rec in receivables
]
+4 -4
View File
@@ -10,11 +10,11 @@ class YuthonProperty(models.Model):
# 支持按关键词搜索资产名称
if params.get("keyword"):
domain.append(("name", "ilike", params["keyword"]))
# 支持按资产状态筛选
if params.get("property_state"):
domain.append(("property_state", "=", params["property_state"]))
properties = self.search(domain, limit=100)
if params.get("date_start"):
domain.append(("actual_start_time", ">=", params.get("date_start")))
if params.get("date_end"):
domain.append(("actual_end_time", "<=", params.get("date_end")))
# 构造返回数据列表
return [
{
+2 -2
View File
@@ -61,9 +61,9 @@
<menuitem id="menu_ledger_report"
name="台账"
parent="yuthon_report_root"
parent="yuthon_property_approval.property_approval_report_menu"
action="action_ledger_report"
sequence="180"
sequence="10"
/>
</data>
</odoo>
+6 -6
View File
@@ -2,12 +2,12 @@
<odoo>
<data>
<menuitem
name="报表"
id="yuthon_report_root"
web_icon="yuthon_report,static/description/icon.png"
sequence="125"
/>
<!-- <menuitem-->
<!-- name="报表"-->
<!-- id="yuthon_report_root"-->
<!-- web_icon="yuthon_report,static/description/icon.png"-->
<!-- sequence="125"-->
<!-- />-->
</data>
</odoo>
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="action_property_accounts_receivable_report" model="ir.actions.client">
<field name="name">应收账单报表</field>
<field name="tag">youthon_report_client</field>
<field name="context">
{
"sideBar": true,
"report_config": {
"model": "property.accounts.receivable",
"method": "get_complete_ledger_report",
"search_fields": [
{
"name": "keyword",
"type": "char",
"label": "关键词搜索(承租方/物业/产权证号)"
},
{
"name": "management_type_id",
"type": "many2one",
"label": "应收类型",
"model": "yuthon.management.type"
},
{
"name": "invoice_type",
"type": "selection",
"label": "发票类型",
"selection": [
('ordinary_invoice', '普通发票'),
('vat_invoice', '增值税发票')
]
},
{
"name": "date_range",
"type": "date_range",
"label": "应收日期范围"
}
],
"columns": [
{"headerName": "应收类型", "field": "应收类型", "flex": 1},
{"headerName": "应收开始", "field": "应收开始", "flex": 1},
{"headerName": "应收结束", "field": "应收结束", "flex": 1},
{"headerName": "承租方", "field": "承租方", "flex": 1},
{"headerName": "当期金额", "field": "当期金额", "flex": 1, "type": "number"},
{"headerName": "物业名称", "field": "物业名称", "flex": 1},
{"headerName": "产权证号", "field": "产权证号", "flex": 1},
{"headerName": "发票类型", "field": "发票类型", "flex": 1},
{"headerName": "税率", "field": "税率", "flex": 1}
]
}
}
</field>
</record>
<menuitem
id="menu_property_accounts_receivable_report"
name="应收账单报表"
parent="yuthon_property_approval.property_approval_report_menu"
action="action_property_accounts_receivable_report"
sequence="6"
/>
</data>
</odoo>
@@ -37,9 +37,9 @@
<menuitem id="menu_property_report"
name="资产报表"
parent="yuthon_report_root"
parent="yuthon_property_approval.property_approval_report_menu"
action="action_property_report"
sequence="170"
sequence="5"
/>
</data>
</odoo>
@@ -25,12 +25,12 @@
</field>
</record>
<menuitem id="menu_youthon_report"
name="Youthon 报表"
parent="yuthon_report_root"
action="action_youthon_report"
sequence="160"
/>
<!-- <menuitem id="menu_youthon_report"-->
<!-- name="Youthon 报表"-->
<!-- parent="yuthon_report_root"-->
<!-- action="action_youthon_report"-->
<!-- sequence="160"-->
<!-- />-->
</data>
</odoo>
+2
View File
@@ -11,6 +11,8 @@
'data/sale_renting_code_data.xml',
'report/business_report.xml',
'report/business_templates.xml',
'report/seal_approval_report.xml',
'report/seal_approval_templates.xml',
'views/yuthon_personal_condolences.xml',
'views/yuthon_trade_activities.xml',
'views/yuthon_trade_borrowing.xml',
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="action_seal_approval_report_report" model="ir.actions.report">
<field name="name">用章申请报表</field>
<field name="model">yuthon.seals.approval</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">yuthon_trade.report_seal_approval</field>
<field name="report_file">yuthon_trade.report_seal_approval</field>
<field name="print_report_name">'%s' % (object.name)</field>
<field name="binding_model_id" ref="model_yuthon_seals_approval"/>
<field name="binding_type">report</field>
</record>
</data>
</odoo>
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_seal_approval">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<style type="text/css">
td {
border: 1px solid #000000;
padding: 8px;
}
.main-title {
font-weight: bold;
font-size: 18px;
text-align: center;
margin: 20px 0;
}
.section-title {
font-weight: bold;
background-color: #f0f0f0;
}
table {
border-collapse: collapse;
width: 100%;
}
.reason-content {
white-space: pre-wrap;
line-height: 1.5;
}
</style>
<div class="main-title">用章审批单</div>
<!-- 第一行:流水号 + 申请人 -->
<table>
<tr>
<td width="15%" class="section-title"><strong>流水号:</strong></td>
<td width="35%"><span t-field="o.code"/></td>
<td width="15%" class="section-title"><strong>申请人:</strong></td>
<td width="35%">
<span t-if="o.users_id"><span t-field="o.users_id.name"/></span>
<span t-if="not o.users_id">未知</span>
</td>
</tr>
</table>
<!-- 核心用章信息 -->
<table>
<tr>
<td width="15%" class="section-title"><strong>用章事项:</strong></td>
<td width="85%" class="content-cell"><span t-field="o.name"/></td>
</tr>
</table>
<table>
<tr>
<td width="15%" class="section-title"><strong>用章类型:</strong></td>
<td width="35%">
<t t-if="o.type_stamp_ids">
<t t-foreach="o.type_stamp_ids" t-as="type" t-sep="、">
<span t-field="type.name"/>
</t>
</t>
<span t-if="not o.type_stamp_ids">未指定</span>
</td>
<td width="15%" class="section-title"><strong>用章范围:</strong></td>
<td width="35%">
<t t-if="o.scope_chapter_ids">
<t t-foreach="o.scope_chapter_ids" t-as="scope" t-sep="、">
<span t-field="scope.name"/>
</t>
</t>
<span t-if="not o.scope_chapter_ids">未指定</span>
</td>
</tr>
</table>
<table>
<tr>
<td width="15%" class="section-title" style="vertical-align: top;"><strong>用章意见:</strong></td>
<td width="85%" class="content-cell">
<pre t-if="o.remake" style="margin: 0; white-space: pre-wrap;">
<span t-field="o.remake"/></pre>
<span t-if="not o.remake">无</span>
</td>
</tr>
</table>
<!-- 附件 -->
<t t-if="o.document_ids">
<table>
<tr>
<td width="15%" class="section-title"><strong>附件:</strong></td>
<td width="85%">
<t t-foreach="o.document_ids" t-as="doc">
<div t-if="doc.name">
<span t-field="doc.name"/>
</div>
</t>
</td>
</tr>
</table>
</t>
<!-- 审批明细 -->
<t t-if="o.log_ids">
<table>
<tr>
<td width="100%" style="text-align:center;" class="section-title"><strong>审批明细</strong></td>
</tr>
</table>
<table width="100%" style="table-layout:fixed;">
<thead>
<tr>
<td width="20%"><strong>节点</strong></td>
<td width="30%"><strong>意见</strong></td>
<td width="20%"><strong>审批人</strong></td>
<td width="30%"><strong>操作时间</strong></td>
</tr>
</thead>
<tbody>
<t t-foreach="o.log_ids" t-as="log">
<tr>
<td><span t-field="log.name"/></td>
<td><span t-field="log.comment"/></td>
<td><span t-field="log.done_by"/></td>
<td><span t-field="log.date_create"/></td>
</tr>
</t>
</tbody>
</table>
</t>
</t>
</t>
</t>
</template>
</odoo>