From 3a58da28ddd74650a0700214793332e2df4aa6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Neto?= Date: Sun, 8 Dec 2024 14:01:55 -0300 Subject: [PATCH] [FIX] l10n_br_sale: nothing to invoice error --- l10n_br_sale/models/sale_order.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/l10n_br_sale/models/sale_order.py b/l10n_br_sale/models/sale_order.py index 15f2d34d52b4..6026eabb62a8 100644 --- a/l10n_br_sale/models/sale_order.py +++ b/l10n_br_sale/models/sale_order.py @@ -164,9 +164,12 @@ def _create_invoices(self, grouped=False, final=False, date=None): moves |= super()._create_invoices( grouped=grouped, final=final, date=date ) - except UserError: - # TODO: Avoid only when it is "nothing to invoice error" - pass + except UserError as e: + if "There is nothing to invoice!" in str(e): + # Skip for now, will review later + pass + else: + raise if not moves and self._context.get("raise_if_nothing_to_invoice", True): raise UserError(self._nothing_to_invoice_error_message())