diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py index 84444dc3fca..6d5625e64e3 100644 --- a/addons/account_check_printing/models/account_payment.py +++ b/addons/account_check_printing/models/account_payment.py @@ -160,7 +160,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, diff --git a/addons/account_check_printing/tests/test_print_check.py b/addons/account_check_printing/tests/test_print_check.py index b62f184dfc0..fa100ffc7a0 100644 --- a/addons/account_check_printing/tests/test_print_check.py +++ b/addons/account_check_printing/tests/test_print_check.py @@ -180,13 +180,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.")