diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index 70e005d3ac7..78641a3847c 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -10986,6 +10986,12 @@ msgid "" "either post or delete them." msgstr "" +#. module: account +#: code:addons/account/models/account_payment.py:0 +#, python-format +msgid "There is more than one receivable/payable account in the concerned invoices. You cannot group payments in that case." +msgstr "" + #. module: account #: code:addons/account/models/account_payment.py:0 #, python-format diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 653256e3799..4d92913892c 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -744,6 +744,10 @@ class payment_register(models.TransientModel): raise UserError(_("You can only register at the same time for payment that are all inbound or all outbound")) if any(inv.company_id != invoices[0].company_id for inv in invoices): raise UserError(_("You can only register at the same time for payment that are all from the same company")) + # Check the destination account is the same + destination_account = invoices.line_ids.filtered(lambda line: line.account_internal_type in ('receivable', 'payable')).mapped('account_id') + if len(destination_account) > 1: + raise UserError(_('There is more than one receivable/payable account in the concerned invoices. You cannot group payments in that case.')) if 'invoice_ids' not in rec: rec['invoice_ids'] = [(6, 0, invoices.ids)] if 'journal_id' not in rec: