添加功能
This commit is contained in:
@@ -35,7 +35,6 @@ class PropertyMeterArchives(models.Model):
|
||||
archives_state = fields.Selection(
|
||||
[("stop", "停用"), ("use", "正常"), ("rent", "出租")],
|
||||
string="状态",
|
||||
compute="_compute_archives_state",
|
||||
store=True,
|
||||
default="use",
|
||||
)
|
||||
@@ -103,6 +102,28 @@ class PropertyMeterArchives(models.Model):
|
||||
else:
|
||||
record.lessee_id = False
|
||||
|
||||
@api.onchange("yuthon_property_ids")
|
||||
def _onchange_property_ids(self):
|
||||
for record in self:
|
||||
selected_properties = record.yuthon_property_ids
|
||||
meters_to_remove = self.env['yuthon.property.energy'].search([
|
||||
('property_meter_archives_id', '=', record.id),
|
||||
('yuthon_property_id', 'not in', selected_properties.ids)
|
||||
])
|
||||
if meters_to_remove:
|
||||
meters_to_remove.unlink()
|
||||
|
||||
for property in selected_properties:
|
||||
existing_meter = self.env['yuthon.property.energy'].search([
|
||||
('property_meter_archives_id', '=', record.id),
|
||||
('yuthon_property_id', '=', property.id)
|
||||
], limit=1)
|
||||
if not existing_meter:
|
||||
self.env['yuthon.property.energy'].create({
|
||||
'property_meter_archives_id': record.id,
|
||||
'yuthon_property_id': property.id,
|
||||
})
|
||||
|
||||
def open_record(self):
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
@@ -111,14 +132,6 @@ class PropertyMeterArchives(models.Model):
|
||||
"view_mode": "form",
|
||||
}
|
||||
|
||||
@api.depends("lessee_id")
|
||||
def _compute_archives_state(self):
|
||||
for record in self:
|
||||
if record.lessee_id:
|
||||
record.archives_state = "rent"
|
||||
else:
|
||||
record.archives_state = "use"
|
||||
|
||||
def button_archives_state(self):
|
||||
archives_ids = self.env["property.meter.archives"].browse(
|
||||
self._context.get("active_ids", self._context.get("active_id"))
|
||||
@@ -238,7 +251,7 @@ class MeterArchivesLine(models.Model):
|
||||
current_read = fields.Float(string="本次读数", group_operator=None)
|
||||
unit_number = fields.Char(string="单元编号/用途")
|
||||
gauge_magnification = fields.Integer(
|
||||
string="仪表倍率", readonly=True, default=1
|
||||
string="仪表倍率", default=1
|
||||
)
|
||||
last_reading_time = fields.Date(string="最后读数时间")
|
||||
receivables = fields.Float(
|
||||
|
||||
@@ -41,7 +41,6 @@ class PropertyMeterWater(models.Model):
|
||||
water_state = fields.Selection(
|
||||
[("stop", "停用"), ("use", "使用"), ("rent", "出租")],
|
||||
string="状态",
|
||||
compute="_compute_water_state",
|
||||
store=True,
|
||||
)
|
||||
standards_id = fields.Many2one("yuthon.electricity.setting", string="标准")
|
||||
@@ -106,14 +105,6 @@ class PropertyMeterWater(models.Model):
|
||||
else:
|
||||
record.lessee_id = False
|
||||
|
||||
@api.depends("lessee_id")
|
||||
def _compute_water_state(self):
|
||||
for record in self:
|
||||
if record.lessee_id:
|
||||
record.water_state = "rent"
|
||||
else:
|
||||
record.water_state = "use"
|
||||
|
||||
def button_water_state(self):
|
||||
water_ids = self.env["property.meter.water"].browse(
|
||||
self._context.get("active_ids", self._context.get("active_id"))
|
||||
@@ -153,6 +144,26 @@ class PropertyMeterWater(models.Model):
|
||||
"context": {"default_water_ids": [(6, 0, active_ids)]},
|
||||
}
|
||||
|
||||
@api.onchange("yuthon_property_ids")
|
||||
def _onchange_property_ids(self):
|
||||
for record in self:
|
||||
selected_properties = record.yuthon_property_ids
|
||||
meters_to_remove = self.env['yyuthon.property.water'].search([
|
||||
('property_meter_water_id', '=', record.id),
|
||||
('yuthon_property_id', 'not in', selected_properties.ids)
|
||||
])
|
||||
if meters_to_remove:
|
||||
meters_to_remove.unlink()
|
||||
for property in selected_properties:
|
||||
existing_meter = self.env['yuthon.property.water'].search([
|
||||
('property_meter_water_id', '=', record.id),
|
||||
('yuthon_property_id', '=', property.id)
|
||||
], limit=1)
|
||||
if not existing_meter:
|
||||
self.env['yuthon.property.energy'].create({
|
||||
'property_meter_archives_id': record.id,
|
||||
'yuthon_property_id': property.id,
|
||||
})
|
||||
|
||||
class MeterWaterLine(models.Model):
|
||||
_name = "meter.water.line"
|
||||
@@ -190,7 +201,7 @@ class MeterWaterLine(models.Model):
|
||||
unit_number = fields.Char(string='单元编号/用途')
|
||||
unit = fields.Float(string='当月单价', group_operator=None)
|
||||
receivables = fields.Float(string="应收", store=True, group_operator=None, help="应收金额=本次用量*单价*(1+线损)")
|
||||
gauge_magnification = fields.Integer(string='仪表倍率', readonly=True, default=1)
|
||||
gauge_magnification = fields.Integer(string='仪表倍率', default=1)
|
||||
last_reading_time = fields.Date(string="最后读数时间")
|
||||
type = fields.Selection([("public", "公共"), ("fees", "收费")], string="类型")
|
||||
start_time = fields.Date(string="安装日期")
|
||||
|
||||
@@ -1,80 +1,179 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
|
||||
<template id="external_layout_standard">
|
||||
<div t-attf-class="header o_company_#{company.id}_layout" t-att-style="report_header_style">
|
||||
|
||||
</div>
|
||||
|
||||
<div t-attf-class="article o_report_layout_standard" >
|
||||
<t t-out="0"/>
|
||||
</div>
|
||||
|
||||
<div t-attf-class="footer o_standard_footer ">
|
||||
<div class="text-center" style="border-top: 1px solid black;">
|
||||
<ul class="list-inline mb4">
|
||||
<div t-field="company.report_footer"/>
|
||||
</ul>
|
||||
|
||||
<div t-if="report_type == 'pdf'" class="text-muted">
|
||||
Page: <span class="page"/> / <span class="topage"/>
|
||||
</div>
|
||||
<div t-if="report_type == 'pdf' and display_name_in_footer" class="text-muted">
|
||||
<span t-out="o.name">(document name)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="external_layout">
|
||||
<t t-if="not o" t-set="o" t-value="doc"/>
|
||||
|
||||
<t t-if="not company">
|
||||
<!-- Multicompany -->
|
||||
<t t-if="company_id">
|
||||
<t t-set="company" t-value="company_id"/>
|
||||
</t>
|
||||
<t t-elif="o and 'company_id' in o and o.company_id.sudo()">
|
||||
<t t-set="company" t-value="o.company_id.sudo()"/>
|
||||
</t>
|
||||
<t t-else="else">
|
||||
<t t-set="company" t-value="res_company"/>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<t t-call="yuthon_property_approval.external_layout_standard"><t t-out="0"/></t>
|
||||
|
||||
</template>
|
||||
|
||||
<template id="report_contract_accounts_receivable">
|
||||
<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;
|
||||
/* 优化文字换行,避免内容溢出 */
|
||||
word-break: break-all;
|
||||
white-space: normal;
|
||||
}
|
||||
.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;
|
||||
/* 保证表格列宽按设置生效 */
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
}
|
||||
.approval-table td {
|
||||
border:1px solid #000000 !important;
|
||||
}
|
||||
/* 添加横向滚动容器,适配小屏幕 */
|
||||
.table-container {
|
||||
overflow-x: auto;
|
||||
margin: 10px 0;
|
||||
}
|
||||
</style>
|
||||
<div class="main-title">付款通知单</div>
|
||||
<div class="table-container">
|
||||
<table class="approval-table">
|
||||
<t t-call="yuthon_property_approval.external_layout">
|
||||
<div class="page">
|
||||
<style>
|
||||
thead, tbody, tfoot, tr, td, th{
|
||||
border: 2px solid black;
|
||||
}
|
||||
</style>
|
||||
<div class="oe_structure" />
|
||||
<h2 class="text-center">付款通知单</h2>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-8 text-left">
|
||||
致:租户:
|
||||
</div>
|
||||
<div class="col-4 text-end">
|
||||
<div class="row">
|
||||
<div class="col-6 text-end">
|
||||
签收:
|
||||
</div>
|
||||
<div class="col-6" style="border-bottom:2px solid black" >
|
||||
   
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-1">
|
||||
<div class="col-12">
|
||||
请贵租户核实以下费用,于次月五日前将以下款项清缴,逾期未交将按合同规定计收滞纳金。如有垂询,请致电,财务部: 87568151、租赁部:87568811。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-sm o_main_table mt-4">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="12%">收费项目</th>
|
||||
<th width="8%">上月表数</th>
|
||||
<th width="8%">本月表数</th>
|
||||
<th width="8%">倍率</th>
|
||||
<th width="10%">计费数量</th>
|
||||
<th width="12%">应收开始</th>
|
||||
<th width="12%">应收结束</th>
|
||||
<th width="12%">应计金额</th>
|
||||
<th width="10%">前期预收</th>
|
||||
<th width="10%">实际应付</th>
|
||||
<th width="10%">备注</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<th rowspan="2">收费项目</th>
|
||||
<th colspan="4">计费依据</th>
|
||||
<th rowspan="2" colspan="2">计费期间</th>
|
||||
<th rowspan="2">应计金额</th>
|
||||
<th rowspan="2">前期预收</th>
|
||||
<th rowspan="2">实际应付</th>
|
||||
<th rowspan="2">备注</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>上月表数</th>
|
||||
<th>本月表数</th>
|
||||
<th>倍率</th>
|
||||
<th>计费数量</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="o.contract_accounts_ids" t-as="line">
|
||||
<tr>
|
||||
<td><t t-esc="line.management_type_id.name"/></td>
|
||||
<td><t t-esc="line.last_month_table"/></td>
|
||||
<td><t t-esc="line.this_month_table"/></td>
|
||||
<td><t t-esc="line.ratio"/></td>
|
||||
<td><t t-esc="line.billable_quantity"/></td>
|
||||
<td><t t-esc="line.due_date"/></td>
|
||||
<td><t t-esc="line.due_date_end"/></td>
|
||||
<td><t t-esc="line.original_amount"/></td>
|
||||
<td><t t-if="line.pre_collection"/></td>
|
||||
<td><t t-if="line.actual_coping"/></td>
|
||||
<td><t t-esc="line.remark"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
<tr>
|
||||
<td class="text-start">1803-租金</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>0</td>
|
||||
<td>2025-10-01</td>
|
||||
<td>2025-10-31</td>
|
||||
<td>7,361.00</td>
|
||||
<td>.00</td>
|
||||
<td>7361.00</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-start">1803-租金</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>0</td>
|
||||
<td>2025-10-01</td>
|
||||
<td>2025-10-31</td>
|
||||
<td>7,361.00</td>
|
||||
<td>.00</td>
|
||||
<td>7361.00</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="text-start">1803-租金</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>0</td>
|
||||
<td>2025-10-01</td>
|
||||
<td>2025-10-31</td>
|
||||
<td>7,361.00</td>
|
||||
<td>.00</td>
|
||||
<td>7361.00</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="text-start">1803-租金</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>0</td>
|
||||
<td>2025-10-01</td>
|
||||
<td>2025-10-31</td>
|
||||
<td>7,361.00</td>
|
||||
<td>.00</td>
|
||||
<td>7361.00</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="text-end" > 合计金额(大写)</td>
|
||||
<td colspan="4"></td>
|
||||
<td colspan="4" class="text-end">(小写):</td>
|
||||
<td ></td>
|
||||
<td ></td>
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
|
||||
<p>注意事项:</p>
|
||||
<p>1、缴费方法;请采用银行转帐或支票等方式缴交,如采用银行转帐结算,请转帐后带银行进帐单到803房财务部开具票。</p>
|
||||
<p>2、开户名称:广州市天河物业管理有限公司 开户行:工行石牌支行 银行帐号:3602098609000363619 </p>
|
||||
<p class="text-end">广州市天河物业管理有限公司</p>
|
||||
<p class="text-end" >025年07月23日</p>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
@@ -44,6 +44,25 @@
|
||||
<field name="binding_model_id" ref="model_property_construction_approval"/>
|
||||
<field name="binding_type">report</field>
|
||||
</record>
|
||||
|
||||
<!-- 纸张格式 -->
|
||||
|
||||
<record id="paperformat_a5" model="report.paperformat">
|
||||
<field name="name">A5</field>
|
||||
<field name="default" eval="True" />
|
||||
<field name="format">A5</field>
|
||||
<field name="page_height">0</field>
|
||||
<field name="page_width">0</field>
|
||||
<field name="orientation">Landscape</field>
|
||||
<field name="margin_top">0</field>
|
||||
<field name="margin_bottom">10</field>
|
||||
<field name="margin_left">7</field>
|
||||
<field name="margin_right">7</field>
|
||||
<field name="header_line" eval="False" />
|
||||
<field name="header_spacing">0</field>
|
||||
<field name="dpi">90</field>
|
||||
</record>
|
||||
|
||||
<record id="action_contract_accounts_receivable_report" model="ir.actions.report">
|
||||
<field name="name">付款通知单报表</field>
|
||||
<field name="model">contract.accounts.receivable</field>
|
||||
@@ -53,5 +72,6 @@
|
||||
<field name="print_report_name">付款通知单报表</field>
|
||||
<field name="binding_model_id" ref="model_contract_accounts_receivable"/>
|
||||
<field name="binding_type">report</field>
|
||||
<field name="paperformat_id" ref="paperformat_a5"/>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -810,9 +810,9 @@
|
||||
<header_search>
|
||||
<quick_filter string="状态">
|
||||
<filter string="待执行" name="to" domain="[('contact_state', '=', 'to')]" />
|
||||
<filter string="已执行" name="complete" domain="[('contact_state', '=', 'complete')]" />
|
||||
<filter string="已作废" name="done" domain="[('contact_state', '=', 'terminate')]"/>
|
||||
<filter string="历史" name="early" domain="[('expiration_coming', '=', 'due')]"/>
|
||||
<filter string="执行中" name="complete" domain="[('contact_state', '=', 'complete')]" />
|
||||
<filter string="中止" name="done" domain="[('contact_state', '=', 'terminate')]"/>
|
||||
<filter string="历史" name="early" domain="['|', ('expiration_coming', '=', 'due'), ('contact_state', '=', 'terminate')]"/>
|
||||
<filter string="即将到期" name="reclaim" domain="[('expiration_coming', '=', 'coming')]"/>
|
||||
</quick_filter>
|
||||
</header_search>
|
||||
@@ -840,9 +840,9 @@
|
||||
<header_search>
|
||||
<quick_filter string="状态">
|
||||
<filter string="待执行" name="to" domain="[('contact_state', '=', 'to')]" />
|
||||
<filter string="已执行" name="complete" domain="[('contact_state', '=', 'complete')]" />
|
||||
<filter string="已作废" name="done" domain="[('contact_state', '=', 'terminate')]"/>
|
||||
<filter string="历史" name="early" domain="[('contact_state', '=', 'early_termination')]"/>
|
||||
<filter string="执行中" name="complete" domain="[('contact_state', '=', 'complete')]" />
|
||||
<filter string="中止" name="done" domain="[('contact_state', '=', 'terminate')]"/>
|
||||
<filter string="历史" name="early" domain="['|', ('expiration_coming', '=', 'due'), ('contact_state', '=', 'terminate')]"/>
|
||||
<filter string="即将到期" name="reclaim" domain="[('expiration_coming', '=', 'coming')]"/>
|
||||
</quick_filter>
|
||||
</header_search>
|
||||
|
||||
@@ -105,11 +105,17 @@ class PropertyRentalWizard(models.Model):
|
||||
('due_date', '<=', last_day_of_month)
|
||||
])
|
||||
if record.contract_sort == 'property':
|
||||
if property_id.message_standard_id:
|
||||
original_amount = 0
|
||||
if property_id.manage_information_ids and property_id.message_standard_id:
|
||||
standard_id = property_id.message_standard_id
|
||||
original_amount = int(round(property_id.management_area * standard_id.amount))
|
||||
else:
|
||||
original_amount = 0
|
||||
matched_info = property_id.manage_information_ids.search([
|
||||
('start_date', '<=', record.start_date),
|
||||
'|',
|
||||
('end_date', '>=', record.start_date),
|
||||
('end_date', '=', False)
|
||||
], limit=1)
|
||||
if matched_info:
|
||||
original_amount = int(round(matched_info.management_area * standard_id.amount))
|
||||
else:
|
||||
original_amount = rent_amount
|
||||
|
||||
@@ -145,10 +151,8 @@ class PropertyRentalWizard(models.Model):
|
||||
start_date = datetime.strptime(date_str, "%Y-%m-%d")
|
||||
# 当期应收日期
|
||||
if start_year_month <= date_field_year_month <= end_year_month:
|
||||
if record.contract_sort == 'property':
|
||||
self.create_rent_list(record, rent_id, rent_amount, start_date, multiplier)
|
||||
else:
|
||||
self.create_management_list(record, start_date, rent_amount)
|
||||
self.create_rent_list(record, rent_id, rent_amount, start_date, multiplier)
|
||||
self.create_management_list(record, start_date, rent_amount)
|
||||
|
||||
def get_multiplier(self, cycle_dict):
|
||||
"""根据周期类型返回相应的租金乘数"""
|
||||
|
||||
Reference in New Issue
Block a user