diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot
index 4023f1757fbf7013c149796d401835092f40ab8f..b434ae11906e970032556a9ed6028d12355f1628 100644
--- a/addons/account/i18n/account.pot
+++ b/addons/account/i18n/account.pot
@@ -1043,6 +1043,13 @@ msgid ""
 "                related to the day-to-day business."
 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 d983e84df8213a65a6b27eac4047e66d23f13da0..c40a09dccb7595bc9b3d6ab34567afed59924340 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -3048,6 +3048,9 @@ class AccountMove(models.Model):
                 raise UserError(_("You cannot validate an invoice with an inactive currency: %s",
                                   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."))
+
             # Handle case when the invoice_date is not set. In that case, the invoice_date is set at today and then,
             # lines are recomputed accordingly.
             # /!\ 'check_move_validity' must be there since the dynamic lines will be recomputed outside the 'onchange'
diff --git a/addons/account/tests/test_account_move_out_invoice.py b/addons/account/tests/test_account_move_out_invoice.py
index 7875daaa076afbc938c15bbb08c211a29b65beaa..0f61961cccf7c239df5e623fc283057774b65ca1 100644
--- a/addons/account/tests/test_account_move_out_invoice.py
+++ b/addons/account/tests/test_account_move_out_invoice.py
@@ -3450,3 +3450,22 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon):
                 },
             ],
         )
+
+    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()