From 3975d8f933accc6f2fdfc239da46f2c15993dbcb 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: Fri, 28 Nov 2025 15:37:40 +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/inherit_yuthon_property.py | 11 ++++++----- .../models/property_lease_contract.py | 15 ++++++++++++++- .../views/inherit_yuthon_property_views.xml | 4 +--- .../wizard/property_reconciliation_wizard.py | 4 +--- .../property_reconciliation_wizard_views.xml | 7 ++++--- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index 43f426cae..6b4b62c02 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -480,6 +480,7 @@ class PropertyBankStatements(models.Model): :return: """ start_time = self.start_time + relativedelta(hours=8) + warning_msg = self._check_unreconciled_statements(start_time) context = { "default_actual_date": fields.Date.to_date(start_time), "default_bank_id": self.id, @@ -490,11 +491,10 @@ class PropertyBankStatements(models.Model): "default_reconciliation_line_ids": all_vals, # 租金,应收日期排序、管理费、电、水、押金 'default_amount_reconciled': self.no_amount, "default_receivable_total": total_rent_month, + "default_warning_msg":warning_msg, "dialog_size": "extra-large", "default_order": "due_date desc", } - self._check_unreconciled_statements(start_time) - return { "type": "ir.actions.act_window", "name": "对账弹窗", @@ -532,7 +532,10 @@ class PropertyBankStatements(models.Model): if statements: unreconciled[account] = len(statements) if unreconciled: - raise UserError("存在未对账的历史流水,请优先处理:") + warning_msg = _("⚠️ 检测到未对账的历史流水,请优先处理") + else: + warning_msg = False + return warning_msg def button_reconciliation(self): for record in self: @@ -595,8 +598,6 @@ class PropertyAccountsReceivable(models.Model): # company_id1 = fields.Many2one(related='contract_id.admin_id.company_id', string="管理员公司", store=True) company_id2 = fields.Many2one("res.company", string="公司", compute='_compute_company_id2', store=True) contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批") - version = fields.Char(related='contract_id.version', string='版本') - contract_name = fields.Char(string='合同编号', compute="_compute_contract_name") contract_sort = fields.Selection([('property', '物业'), ('guanggao', '广告位'),('parking', '停车场'), ('guanzi', '管子间'), ('room', '机房'), ('base_station','基站'), ('other', '其他')], related='contract_id.contract_sort', string="资产类型", index=True) admin_id = fields.Many2one(related='contract_id.admin_id', string="片区管理员", store=True) diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 7aba22c32..e079c9d9d 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -90,7 +90,7 @@ class PropertyLeaseContract(models.Model): _name = 'property.lease.contract' _description = '租赁合同审批' _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin'] - _rec_name = 'contract_code' + _rec_name = 'display_name' property_name = fields.Char(string='物业信息') version = fields.Char(string="合同版本", default="V1.0") @@ -98,6 +98,8 @@ class PropertyLeaseContract(models.Model): admin_id = fields.Many2one('res.users', string="管理员", compute="_compute_admin_id", store=True) tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型', compute="_compute_admin_id", store=True) contract_code = fields.Char(string="合同编号") + display_name = fields.Char(string="合同编号", compute="_compute_display_name") + contract_date = fields.Date(string="合同签订日期") is_print = fields.Boolean(string="当月打印", compute ="_compute_is_print", store=True) property_documents_ids = fields.Many2many( @@ -308,6 +310,17 @@ class PropertyLeaseContract(models.Model): issues_result = fields.Html(string="会议结果") related_issues_id = fields.Many2one('issue.library', string="关联议题") + @api.depends('contract_code', 'version') + def _compute_display_name(self): + for rec in self: + if rec.version and rec.contract_code: + rec.display_name = f"{rec.contract_code}({rec.version})" + elif rec.contract_code: + rec.display_name = f"{rec.contract_code}" + else: + rec.display_name = False + + @api.depends('payment_ids.print_date', 'payment_ids.is_print') def _compute_is_print(self): today = date.today() diff --git a/yuthon_property_approval/views/inherit_yuthon_property_views.xml b/yuthon_property_approval/views/inherit_yuthon_property_views.xml index cc74b03e8..aa1057a92 100644 --- a/yuthon_property_approval/views/inherit_yuthon_property_views.xml +++ b/yuthon_property_approval/views/inherit_yuthon_property_views.xml @@ -408,9 +408,7 @@ - - - + diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index ee02a6dbe..f551c7e07 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -13,7 +13,7 @@ class PropertyReconciliationWizard(models.Model): receivable_total = fields.Float(string='应收金额', compute="_compute_receivable_total", store=True) bank_branch = fields.Char('银行名称') - + warning_msg = fields.Char(string='警告') bank_id = fields.Many2one('property.bank.statements', string='银行流水') lessee_ids = fields.Many2many('property.tenant.information', string='承租方') receivables_type_ids = fields.Many2many('yuthon.management.type', string="应收类型") @@ -621,8 +621,6 @@ class PropertyReconciliationLine(models.Model): property_name = fields.Text(string='物业', compute="_compute_property_name") property_ids = fields.Many2many('yuthon.property', string='物业', compute="_compute_property_ids", store=True) contract_id = fields.Many2one('property.lease.contract', string='合同编号') - version = fields.Char(related='contract_id.version', string='版本') - contract_name = fields.Char(string='合同编号', compute="_compute_contract_name") rent_month = fields.Float(string='当期金额') due_date = fields.Date(string='应收日期') rent = fields.Float(string='未收') diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml index 33faf088b..16bae5b95 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml @@ -51,6 +51,9 @@ + + + @@ -60,9 +63,7 @@ - - - +