diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index e9d88412c7f..4e3608fad07 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -13262,6 +13262,14 @@ msgstr "" msgid "The payment's currency." msgstr "" +#. module: account +#: code:addons/account/models/account_move.py:0 +#, python-format +msgid "" +"The recipient bank account link to this invoice is archived.\n" +"So you cannot confirm the invoice." +msgstr "" + #. module: account #: model:ir.model.fields,help:account.field_account_reconcile_model__match_partner_category_ids #: model:ir.model.fields,help:account.field_account_reconcile_model_template__match_partner_category_ids diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 4f8362663d1..ff561ad737d 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2934,6 +2934,8 @@ class AccountMove(models.Model): if not self.env.su and not self.env.user.has_group('account.group_account_invoice'): raise AccessError(_("You don't have the access rights to post an invoice.")) for move in to_post: + if move.partner_bank_id and not move.partner_bank_id.active: + raise UserError(_("The recipient bank account link to this invoice is archived.\nSo you cannot confirm the invoice.")) if move.state == 'posted': raise UserError(_('The entry %s (id %s) is already posted.') % (move.name, move.id)) if not move.line_ids.filtered(lambda line: not line.display_type):