From 13730eeeaaa4df38439911005966ec67ef4aa952 Mon Sep 17 00:00:00 2001 From: "Ahmad (alah)" Date: Mon, 30 Jun 2025 17:34:17 +0200 Subject: [PATCH] [IMP] account: Change memo to PAY/XXXX When you create a payment in group in V18+, we generate a new payment memo using a BATCH/XXX prefix. It can be confusing as we have a Batch Payment feature, but it has nothing to do with it. This commit aims to replace "BATCH/YYYY/XXXX" by "PAY/YYYY/XXXX". Task: 4908895 --- addons/account/models/company.py | 4 ++-- .../tests/test_account_payment_register.py | 22 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 75d7d7dc8f259..43d0aef75a7b9 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -164,7 +164,7 @@ class ResCompany(models.Model): 'padding': 5, 'use_date_range': True, 'company_id': self.id, - 'prefix': 'BATCH/%(year)s/', + 'prefix': 'PAY/%(year)s/', }), ) @@ -273,7 +273,7 @@ class ResCompany(models.Model): def get_next_batch_payment_communication(self): ''' When in need of a batch payment communication reference (several invoices paid at the same time) - use batch_payment_sequence_id to get it (eventually create it first): e.g BATCH/2024/00001 + use batch_payment_sequence_id to get it (eventually create it first): e.g PAY/2024/00001 ''' self.ensure_one() return self.sudo().batch_payment_sequence_id.next_by_id() diff --git a/addons/account/tests/test_account_payment_register.py b/addons/account/tests/test_account_payment_register.py index 0cd96db6a707f..4e2e519fc778e 100644 --- a/addons/account/tests/test_account_payment_register.py +++ b/addons/account/tests/test_account_payment_register.py @@ -202,7 +202,7 @@ def test_register_payment_single_batch_grouped_keep_open_lower_amount(self): })._create_payments() self.assertRecordValues(payments, [{ - 'memo': Like(f'BATCH/{self.current_year}/...'), + 'memo': Like(f'PAY/{self.current_year}/...'), 'payment_method_line_id': self.inbound_payment_method_line.id, }]) self.assertRecordValues(payments.move_id.line_ids.sorted('balance'), [ @@ -235,7 +235,7 @@ def test_register_payment_single_batch_grouped_keep_open_higher_amount(self): })._create_payments() self.assertRecordValues(payments, [{ - 'memo': Like(f'BATCH/{self.current_year}/...'), + 'memo': Like(f'PAY/{self.current_year}/...'), 'payment_method_line_id': self.inbound_payment_method_line.id, }]) self.assertRecordValues(payments.move_id.line_ids.sorted('balance'), [ @@ -270,7 +270,7 @@ def test_register_payment_single_batch_grouped_writeoff_lower_amount_debit(self) })._create_payments() self.assertRecordValues(payments, [{ - 'memo': Like(f'BATCH/{self.current_year}/...'), + 'memo': Like(f'PAY/{self.current_year}/...'), 'payment_method_line_id': self.inbound_payment_method_line.id, }]) self.assertRecordValues(payments.move_id.line_ids.sorted('balance'), [ @@ -313,7 +313,7 @@ def test_register_payment_single_batch_grouped_writeoff_higher_amount_debit(self })._create_payments() self.assertRecordValues(payments, [{ - 'memo': Like(f'BATCH/{self.current_year}/...'), + 'memo': Like(f'PAY/{self.current_year}/...'), 'payment_method_line_id': self.inbound_payment_method_line.id, }]) self.assertRecordValues(payments.move_id.line_ids.sorted('balance'), [ @@ -356,7 +356,7 @@ def test_register_payment_single_batch_grouped_writeoff_lower_amount_credit(self })._create_payments() self.assertRecordValues(payments, [{ - 'memo': Like(f'BATCH/{self.current_year}/...'), + 'memo': Like(f'PAY/{self.current_year}/...'), 'payment_method_line_id': self.outbound_payment_method_line.id, }]) self.assertRecordValues(payments.move_id.line_ids.sorted('balance'), [ @@ -399,7 +399,7 @@ def test_register_payment_single_batch_grouped_writeoff_higher_amount_credit(sel })._create_payments() self.assertRecordValues(payments, [{ - 'memo': Like(f'BATCH/{self.current_year}/...'), + 'memo': Like(f'PAY/{self.current_year}/...'), 'payment_method_line_id': self.outbound_payment_method_line.id, }]) self.assertRecordValues(payments.move_id.line_ids.sorted('balance'), [ @@ -555,7 +555,7 @@ def test_register_payment_single_batch_grouped_with_credit_note(self): self.assertRecordValues(payments, [ { - 'memo': Like(f'BATCH/{self.current_year}/...'), + 'memo': Like(f'PAY/{self.current_year}/...'), 'payment_method_line_id': self.outbound_payment_method_line.id, }, ]) @@ -676,7 +676,7 @@ def test_register_payment_multi_batches_grouped(self): self.assertRecordValues(payments, [ { - 'memo': Like(f'BATCH/{self.current_year}/...'), + 'memo': Like(f'PAY/{self.current_year}/...'), 'payment_method_line_id': self.outbound_payment_method_line.id, }, { @@ -1747,7 +1747,7 @@ def test_installment_mode_multiple_batches(self): 'installments_mode': 'next', 'installments_switch_amount': 1333.33, 'currency_id': self.company.currency_id.id, # Different currencies, so we get the company's one - 'communication': Like(f'BATCH/{self.current_year}/...'), + 'communication': Like(f'PAY/{self.current_year}/...'), }]) wizard = self.env['account.payment.register'].with_context( @@ -1784,7 +1784,7 @@ def test_installment_mode_multiple_batches(self): 'payment_difference': 0.5, 'installments_mode': 'next', 'installments_switch_amount': 357.83, # 24.5 for in_invoice_epd_applied + 1000 / 3 (rate) for the second - 'communication': Like(f'BATCH/{self.current_year}/...'), + 'communication': Like(f'PAY/{self.current_year}/...'), }]) # Clicking on the button to full gets the amount from js, so we need to put it by hand here @@ -1798,7 +1798,7 @@ def test_installment_mode_multiple_batches(self): 'payment_difference': 0.5, 'installments_mode': 'full', 'installments_switch_amount': 57.83, # The previous 'next' amount - 'communication': Like(f'BATCH/{self.current_year}/...'), + 'communication': Like(f'PAY/{self.current_year}/...'), }]) def test_payment_register_with_next_payment_date(self):