Skip to content

[FIX] err is reinitialized since used in except Exception#10

Closed
remi-filament wants to merge 1 commit into
akretion:18.0from
lefilament:18.0-fix-l10n_fr_einvoicing
Closed

[FIX] err is reinitialized since used in except Exception#10
remi-filament wants to merge 1 commit into
akretion:18.0from
lefilament:18.0-fix-l10n_fr_einvoicing

Conversation

@remi-filament

@remi-filament remi-filament commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

When import fails,
an exception is caught by

This uses err as Exception and therefore err does not exist anymore when you go back to execution later and if err: on line 624 raises a traceback :

2026-06-16 12:25:50,742 210193 ERROR test_factu_elec18 odoo.http: Exception during request handling. 
Traceback (most recent call last):
  File "/home/user/dev/odoo18/ocb/odoo/http.py", line 2577, in __call__
    response = request._serve_db()
               ^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/ocb/odoo/http.py", line 2104, in _serve_db
    return self._transactioning(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/ocb/odoo/http.py", line 2167, in _transactioning
    return service_model.retrying(func, env=self.env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/ocb/odoo/service/model.py", line 157, in retrying
    result = func()
             ^^^^^^
  File "/home/user/dev/odoo18/ocb/odoo/http.py", line 2134, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/ocb/odoo/http.py", line 2382, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/ocb/odoo/addons/base/models/ir_http.py", line 333, in _dispatch
    result = endpoint(**request.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/ocb/odoo/http.py", line 754, in route_wrapper
    result = endpoint(self, *args, **params_ok)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/ocb/addons/web/controllers/dataset.py", line 42, in call_button
    action = call_kw(request.env[model], method, args, kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/ocb/odoo/api.py", line 535, in call_kw
    result = getattr(recs, name)(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/other_repos/fr-einvoicing/l10n_fr_einvoicing/models/account_journal.py", line 17, in fr_einvoicing_run_import_button
    action = self.company_id.fr_ctc_run_import_log_action("Journal button")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/other_repos/fr-einvoicing/l10n_fr_einvoicing/models/res_company.py", line 267, in fr_ctc_run_import_log_action
    _, result = self.fr_ctc_run_import_log(origin)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/other_repos/fr-einvoicing/l10n_fr_einvoicing/models/res_company.py", line 314, in fr_ctc_run_import_log
    flows = self._fr_ctc_run_import(session, result)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/dev/odoo18/other_repos/fr-einvoicing/l10n_fr_einvoicing/models/res_company.py", line 410, in _fr_ctc_run_import
    flow._process(result)
  File "/home/user/dev/odoo18/other_repos/fr-einvoicing/l10n_fr_einvoicing/models/fr_einvoicing_flow.py", line 624, in _process
    if err:
       ^^^
UnboundLocalError: cannot access local variable 'err' where it is not associated with a value

@ak-git-bot

Copy link
Copy Markdown

Hi @alexis-via,
some modules you are maintaining are being modified, check this out!

@Lukwos

Lukwos commented Jul 2, 2026

Copy link
Copy Markdown

LGTM

@remi-filament

remi-filament commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Covered in #22

@remi-filament
remi-filament deleted the 18.0-fix-l10n_fr_einvoicing branch July 12, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:l10n_fr_einvoicing Module l10n_fr_einvoicing series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants