Wednesday, June 12, 2024
4 changes · 17.0
Resolved issues and error corrections
Odoo now records malformed XML or PDF invoice attachments as informational log entries instead of warnings or errors. This keeps administrators informed without causing automated tests or monitoring to fail for non-critical attachment issues, while users still receive upload feedback.
Original PR description
Previously, when the attempting to decode a pdf or xml file as EDI attachment, if an xml or pdf file was malformed, we would log a warning (for pdf) or error (for xml). There are tests in which we…
Previously, when the attempting to decode a pdf or xml file as EDI attachment, if an xml or pdf file was malformed, we would log a warning (for pdf) or error (for xml). There are tests in which we post messages to the chatter with an XML file with embedded PDF which is actually a generated report. These tests don't actually generate a valid PDF because wkhtmltopdf isn't available in those tests, but these tests also do not particularly care that the PDF is valid. Similarly, there are tests that post messages with xml attachments that don't contain valid xml but they also do not care that the xml in valid in those flows. The linked enterprise PR adds an override of _message_post that will attempt to decode posted attachments so that it can take some action based on their contents. While this works perfectly fine and doesn't break any behaviour, as the decoding methods will simply return an empty list when the attachments are malformed, because they log warnings or errors, it causes tests/runbot to fail. The information that an invalid xml or pdf was uploaded is not particularly useful or urgent information for the server admin, and users already get a notification when uploading a malformed file. As such, this commit changes these warning/exception logs to simple info logs. This means this information remains available but isn't given disporoportionate importance in the logs, and doesn't cause tests that work perfecly fine to fail. task-3731034
Accounting XML imports now add a chatter note when an import fails, helping users see that something went wrong and where to find details. This restores helpful feedback that can reduce confusion and unnecessary support requests.
Original PR description
Before c02d8b177f04d6a7f9311d8cb621bb5fe02e70e6, an error occuring during the import was logged in the chatter. This commit restores this behaviour, as it is highly helpful to have the error message (it could probably avoid customers to open tickets in some cases). Ticket link: https://www.odoo.com/web#model=project.task&id=3874857 opw-3874857
Creating or discarding a new journal from a vendor payment could previously trigger an error and interrupt the user. The payment flow now falls back to the default company when no journal is selected, keeping payment entry stable.
Original PR description
This traceback arises when the user tries to create a new journal from the payment. To reproduce this issue: 1) Install `accounting` 2) Create a new payment from `Accounting/vendors/payments` 3) save…
This traceback arises when the user tries to create a new journal from the payment.
To reproduce this issue:
1) Install `accounting`
2) Create a new payment from `Accounting/vendors/payments`
3) save the record and now remove the `journal` or make the `journal` field empty
5) A traceback arises.
Error:-
```
KeyError: ('res.company', <function Company.__accessible_branches at 0x7fabdfc69c60>, (1,), False, 2)
File "odoo/tools/cache.py", line 99, in lookup
r = d[key]
File "<decorator-gen-8>", line 2, in __getitem__
File "odoo/tools/func.py", line 87, in locked
return func(inst, *args, **kwargs)
File "odoo/tools/lru.py", line 34, in __getitem__
a = self.d[obj]
ValueError: not enough values to unpack (expected 1, got 0)
File "odoo/models.py", line 5941, in ensure_one
_id, = self._ids
ValueError: Expected singleton: res.company()
File "odoo/http.py", line 2251, in __call__
response = request._serve_db()
File "odoo/http.py", line 1826, in _serve_db
return self._transactioning(_serve_ir_http, readonly=ro)
File "odoo/http.py", line 1847, in _transactioning
return service_model.retrying(func, env=self.env)
File "odoo/service/model.py", line 134, in retrying
result = func()
File "odoo/http.py", line 1824, in _serve_ir_http
return self._serve_ir_http(rule, args)
File "odoo/http.py", line 1832, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "odoo/http.py", line 2057, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "odoo/addons/base/models/ir_http.py", line 222, in _dispatch
result = endpoint(**request.params)
File "odoo/http.py", line 740, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "addons/web/controllers/dataset.py", line 34, in call_kw
return self._call_kw(model, method, args, kwargs)
File "addons/web/controllers/dataset.py", line 30, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "odoo/api.py", line 458, in call_kw
result = getattr(recs, name)(*args, **kwargs)
File "addons/web/models/models.py", line 1074, in onchange
todo = [
File "addons/web/models/models.py", line 1077, in <listcomp>
if field_name not in done and snapshot0.has_changed(field_name)
File "addons/web/models/models.py", line 1190, in has_changed
return self[field_name] != self.record[field_name]
File "odoo/models.py", line 6664, in __getitem__
return self._fields[key].__get__(self, self.env.registry[self._name])
File "odoo/fields.py", line 1138, in __get__
self.recompute(record)
File "odoo/fields.py", line 1353, in recompute
apply_except_missing(self.compute_value, recs)
File "odoo/fields.py", line 1326, in apply_except_missing
func(records)
File "odoo/fields.py", line 1375, in compute_value
records._compute_field_value(self)
File "addons/mail/models/mail_thread.py", line 416, in _compute_field_value
return super()._compute_field_value(field)
File "odoo/models.py", line 4982, in _compute_field_value
fields.determine(field.compute, self)
File "odoo/fields.py", line 102, in determine
return needle(*args)
File "addons/account/models/account_payment.py", line 369, in _compute_reconciliation_status
liquidity_lines, counterpart_lines, writeoff_lines = pay._seek_for_lines()
File "addons/account/models/account_payment.py", line 192, in _seek_for_lines
if line.account_id in self._get_valid_liquidity_accounts():
File "addons/account/models/account_payment.py", line 211, in _get_valid_liquidity_accounts
accessible_branches = journal_comp.with_company(journal_comp)._accessible_branches()
File "odoo/addons/base/models/res_company.py", line 420, in _accessible_branches
return self.browse(self.__accessible_branches())
File "<decorator-gen-107>", line 2, in __accessible_branches
File "odoo/tools/cache.py", line 104, in lookup
value = d[key] = self.method(*args, **kwargs)
File "odoo/addons/base/models/res_company.py", line 402, in __accessible_branches
self.ensure_one()
File "odoo/models.py", line 5944, in ensure_one
raise ValueError("Expected singleton: %s" % self)
```
When the user removes the journal, the company ID is taken from the journal, which leads to a traceback from the line below.
https://github.com/odoo/odoo/blob/53d6d795ddf6cc9e470bfeb48bb31bc728acedbe/addons/account/models/account_payment.py#L207-L208
After applying this commit, resolve this issue by taking the default company,
when there is no journal.
sentry-5054332731Fixed an issue in the Documents module where the delete button (X) for tags was hidden when tag names were very long. The fix adjusts how the tag table is displayed so that long tag names don't cause the table to expand and hide the delete button, improving usability when working with documents that have lengthy tags.
Original PR description
By default, tables automatically adjust their width to accommodate the content of their cells, That causes table row to grow in size and make "X" button invisible. Here I'm constraining table layout so it doesn't matter how long the content of columns is [Reproduce] - Install documents - Add tag with a very long name - Go to all Documents, Select a document, Add the tag on a doc - BUG: "X" button is not visible* opw-3937326 BEFORE / AFTER https://github.com/odoo/enterprise/assets/33809926/5f2fc861-cd68-4478-8b8b-b8843b7d4944 Forward-Port-Of: odoo/enterprise#63279