Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] account: log error in chatter when importing xml #163849

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion addons/account/i18n/account.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6040,7 +6040,9 @@ msgstr ""
#. odoo-python
#: code:addons/account/models/account_move.py:0
#, python-format
msgid "Error importing attachment '%s' as invoice (decoder=%s)"
msgid ""
"Error importing attachment '%s' as invoice (decoder=%s). Check the file "
"itself, or read the application logs for more information."
msgstr ""

#. module: account
Expand Down
7 changes: 6 additions & 1 deletion addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -3184,7 +3184,12 @@ def add_file_data_results(file_data, invoice):
except RedirectWarning:
raise
except Exception:
message = _("Error importing attachment '%s' as invoice (decoder=%s)", file_data['filename'], decoder.__name__)
message = _(
"Error importing attachment '%s' as invoice (decoder=%s). Check the file itself, or read the "
"application logs for more information.",
file_data['filename'],
decoder.__name__,
)
invoice.sudo().message_post(body=message)
_logger.exception(message)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So let's add the traceback into the log then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already what we do: _logger.exception will print the traceback (if you wonder how: by using sys.exc_info())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if we just want to keep the traceback in the logs, we should probably just close this PR :/


Expand Down