From 75aa8a8a97ff32e794052a6e433d8f0192967a8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?=
<9664676+pengyuthon@user.noreply.gitee.com>
Date: Thu, 25 Sep 2025 11:00:46 +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
---
.../models/property_meter_archives.py | 2 +
.../models/property_meter_water.py | 2 +
.../views/property_meter_archives_views.xml | 1 +
.../views/property_meter_water_views.xml | 1 +
yuthon_property_approval/__manifest__.py | 1 +
.../models/inherit_yuthon_property.py | 19 ++++++
.../security/ir.model.access.csv | 4 ++
.../views/inherit_yuthon_property_views.xml | 2 +
yuthon_property_approval/wizard/__init__.py | 3 +-
.../wizard/penalty_line_wizard.py | 50 ++++++++++++++++
.../wizard/penalty_line_wizard_viwes.xml | 58 +++++++++++++++++++
.../wizard/property_reconciliation_wizard.py | 4 +-
.../property_reconciliation_wizard_views.xml | 2 +-
13 files changed, 144 insertions(+), 5 deletions(-)
create mode 100644 yuthon_property_approval/wizard/penalty_line_wizard.py
create mode 100644 yuthon_property_approval/wizard/penalty_line_wizard_viwes.xml
diff --git a/yuthon_property/models/property_meter_archives.py b/yuthon_property/models/property_meter_archives.py
index d2f027801..d2afbeb5a 100644
--- a/yuthon_property/models/property_meter_archives.py
+++ b/yuthon_property/models/property_meter_archives.py
@@ -6,9 +6,11 @@ from odoo.exceptions import UserError, ValidationError
class PropertyMeterArchives(models.Model):
_name = 'property.meter.archives'
_description = '电表库'
+ _order = 'number asc'
name = fields.Char(string='仪表编号')
unit_number = fields.Char(string='单元编号/用途')
+ number = fields.Char(string="序号")
installation_location = fields.Char(string='安装位置')
is_state = fields.Boolean(string='是否启用')
type = fields.Selection([('public', '公共'), ('fees', '收费')], string='类型')
diff --git a/yuthon_property/models/property_meter_water.py b/yuthon_property/models/property_meter_water.py
index 1a930c3ab..5023012d5 100644
--- a/yuthon_property/models/property_meter_water.py
+++ b/yuthon_property/models/property_meter_water.py
@@ -5,8 +5,10 @@ from odoo.exceptions import UserError, ValidationError
class PropertyMeterWater(models.Model):
_name = 'property.meter.water'
_description = '水表库'
+ _order = 'number asc'
name = fields.Char(string='仪表编号')
+ number = fields.Char(string="序号")
unit_number = fields.Char(string='单元编号/用途')
installation_location = fields.Char(string='安装位置')
is_state = fields.Boolean(string='是否启用')
diff --git a/yuthon_property/views/property_meter_archives_views.xml b/yuthon_property/views/property_meter_archives_views.xml
index f4e0fc0eb..88827a6e4 100644
--- a/yuthon_property/views/property_meter_archives_views.xml
+++ b/yuthon_property/views/property_meter_archives_views.xml
@@ -10,6 +10,7 @@
+
diff --git a/yuthon_property/views/property_meter_water_views.xml b/yuthon_property/views/property_meter_water_views.xml
index 487f0e13d..1dbb95585 100644
--- a/yuthon_property/views/property_meter_water_views.xml
+++ b/yuthon_property/views/property_meter_water_views.xml
@@ -11,6 +11,7 @@
+
diff --git a/yuthon_property_approval/__manifest__.py b/yuthon_property_approval/__manifest__.py
index 8e7b51d08..913fb9e04 100644
--- a/yuthon_property_approval/__manifest__.py
+++ b/yuthon_property_approval/__manifest__.py
@@ -83,6 +83,7 @@
'wizard/binding_information_wizard_views.xml',
'wizard/property_rental_wizard_views.xml',
'wizard/contract_signature_wizard_viwes.xml',
+ 'wizard/penalty_line_wizard_viwes.xml',
'wizard/build_pop_wizard_viwes.xml',
'wizard/property_meeting_wizard_views.xml',
'views/property_menu_all.xml',
diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py
index 33ee34124..f680cf777 100644
--- a/yuthon_property_approval/models/inherit_yuthon_property.py
+++ b/yuthon_property_approval/models/inherit_yuthon_property.py
@@ -304,6 +304,7 @@ class PropertyBankStatements(models.Model):
'default_amount_reconciled': self.no_amount,
"default_receivable_total": total_rent_month,
"dialog_size" : "extra-large",
+ "default_order": "due_date desc",
}
return {
@@ -367,6 +368,7 @@ class PropertyAccountsReceivable(models.Model):
property_ids = fields.Many2many('yuthon.property', string='物业', compute='_compute_property_ids', store=True)
property_name = fields.Text(string='物业', compute="_compute_property_name")
+ is_rent = fields.Boolean(string='是否租金', default=True, compute = '_compute_is_rent', store=True)
management_area = fields.Float(related='contract_id.total_area', string='面积')
title_deed = fields.Char(string="产权证号", compute='_compute_title_deed')
lessee_id = fields.Many2one(related='contract_id.lessee_id', string='承租方', stroe=True)
@@ -381,6 +383,23 @@ class PropertyAccountsReceivable(models.Model):
rent_owed = fields.Float(string="欠租金额")
per_day = fields.Float(string="每天违约金(元/天)")
+ @api.depends('management_type_id')
+ def _compute_is_rent(self):
+ for rec in self:
+ if rec.management_type_id.name == '租金':
+ rec.is_rent = True
+ else:
+ rec.is_rent = False
+
+ def penalty_wizard(self):
+ return {
+ 'name': '合同违约金明细',
+ 'type': 'ir.actions.act_window',
+ 'res_model': 'penalty.line.wizard',
+ 'view_mode': 'form',
+ 'target': 'new',
+ }
+
@api.depends('contract_id')
def _compute_property_name(self):
for record in self:
diff --git a/yuthon_property_approval/security/ir.model.access.csv b/yuthon_property_approval/security/ir.model.access.csv
index 938386606..29e4aa69b 100644
--- a/yuthon_property_approval/security/ir.model.access.csv
+++ b/yuthon_property_approval/security/ir.model.access.csv
@@ -105,3 +105,7 @@ access_contract_signature_wizard,contract_signature_wizard,model_contract_signat
access_payment_process,payment_process,model_payment_process,base.group_user,1,1,1,1
access_build_pop_wizard, build_pop_wizard,model_build_pop_wizard,base.group_user,1,1,1,1
+
+access_penalty_line_wizard, penalty_line_wizard,model_penalty_line_wizard,base.group_user,1,1,1,1
+access_penalty_compute_line_wizard, penalty_compute_line_wizard,model_penalty_compute_line_wizard,base.group_user,1,1,1,1
+access_penalty_pay_line, penalty_pay_line,model_penalty_pay_line,base.group_user,1,1,1,1
diff --git a/yuthon_property_approval/views/inherit_yuthon_property_views.xml b/yuthon_property_approval/views/inherit_yuthon_property_views.xml
index 24501da26..e419f8add 100644
--- a/yuthon_property_approval/views/inherit_yuthon_property_views.xml
+++ b/yuthon_property_approval/views/inherit_yuthon_property_views.xml
@@ -284,9 +284,11 @@
+
+
diff --git a/yuthon_property_approval/wizard/__init__.py b/yuthon_property_approval/wizard/__init__.py
index 85811fbd0..caf0f01b4 100644
--- a/yuthon_property_approval/wizard/__init__.py
+++ b/yuthon_property_approval/wizard/__init__.py
@@ -10,4 +10,5 @@ from . import click_reconciliation_wizard
from . import accounts_wizard
from . import binding_information_wizard
from . import contract_signature_wizard
-from . import build_pop_wizard
\ No newline at end of file
+from . import build_pop_wizard
+from . import penalty_line_wizard
\ No newline at end of file
diff --git a/yuthon_property_approval/wizard/penalty_line_wizard.py b/yuthon_property_approval/wizard/penalty_line_wizard.py
new file mode 100644
index 000000000..3d3292b7a
--- /dev/null
+++ b/yuthon_property_approval/wizard/penalty_line_wizard.py
@@ -0,0 +1,50 @@
+from email.policy import default
+
+from odoo import models, fields, api, _, SUPERUSER_ID
+from odoo.exceptions import ValidationError, UserError
+import xlrd
+import base64
+import datetime
+from datetime import datetime
+import pandas as pd
+
+
+class PenaltyLineWizard(models.Model):
+ _name = 'penalty.line.wizard'
+ _description = '合同违约金明细'
+
+ rent_collected = fields.Float(string='未收租金')
+ days_overdue = fields.Integer(string='逾期天数')
+ total_penalty = fields.Float(string='违约金总额')
+ collected_penalty = fields.Float(string='已收违约金')
+ uncollected_penalty = fields.Float(string='未收违约金')
+ pay_number = fields.Char(string='支付次数')
+ remake = fields.Text(string='备注')
+
+ rule_description = fields.Text(string='计算规则说明:', default = '应收月的次月1号开始计算违约金\n。违约金按每日千分之 - (0.1 %)\n计算\n。租金部分支付后,剩余部分从前一次缴费日期次日开始里新计算')
+ penalty_line_ids = fields.One2many('penalty.compute.line.wizard', 'penalty_id', string='违约金明细')
+ pay_line_ids = fields.One2many('penalty.pay.line', 'penalty_id', string='违约金支付明细')
+
+
+class PenaltyComputeLineWizard(models.Model):
+ _name = 'penalty.compute.line.wizard'
+ _description = '违约金计算明细'
+ _order = 'date desc'
+
+ penalty_id = fields.Many2one('penalty.line.wizard', string='关联违约金明细')
+ date = fields.Date(string='日期')
+ remake = fields.Text(string='说明')
+ days_overdue = fields.Integer(string='逾期天数')
+ remaining_principal = fields.Float(string='剩余本金')
+ calculation_formula = fields.Text(string='计算公式')
+
+
+class PenaltyPayLine(models.Model):
+ _name = 'penalty.pay.line'
+ _description = '支付记录明细'
+
+ penalty_id = fields.Many2one('penalty.line.wizard', string='关联违约金明细')
+ date = fields.Date(string='支付日期')
+ amount = fields.Float(string='支付金额')
+ management_type_id = fields.Many2one('yuthon.management.type', string='支付类型')
+ remake = fields.Text(string='备注')
\ No newline at end of file
diff --git a/yuthon_property_approval/wizard/penalty_line_wizard_viwes.xml b/yuthon_property_approval/wizard/penalty_line_wizard_viwes.xml
new file mode 100644
index 000000000..07f329af8
--- /dev/null
+++ b/yuthon_property_approval/wizard/penalty_line_wizard_viwes.xml
@@ -0,0 +1,58 @@
+
+
+
+ penalty.line.wizard.form
+ penalty.line.wizard
+
+
+
+
+
\ No newline at end of file
diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py
index 924b539d1..280d6ff88 100644
--- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py
+++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py
@@ -165,8 +165,6 @@ class PropertyReconciliationWizard(models.Model):
if line.collection_type != 'penalty'
]
self.reconciliation_line_ids = keep_lines + new_lines
- if self.reconciliation_line_ids:
- self.reconciliation_line_ids.sorted(key=lambda r: r.sequence)
all_penalties = all(line.collection_type == 'penalty' for line in self.reconciliation_line_ids)
if all_penalties and self.reconciliation_line_ids:
@@ -492,7 +490,7 @@ class PropertyReconciliationWizard(models.Model):
class PropertyReconciliationLine(models.Model):
_name = 'property.reconciliation.line'
_description = '对账明细'
- _order = 'sequence asc'
+ _order = 'collection_type desc, due_date desc'
reconciliation_id = fields.Many2one('property.reconciliation.wizard', string='关联对账单弹窗')
sequence = fields.Integer(string='顺序')
diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml
index 42e12b42b..5473c4d62 100644
--- a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml
+++ b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml
@@ -33,7 +33,7 @@
-
+