diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index 39bba7db5..dc52836af 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -147,49 +147,49 @@ class PropertyBankStatements(models.Model): def _get_reconciliation_vals(self, record): if record.name: dt = datetime.strptime(str(self.start_time), '%Y-%m-%d %H:%M:%S').date() - last_day = dt.replace(day=1) + relativedelta(months=1) - relativedelta(days=1) + first_day = dt.replace(day=1) + last_day = first_day + relativedelta(months=1) - relativedelta(days=1) total_rent_month = 0 - bank_lines = self.env['property.bank.line'].search([ - ('bank', '=', self.name), - ('tenant_id.name', '!=', False), + # 应收租金 + rent_ids = self.env['property.accounts.receivable'].search([ + ('lessee_id.name', '=', record.name_account), + ('management_type_id.name', '=', '租金'), + ('is_reconciliation', '=', False), + ('due_date', '>=', fields.Date.to_string(first_day)), + ('due_date', '<=', fields.Date.to_string(last_day)), + ]) + # 应收押金 + deposit_ids = self.env['property.accounts.receivable'].search([ + ('lessee_id.name', '=', record.name_account), + ('management_type_id.name', '=', '押金'), + ('is_reconciliation', '=', False), + ('due_date', '>=', fields.Date.to_string(first_day)), + ('due_date', '<=', fields.Date.to_string(last_day)), + ]) + # 应收管理费 + management_ids = self.env['property.accounts.receivable'].search([ + ('lessee_id.name', '=', record.name_account), + ('management_type_id.name', '=', '管理费'), + ('is_reconciliation', '=', False), + ('due_date', '>=', fields.Date.to_string(first_day)), + ('due_date', '<=', fields.Date.to_string(last_day)), + ]) + # 应收水费 + water_ids = self.env['property.accounts.receivable'].search([ + ('lessee_id.name', '=', record.name_account), + ('management_type_id.name', '=', '水费'), + ('is_reconciliation', '=', False), + ('due_date', '>=', fields.Date.to_string(first_day)), + ('due_date', '<=', fields.Date.to_string(last_day)), + ]) + # 应收电费 + electricity_ids = self.env['property.accounts.receivable'].search([ + ('lessee_id.name', '=', record.name_account), + ('management_type_id.name', '=', '电费'), + ('is_reconciliation', '=', False), + ('due_date', '>=', fields.Date.to_string(first_day)), + ('due_date', '<=', fields.Date.to_string(last_day)), ]) - if bank_lines: - tenant_id = bank_lines[0].tenant_id - # 应收租金 - rent_ids = self.env['property.accounts.receivable'].search([ - ('lessee_id', '=', tenant_id.id), - ('management_type_id.name', '=', '租金'), - ('is_reconciliation', '=', False), - ('due_date', '<=', fields.Date.to_string(last_day)), - ]) - # 应收押金 - deposit_ids = self.env['property.accounts.receivable'].search([ - ('lessee_id', '=', tenant_id.id), - ('management_type_id.name', '=', '押金'), - ('is_reconciliation', '=', False), - ('due_date', '<=', fields.Date.to_string(last_day)), - ]) - # 应收管理费 - management_ids = self.env['property.accounts.receivable'].search([ - ('lessee_id', '=', tenant_id.id), - ('management_type_id.name', '=', '管理费'), - ('is_reconciliation', '=', False), - ('due_date', '<=', fields.Date.to_string(last_day)), - ]) - # 应收水费 - water_ids = self.env['property.accounts.receivable'].search([ - ('lessee_id', '=', tenant_id.id), - ('management_type_id.name', '=', '水费'), - ('is_reconciliation', '=', False), - ('due_date', '<=', fields.Date.to_string(last_day)), - ]) - # 应收电费 - electricity_ids = self.env['property.accounts.receivable'].search([ - ('lessee_id', '=', tenant_id.id), - ('management_type_id.name', '=', '电费'), - ('is_reconciliation', '=', False), - ('due_date', '<=', fields.Date.to_string(last_day)), - ]) def create_reconciliation_vals(ids, collection_type_val, sequence_val): """ diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 3b28b82b9..518881bf1 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -122,10 +122,20 @@ class PropertyReconciliationWizard(models.Model): # 跳过金额为0的行 if line.amount == 0 and line.collection_type != 'penalty': continue - domain = [('lessee_id', '=', first_line.tenant_id.id), - ('is_reconciliation', '=', False), - ('is_suspend', '=', False), - ] + due_date = datetime.strptime(line.due_date, '%Y-%m-%d') + + first_day = due_date.replace(day=1) + last_day = (first_day + relativedelta(months=1)) - relativedelta(days=1) + first_day_str = first_day.strftime('%Y-%m-%d') + last_day_str = last_day.strftime('%Y-%m-%d') + + domain = [ + ('lessee_id', '=', first_line.tenant_id.id), + ('is_reconciliation', '=', False), + ('is_suspend', '=', False), + ('due_date', '>=', first_day_str), + ('due_date', '<=', last_day_str), + ] # 如果有物业信息 if line.property_id: domain.append(('property_id', '=', line.property_id.id)) diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml index 644f14d83..ef2245e9d 100644 --- a/yuthon_salary/views/inherit_hr_payslip_views.xml +++ b/yuthon_salary/views/inherit_hr_payslip_views.xml @@ -243,6 +243,9 @@ hr.payslip +
+
@@ -310,6 +313,9 @@ hr.payslip +
+
@@ -364,6 +370,9 @@ hr.payslip +
+
diff --git a/yuthon_salary/wizard/put_return_wizard.py b/yuthon_salary/wizard/put_return_wizard.py index 01acbdd53..b61ef4489 100644 --- a/yuthon_salary/wizard/put_return_wizard.py +++ b/yuthon_salary/wizard/put_return_wizard.py @@ -70,7 +70,7 @@ class PutSalaryWizard(models.TransientModel): ('payslip_run_id', '=', run.id) ]) if all(payslip.is_salary_push and not payslip.is_salary_release for payslip in run_payslips): - run.run_stage = 'individual_tax' + run.run_stage = 'to_be_signed' class ReturnSalaryWizard(models.TransientModel):