odoo / docker

Other
955 stars 1.54k forks source link

Getting errors on latest update #437

Open guythnick opened 1 year ago

guythnick commented 1 year ago

Have been running odoo:16 successfully for a while now. Some update in Feb 2023 has caused the page to just be white. No images work, and when clicking on a link from the splash page it will show only a white screen. When trying to navigate to a page, the below error is shown:

023-03-05 21:40:33,632 1 INFO oodo werkzeug: 192.168.1.229 - - [05/Mar/2023 21:40:33] "GET /web/assets/476-b190d5b/web.assets_backend.min.js HTTP/1.1" 500 - 4 0.002 0.004
2023-03-05 21:40:33,646 1 ERROR oodo odoo.http: Exception during request handling. 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1990, in __call__
    response = request._serve_db()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1584, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 134, in retrying
    result = func()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1613, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1726, in dispatch
    return self.request.registry['ir.http']._dispatch(endpoint)
  File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_http.py", line 235, in _dispatch
    response = super()._dispatch(endpoint)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 149, in _dispatch
    result = endpoint(**request.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 699, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/binary.py", line 107, in content_assets
    stream = request.env['ir.binary']._get_stream_from(record, 'raw', filename)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_binary.py", line 129, in _get_stream_from
    stream = self._record_to_stream(record, field_name)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_binary.py", line 73, in _record_to_stream
    return Stream.from_attachment(record)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 475, in from_attachment
    stat = os.stat(self.path)
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/odoo/.local/share/Odoo/filestore/oodo/08/08a77663181c46155da9062492e90c60adbbce66'
2023-03-05 21:40:33,646 1 INFO oodo werkzeug: 192.168.1.229 - - [05/Mar/2023 21:40:33] "GET /web/assets/114-6e7f40c/web.assets_backend_prod_only.min.js HTTP/1.1" 500 - 4 0.002 0.004
Moscardi commented 1 year ago

Sorry for my English, I'm using google translate here.

I believe this error was caused by changing the check method of the ir_attchment model. Apparently this modification added the following lines:

if not self.env.is_system() and (res_field or (not res_id and create_uid != self.env.uid)):
    raise AccessError(_("Sorry, you are not allowed to access this document."))

As far as I understand, if the file is linked to a certain field or not linked to a specific record and the user who uploaded it is different from the current one, the code will display an error.

In my case, access to the file was done by a cron, so to solve the problem I linked the system administration role (base.group_system) to the user linked to cron, so that he could access the file even though he was not the its creator.

guythnick commented 1 year ago

In my case, access to the file was done by a cron, so to solve the problem I linked the system administration role (base.group_system) to the user linked to cron, so that he could access the file even though he was not the its creator.

@Moscardi , can you explain where you made this change? Was it in the database or the docker image file system?

Moscardi commented 1 year ago

Looking at the server logs I was able to identify which cron job was accessing the document. Upon identification, I went to the Odoo interface that manages the cron tasks and looked at the "Scheduler User" field to see which user is being used by cron to perform the accesses.

Knowing who the user is, it is possible to go to Odoo's user management and grant access to "settings" in the "administration" category. This access is what has the "base.group_system" identifier that I mentioned earlier.

image

Remembering that to make all these modifications you need to have developer access to Odoo.

guythnick commented 1 year ago

Ah, I see. I don't think that is the same issue as I am having. In my case, pages do not even display in the browser.

Moscardi commented 1 year ago

Jeez, it's true, now that I've seen it, the error message is very similar but in my case it was an access error, in yours it's showing as file not found.

Sorry, it was my fault, I should have paid more attention and read the issue more calmly.

lathama commented 5 months ago

@guythnick I just read your issue. So you upgraded ("pulled") a new Odoo:16 image and this happened to you?

Can you share: