[FIX] check number not assigned correctly

When printing a check from a payment the check number wizard shows the
number 1 for the next check... it should show the last check added one
+1, it doesn't because it doesn't exclude the account.payments without
checknumber.

This fix excludes the account.payments without checknumber so that it
doesn't shows "1" as the next check number when there are multiple new
checks to be printed

X-original-commit: adfb8299141cb8fe9883741c43871a51f849655e
This commit is contained in:
Andres Calle
2021-04-03 10:18:26 +00:00
parent 2e1689ef47
commit 176bf1442b
@@ -123,6 +123,7 @@ class AccountPayment(models.Model):
FROM account_payment payment
JOIN account_move move ON movE.id = payment.move_id
WHERE journal_id = %(journal_id)s
AND check_number IS NOT NULL
ORDER BY check_number::INTEGER DESC
LIMIT 1
""", {