From aa0de9597dc683c707b5f6fa11ce4c46895933df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Wed, 20 May 2026 15:47:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BC=E9=87=91=E5=B7=A5=E4=BD=9C=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/property_accounts_receivable.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/yuthon_property/models/property_accounts_receivable.py b/yuthon_property/models/property_accounts_receivable.py index 8308e3f65..470bf168c 100644 --- a/yuthon_property/models/property_accounts_receivable.py +++ b/yuthon_property/models/property_accounts_receivable.py @@ -48,6 +48,7 @@ class PropertyAccountsReceivable(models.Model): management_type_id = fields.Many2one('yuthon.management.type', string='应收类型') last_update_time = fields.Datetime(string='最后修改时间') is_write = fields.Boolean(string='是否修改') + is_refunded = fields.Boolean(string='是否已退款', compute='_compute_is_refunded', store=True) number_of_payments = fields.Integer(string='支付次数', compute='compute_number_of_payments') total_penalty = fields.Float(string='违约金总额') # todo 待定需要每天一更新的数据 uncollected_penalty = fields.Float(string='未收违约金') # todo 同理 @@ -199,6 +200,19 @@ class PropertyAccountsReceivable(models.Model): for record in record_ids: record.compute_submitted = True + @api.depends('contract_id') + def _compute_is_refunded(self): + for record in self: + record.is_refunded = False + if record.contract_id: + # 检查是否有已退款的押金记录 + refund_bills = self.env['property.bills.list'].search([ + ('contract_id', '=', record.contract_id.id), + ('management_type_id.name', '=', '押金'), + ('actual_date', '!=', False), + ], limit=1) + record.is_refunded = bool(refund_bills) + def compute_number_of_payments(self): for record in self: # 默认为0