Merge pull request #365 from akretion/10-better-error

[10.0] Explicit error when bank account is missing on bank journal
This commit is contained in:
Adrien Peiffer (ACSONE)
2017-05-31 11:53:24 +02:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@@ -9,7 +9,7 @@
{
'name': 'Account Payment Order',
'version': '10.0.1.1.2',
'version': '10.0.1.1.3',
'license': 'AGPL-3',
'author': "ACSONE SA/NV, "
"Therp BV, "

View File

@@ -202,6 +202,12 @@ class AccountPaymentOrder(models.Model):
if not order.journal_id:
raise UserError(_(
'Missing Bank Journal on payment order %s.') % order.name)
if (
order.payment_method_id.bank_account_required and
not order.journal_id.bank_account_id):
raise UserError(_(
"Missing bank account on bank journal '%s'.")
% order.journal_id.display_name)
if not order.payment_line_ids:
raise UserError(_(
'There are no transactions on payment order %s.')