diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py index 5521a172d..bcf858e4e 100644 --- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py +++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py @@ -394,12 +394,23 @@ class PropertyReconciliationWizard(models.Model): is_reconciliation = True else: is_reconciliation = False + + if is_reconciliation: + # 完全对完:覆盖备注 + final_remark = line.remake + else: + # 没对完:若有历史备注则换行追加,否则直接使用新备注 + if receivable and receivable.remark: + final_remark = f"{receivable.remark}\n{line.remake}" + else: + final_remark = line.remake + if line.collection_type != 'penalty': receivable.delivered1 = receivable.delivered1 + line.amount receivable.write({ 'is_reconciliation': is_reconciliation, 'payout_date': rec.actual_date, - 'remark': line.remake, + 'remark': final_remark, 'reconciliation_time': fields.Datetime.now(), 'receivable_log': f'当前登录人{rec.env.user.name}于{fields.Datetime.now()}对户名为{rec.bank_id.name_account}进行对账操作,对账应收金额为{rec.receivable_total},实际金额为{rec.actual_total}' }) @@ -426,6 +437,16 @@ class PropertyReconciliationWizard(models.Model): existing_record = self.env['property.accounts.receivable'].search(check_domain) is_reconciliation = round(line.amount,2) == round(line.rent, 2) + if is_reconciliation: + # 对账状态:直接使用新备注覆盖 + final_remark = line.remake + else: + # 非对账状态:若有历史备注则换行追加,否则直接使用新备注 + if existing_record and existing_record.remark: + final_remark = f"{existing_record.remark}\n{line.remake}" + else: + final_remark = line.remake + if not existing_record: domain2 = [ ('due_date', '=', line.due_date), @@ -443,7 +464,7 @@ class PropertyReconciliationWizard(models.Model): 'delivered1': line.amount, 'payout_date': rec.actual_date if (line.rent == line.amount and line.rent != 0) else None, 'original_amount': line.rent, - 'remark': line.remake, + 'remark': final_remark, 'reconciliation_time': fields.Datetime.now(), }) self.env['receivable.modify.line'].create({ @@ -459,7 +480,7 @@ class PropertyReconciliationWizard(models.Model): 'due_date_end': extract_end_date, 'is_reconciliation': is_reconciliation, 'payout_date': rec.actual_date if (line.rent == line.amount and line.rent != 0) else None, - 'remark': line.remake, + 'remark': final_remark, 'bank_id': rec.bank_id.id if line.amount != 0 else None, 'is_write': True if line.amount != 0 else None, 'reconciliation_time': fields.Datetime.now(),