Skip to content

[IMP] account: Group Payment: Change memo to PAY/XXXX #4805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions addons/account/models/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
}),
)

Expand Down Expand Up @@ -272,8 +272,8 @@ 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
When in need of a group payment communication reference (several invoices paid at the same time)
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()
Expand Down
22 changes: 11 additions & 11 deletions addons/account/tests/test_account_payment_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'), [
Expand Down Expand Up @@ -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'), [
Expand Down Expand Up @@ -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'), [
Expand Down Expand Up @@ -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'), [
Expand Down Expand Up @@ -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'), [
Expand Down Expand Up @@ -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'), [
Expand Down Expand Up @@ -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,
},
])
Expand Down Expand Up @@ -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,
},
{
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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):
Expand Down