From 5ef8120ace5e75da8544d872ce8deb5bc39b72e4 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Mon, 18 Aug 2025 20:18:36 +0800 Subject: [PATCH 1/2] =?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 --- .../wizard/property_reconciliation_wizard.py | 27 ++++++++++++++----- yuthon_purchase/models/purchase_workflow.py | 2 +- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 9c5889213..57a04eb99 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -115,6 +115,11 @@ class PropertyReconciliationWizard(models.Model): 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: + total = sum(line.rent for line in self.reconciliation_line_ids) + self.receivable_total = total + remaining_amount = self.actual_total # 检查是否有单行的rent等于实际金额 @@ -167,12 +172,12 @@ class PropertyReconciliationWizard(models.Model): ('tenant_id.name', '!=', False) ]) if bank_lines: - if rec.actual_total > rec.receivable_total: - rec.bank_id.registered = rec.actual_total - rec.receivable_total - rec.bank_id.bank_state = 'registered' - else: + if rec.actual_total == rec.receivable_total: rec.bank_id.registered = 0 rec.bank_id.bank_state = 'reconciled' + else: + rec.bank_id.registered = abs(rec.actual_total - rec.receivable_total) + rec.bank_id.bank_state = 'registered' rec.bank_id.yes_amount = rec.amount_been_reconciled rec.bank_id.no_amount = rec.amount_reconciled @@ -234,7 +239,8 @@ class PropertyReconciliationWizard(models.Model): ('lessee_id', '=', first_line.tenant_id.id), ] # 检查是否已有相同记录 - existing_record = self.env['property.accounts.receivable'].search(check_domain, limit=1) + existing_record = self.env['property.accounts.receivable'].search(check_domain) + is_reconciliation = line.amount == line.rent if not existing_record: domain2 = [ ('due_date', '=', line.due_date), @@ -242,7 +248,6 @@ class PropertyReconciliationWizard(models.Model): ('contract_id', '=', line.contract_id.id), ('collection_type', '=', 'rent'), ] - is_reconciliation = line.amount reconciliation_id = self.env['property.reconciliation.line'].search(domain2, limit=1) self.env['property.accounts.receivable'].create({ 'is_reconciliation': is_reconciliation, @@ -259,6 +264,16 @@ class PropertyReconciliationWizard(models.Model): 'remark': line.remake, 'reconciliation_time': fields.Datetime.now(), }) + else: + existing_record.write({ + 'delivered1': line.amount, + 'due_date_end': rec.actual_date if (line.rent == line.amount and line.rent != 0) else None, + 'is_reconciliation': is_reconciliation, + 'payout_date': rec.actual_date if (line.rent == line.amount and line.rent != 0) else None, + 'remark': line.remake, + 'reconciliation_time': fields.Datetime.now(), + }) + class PropertyReconciliationLine(models.Model): diff --git a/yuthon_purchase/models/purchase_workflow.py b/yuthon_purchase/models/purchase_workflow.py index ba8eaae84..a7be676b7 100644 --- a/yuthon_purchase/models/purchase_workflow.py +++ b/yuthon_purchase/models/purchase_workflow.py @@ -151,7 +151,7 @@ class PurchaseLowLine(models.Model): product_id = fields.Many2one('product.product', string="物品名称") brand = fields.Char(string="品牌") specs = fields.Char(string="规格") - name = fields.Text(string="描述", default=lambda self: self.product_id.display_name if self.product_id else False ) + name = fields.Text(string="描述") product_packaging_id = fields.Many2one('product.packaging', string="包装") taxes_id = fields.Many2one('account.tax', string='税项') number = fields.Integer(string="数量") From f9778db83b550c0fec3cafa939cf166309c4c8b2 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Mon, 18 Aug 2025 20:22:28 +0800 Subject: [PATCH 2/2] =?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 --- .../wizard/property_reconciliation_wizard.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 57a04eb99..97d7ffdb1 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -87,8 +87,7 @@ class PropertyReconciliationWizard(models.Model): ]) for penalty in receivable_penalties: - exists = any(p['rent'] == penalty.submitted and - p['due_date'] == penalty.due_date and + exists = any(p['due_date'] == penalty.due_date and p['contract_id'] == penalty.contract_id.id for p in contract_penalties) if not exists: