From 9b044257e61054b28f7fb8ce4efe1e3a86831b9d Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Thu, 21 Aug 2025 19:11:35 +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 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index 33cbacedf..53ac7fee8 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -63,9 +63,19 @@ class PropertyBankStatements(models.Model): rec.yes_amount = 0 penalty_records = self.env['property.accounts.receivable'].search([('bank_id', '=', self.id)]) if not penalty_records: + start_date_obj = fields.Date.from_string(start_date) + year = start_date_obj.year + month = start_date_obj.month + month_start = datetime(year, month, 1).date() + if month == 12: + month_end = datetime(year, 12, 31).date() + else: + month_end = (datetime(year, month + 1, 1).date() - relativedelta(days=1)) + month_start_str = fields.Date.to_string(month_start) + month_end_str = fields.Date.to_string(month_end) penalty_records = self.env['property.accounts.receivable'].search([ - ('due_date', '<=', start_date), - ('due_date_end', '>=', start_date), + ('due_date', '>=', month_start_str), + ('due_date', '<=', month_end_str), ('lessee_id', '=', tenant_id), ('contract_id', 'in', rec.contract_ids.ids), ('property_id', 'in', rec.property_ids.ids),