diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index 53ac7fee8..a8e4200ab 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -90,7 +90,14 @@ class PropertyBankStatements(models.Model): 'payout_date': None, }) return - to_delete = penalty_records.filtered(lambda r: not r.is_write) + + target_year = start_date.year + target_month = start_date.month + to_delete = penalty_records.filtered( + lambda r: not r.is_write + and fields.Date.from_string(r.due_date).year == target_year + and fields.Date.from_string(r.due_date).month == target_month + ) if to_delete: to_delete.unlink()