diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot
index b99fb700a41c82362f9b9da06b3a36566a427fa7..741bd6bace7285eaf591b1d8a576154cbbada045 100644
--- a/addons/account/i18n/account.pot
+++ b/addons/account/i18n/account.pot
@@ -1104,6 +1104,13 @@ msgstr ""
 msgid "A line cannot have both children and a groupby value (line '%s')."
 msgstr ""
 
+#. module: account
+#: code:addons/account/models/account_move.py:0
+#, python-format
+msgid ""
+"A line of this move is using a deprecated account, you cannot post it."
+msgstr ""
+
 #. module: account
 #: code:addons/account/models/account_payment.py:0
 #, python-format
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index 224568736f72aea3cd868c0d34f5bf7e98a93295..e8a000905066a08dba11164fd1db6a79afa8973a 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -3270,6 +3270,9 @@ class AccountMove(models.Model):
                     move.currency_id.name
                 ))
 
+            if move.line_ids.account_id.filtered(lambda account: account.deprecated):
+                raise UserError(_("A line of this move is using a deprecated account, you cannot post it."))
+
             affects_tax_report = move._affect_tax_report()
             lock_dates = move._get_violated_lock_dates(move.date, affects_tax_report)
             if lock_dates:
diff --git a/addons/account/tests/test_account_move_out_invoice.py b/addons/account/tests/test_account_move_out_invoice.py
index 1ca34354b2c5f8b72f0079375d48b484c5eebd7c..61879d19b2938c8506b04c3b6b36d70d769bafe6 100644
--- a/addons/account/tests/test_account_move_out_invoice.py
+++ b/addons/account/tests/test_account_move_out_invoice.py
@@ -3333,3 +3333,22 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
         self.assertEqual(invoice.amount_untaxed, 82.64)
         self.assertEqual(invoice.amount_tax, 17.36)
         self.assertEqual(len(invoice.invoice_line_ids), 2)
+
+    def test_out_invoice_depreciated_account(self):
+        move = self.env['account.move'].create({
+            'move_type': 'out_invoice',
+            'currency_id': self.currency_data['currency'].id,
+            'partner_id': self.partner_a.id,
+            'journal_id': self.company_data['default_journal_sale'].id,
+            'invoice_line_ids': [
+                (0, 0, {
+                    'name': 'My super product.',
+                    'quantity': 1.0,
+                    'price_unit': 750.0,
+                    'account_id': self.product_a.property_account_income_id.id,
+                })
+            ],
+        })
+        self.product_a.property_account_income_id.deprecated = True
+        with self.assertRaises(UserError), self.cr.savepoint():
+            move.action_post()