添加功能

This commit is contained in:
李鹏宇
2025-11-26 17:47:23 +08:00
parent 495f4b81c4
commit 0d5089a92a
10 changed files with 70 additions and 63 deletions
@@ -108,6 +108,7 @@
<field name="line_loss" string="线损"/>
<field name="gauge_magnification" string="倍率"/>
<field name="current_meter" string="用量"/>
<field name="initial_value"/>
<field name="current_read" string="本次读数"/>
<field name="last_read" string="上次读数"/>
<field name="lessee_id" string="承租方"/>
@@ -117,7 +118,6 @@
<field name="last_dosage" string="上次用量"/>
<field name="number" column_invisible="1"/>
<field name="sequence" column_invisible="1"/>
<field name="initial_value" column_invisible="1"/>
<field name="meter_date_month" column_invisible="1"/>
<field name="is_abnormal" column_invisible="1"/>
<field name="last_reading_time" column_invisible="1"/>
@@ -2152,6 +2152,8 @@ class PropertyLeaseContract(models.Model):
}
def print_payment_notice(self):
contract_ids = self.env["property.lease.contract"].browse(
self._context.get('active_ids', self._context.get('active_id')))
return {
"name": "打印缴费通知单",
'type': 'ir.actions.act_window',
@@ -2159,7 +2161,7 @@ class PropertyLeaseContract(models.Model):
"view_mode": "form",
'target': 'new',
'context': {
'default_contract_id': self.id,
'default_contract_ids': contract_ids.ids,
}
}
@@ -47,7 +47,6 @@
<template id="report_contract_accounts_receivable">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="yuthon_property_approval.external_layout">
<div class="page">
<style>
@@ -76,7 +75,7 @@
<div class="row">
<!-- 租户名称从合同中取值 -->
<div class="col-8 text-left">
致:租户: <t t-esc="data.contract.lessee_id.name or '未知租户'"/>
致:租户: <t t-esc="lessee_name"/>
</div>
<div class="col-4 text-end">
<div class="row">
@@ -115,33 +114,32 @@
</tr>
</thead>
<tbody>
<!-- 循环筛选后的应收明细行(替换原 o.contract_accounts_ids) -->
<t t-foreach="data.receivable_lines" t-as="line">
<t t-foreach="receivable_lines" t-as="line">
<tr>
<td class="text-start"><t t-esc="line.management_type_id.name or ''"/></td>
<td><t t-esc="line.last_month_table or ''"/></td>
<td><t t-esc="line.this_month_table or ''"/></td>
<td><t t-esc="line.ratio or 1"/></td>
<td><t t-esc="line.billable_quantity or 0"/></td>
<td><t t-esc="line.due_date and line.due_date.strftime('%Y-%m-%d') or ''"/></td>
<td><t t-esc="line.due_date_end and line.due_date_end.strftime('%Y-%m-%d') or ''"/></td>
<td><t t-esc="line.original_amount and '%.2f' % line.original_amount or '0.00'"/></td>
<td><t t-esc="line.pre_collection and '%.2f' % line.pre_collection or '0.00'"/></td>
<td><t t-esc="line.actual_coping and '%.2f' % line.actual_coping or '0.00'"/></td>
<td><t t-esc="line.remark or ''"/></td>
<td class="text-start"><t t-esc="line"/></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-esc="line.pre_collection"/></td>-->
<!-- <td><t t-esc="line.actual_coping"/></td>-->
<!-- <td><t t-esc="line.remark"/></td>-->
</tr>
</t>
</tbody>
<tfoot>
<tr>
<td class="text-end" > 合计金额(大写)</td>
<td colspan="4"></td>
<td colspan="4" class="text-end">(小写):</td>
<!-- 显示合计金额 -->
<td ><t t-esc="data.total_amount and '%.2f' % data.total_amount or '0.00'"/></td>
<td ></td>
</tr>
</tfoot>
<!-- <tfoot>-->
<!-- <tr>-->
<!-- <td class="text-end" > 合计金额(大写)</td>-->
<!-- <td colspan="4"></td>-->
<!-- <td colspan="4" class="text-end">(小写):</td>-->
<!-- &lt;!&ndash; 显示合计金额 &ndash;&gt;-->
<!-- <td ><t t-esc="data.total_amount and '%.2f' % data.total_amount or '0.00'"/></td>-->
<!-- <td ></td>-->
<!-- </tr>-->
<!-- </tfoot>-->
</table>
<p>注意事项:</p>
@@ -149,11 +147,10 @@
<p>2、开户名称:广州市天河物业管理有限公司 开户行:工行石牌支行 银行帐号:3602098609000363619 </p>
<!-- 动态显示当前选择的年月(替换固定日期) -->
<p class="text-end">广州市天河物业管理有限公司</p>
<p class="text-end" ><t t-esc="data.selected_year"/>年<t t-esc="data.selected_month"/>月<t t-esc="datetime.now().day"/>日</p>
<p class="text-end" ><t t-esc="selected_year"/>年<t t-esc="selected_month"/>月</p>
</div>
</t>
</t>
</t>
</template>
</odoo>
@@ -65,12 +65,12 @@
<record id="action_contract_accounts_receivable_report" model="ir.actions.report">
<field name="name">付款通知单报表</field>
<field name="model">contract.accounts.receivable</field>
<field name="model">property.lease.contract</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">yuthon_property_approval.report_contract_accounts_receivable</field>
<field name="report_file">yuthon_property_approval.report_contract_accounts_receivable</field>
<field name="print_report_name">付款通知单报表</field>
<field name="binding_model_id" ref="model_contract_accounts_receivable"/>
<field name="binding_model_id" ref="model_property_lease_contract"/>
<field name="binding_type">report</field>
<field name="paperformat_id" ref="paperformat_a5"/>
</record>
@@ -14,7 +14,7 @@ class PrintPaymentWizard(models.Model):
_name = 'print.payment.wizard'
_description = '打印物业缴费通知单'
contract_id = fields.Many2one('property.lease.contract', string="合同")
contract_ids = fields.Many2many('property.lease.contract', string="合同")
select_month = fields.Selection([('1', '一月'), ('2', '二月'), ('3', '三月'), ('4', '四月'),
('5', '五月'), ('6', '六月'), ('7', '七月'), ('8', '八月'),
('9', '九月'), ('10', '十月'), ('11', '十一月'),
@@ -37,32 +37,40 @@ class PrintPaymentWizard(models.Model):
today = date.today()
start_date = today.replace(day=1)
end_date = start_date + relativedelta(months=1) - relativedelta(days=1)
existing_notice = self.env['property.payment.notice'].search([
('contract_id', '=', self.contract_id.id),
('print_date', '>=', start_date),
('print_date', '<=', end_date)
], limit=1)
if not existing_notice:
self.env['property.payment.notice'].create({
'contract_id': self.contract_id.id,
'print_date': today,
'is_print': True,
})
start_date, end_date = self._get_date_range()
receivable_lines = self.contract_id.receivable_ids.filtered(
lambda line: start_date <= line.due_date <= end_date
)
for line in receivable_lines:
line.print_date = today
line.number +=1
report_data = {
'contract': self.contract_id,
'selected_year': self.select_year,
'selected_month': self.select_month,
'receivable_lines': receivable_lines,
'line_count': len(receivable_lines),
'total_amount': sum(line.original_amount for line in receivable_lines)
}
report_ref = self.env['ir.actions.report'].search([
('report_name', '=', 'yuthon_property_approval.report_contract_accounts_receivable')])
for contract_id in self.contract_ids:
existing_notice = self.env['property.payment.notice'].search([
('contract_id', '=', contract_id.id),
('print_date', '>=', start_date),
('print_date', '<=', end_date)
], limit=1)
if not existing_notice:
self.env['property.payment.notice'].create({
'contract_id': contract_id.id,
'print_date': today,
'is_print': True,
})
start_date, end_date = self._get_date_range()
receivable_lines = contract_id.receivable_ids.filtered(
lambda line: start_date <= line.due_date <= end_date
)
for line in receivable_lines:
line.print_date = today
# line.number +=1
report_data = {
'contract': contract_id,
'selected_year': self.select_year,
'selected_month': self.select_month,
'day': today.day,
'lessee_name': contract_id.lessee_id.name,
'receivable_lines': [{
'1':1,
'2':2,
'3':3,
}],
'line_count': len(receivable_lines),
'total_amount': sum(line.original_amount for line in receivable_lines)
}
report_ref = self.env['ir.actions.report'].search([
('report_name', '=', 'yuthon_property_approval.report_contract_accounts_receivable')])
return report_ref.report_action(self, data=report_data)
@@ -7,7 +7,7 @@
<form>
<sheet>
<group>
<field name="contract_id"/>
<field name="contract_ids" widget="many2many_tags"/>
<field name="select_month"/>
<field name="select_year"/>
</group>
@@ -19,7 +19,6 @@ class YuthonBusinessApproval(models.Model):
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
information_categories_ids = fields.Many2many('yuthon.information.categories', string='信息分类')
reason = fields.Text(string="正文")
document_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('Active', default=True, tracking=True)
@@ -17,6 +17,7 @@ class YuthonMessageApproval(models.Model):
phone = fields.Char(related='users_id.employee_id.mobile_phone', string="联系方式")
documents_ids = fields.Many2many('ir.attachment', string="附件")
publish_ids = fields.Many2many('yuthon.publish.type', string="发布渠道")
information_categories_ids = fields.Many2many('yuthon.information.categories', string='信息分类')
publish_date = fields.Date(string="发布日期")
is_original = fields.Boolean(string="原创声明")
norms = fields.Text(string="审核与执行规范")
@@ -44,7 +44,6 @@
<field name="work_end" invisible="1"/>
<field name="name"/>
<field name="users_id"/>
<field name="information_categories_ids" widget="many2many_tags"/>
<field name="reason"/>
<field name="document_ids" widget="preview_many2many"/>
<field name="department_id" invisible="1"/>
@@ -49,6 +49,7 @@
<group>
<field name="work_end" invisible="1"/>
<field name="name"/>
<field name="information_categories_ids" widget="many2many_tags"/>
<field name="text"/>
<field name="documents_ids" widget="preview_many2many"/>
</group>