Skip to content
Snippets Groups Projects
Commit 531147bb authored by Yolann Sabaux's avatar Yolann Sabaux
Browse files

[FIX] account_check_printing: enable increment in new payment

Steps to reproduce:
- Create a new journal Bank
- In Sequence, find the 'New Bank Check" and edit it so the sequence can be 10 number digits long
- Create a Vendor Payments with the the New Banck and Check as a method
- Click on Print a check
- Set the check number to 2147483648 and validate
- Create a new payment with the check method
- Click on Print a check

Issue:
Error is raised

Cause:
As for https://github.com/odoo/odoo/pull/112832

 there is a second check in order to increment the check number

opw-3140973

closes odoo/odoo#114416

X-original-commit: 364bc769
Signed-off-by: default avatarJohn Laterre (jol) <jol@odoo.com>
parent 012dae67
No related branches found
No related tags found
No related merge requests found
......@@ -142,7 +142,7 @@ class AccountPayment(models.Model):
JOIN account_move move ON movE.id = payment.move_id
WHERE journal_id = %(journal_id)s
AND payment.check_number IS NOT NULL
ORDER BY payment.check_number::INTEGER DESC
ORDER BY payment.check_number::BIGINT DESC
LIMIT 1
""", {
'journal_id': self.journal_id.id,
......
......@@ -163,13 +163,19 @@ class TestPrintCheck(AccountTestInvoicingCommon):
Make sure we can use integer of more than 2147483647 in check sequence
limit of `integer` type in psql: https://www.postgresql.org/docs/current/datatype-numeric.html
"""
payment = self.env['account.payment'].create({
vals = {
'payment_type': 'outbound',
'partner_type': 'supplier',
'amount': 100.0,
'journal_id': self.company_data['default_journal_bank'].id,
'payment_method_line_id': self.payment_method_line_check.id,
})
}
payment = self.env['account.payment'].create(vals)
payment.action_post()
self.assertTrue(payment.write({'check_number': '2147483647'}))
self.assertTrue(payment.write({'check_number': '2147483648'}))
payment_2 = self.env['account.payment'].create(vals)
payment_2.action_post()
action_window = payment_2.print_checks()
self.assertEqual(action_window['context']['default_next_check_number'], '2147483649', "Check number should have been incremented without error.")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment