diff --git a/yuthon_property_approval/wizard/property_rental_wizard.py b/yuthon_property_approval/wizard/property_rental_wizard.py index 54e711ee6..f7b297006 100644 --- a/yuthon_property_approval/wizard/property_rental_wizard.py +++ b/yuthon_property_approval/wizard/property_rental_wizard.py @@ -30,19 +30,19 @@ class PropertyRentalWizard(models.Model): if multiplier == 1: first_day_of_month = start_date.replace(day=1) else: - first_day_of_month = start_date.replace(day=1) - relativedelta(months=multiplier) + first_day_of_month = start_date.replace(day=2) - relativedelta(months=multiplier) last_day_of_month = start_date.replace(day=1) + relativedelta(months=multiplier) - timedelta(days=1) rent_id = self.env['property.rent.list'].search([ ('contract_id', '=', record.id), ('property_id', '=', property_id), - ('due_date', '>', first_day_of_month), + ('due_date', '>=', first_day_of_month), ('due_date', '<=', last_day_of_month), ]) # 判断是否有已生成应收 existing_receivable = self.env['property.accounts.receivable'].search([ ('lessee_id', '=', record.lessee_id.id), - ('due_date', '>', first_day_of_month), + ('due_date', '>=', first_day_of_month), ('due_date', '<=', last_day_of_month), ('management_type_id.name', '=', '租金'), ('contract_id', '=', record.id),