[Web favicon] gives 500 internal server error when restoring from backup -> (AttributeError: 'res.company' object has no attribute '_get_favicon').

Open
#3,289 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
javascript, python
Domain
backend, web-dev

Research direction

Start by reading the web_favicon module and the website.layout template identified in the traceback; trace where _get_favicon is defined and how the restored database loads the module. Reproduce the restore on Odoo 18.0 with the module installed, then confirm the database can load without the 500 error.

Written by the indexing model from the issue text.

Description

bug

Module

web_favicon

Describe the bug

I installed the module to test and since then I can't use the gui anymore as it gives a "500: internal server error". Did make a backup but that seems to be corrupted also.

To Reproduce

Affected versions: 18.0

Steps to reproduce the behavior:

  1. Install the module
  2. Add a favicon in both the favicon field in company and in website settings
  3. Make a backup of the database (zip)
  4. Restore the database (in a clean odoo environment, off course with all addons in the addon directory that were alsop present when making the backup
  5. Select the database in database manager
  6. You'll see the 500 page and below error appears in the log

Expected behavior
No Internal server error

Additional context
I tried adding a favicon column in table res_company (directly in the database) but this didn't solve it, unfortunately. As I can't get in the gui I also can't take a look in the technical part of views/models etc where the field is mentioned.

So I have 2 questions:

  1. Does anyone know where to look so the 500 doesn't appear instantly when selecting the database in the database manager? Either in changing something directly in the database or CLI?
  2. Might this be a bug in the module (I think so as I tested with an old backup and the same happened

Error traceback

> Traceback (most recent call last):

File "<2011>", line 1931, in template_2011
File "<2011>", line 1309, in template_2011_content
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_qweb.py", line 2533, in _load_values
return get_value()
^^^^^^^^^^^
File "<2011>", line 1299, in template_2011_t_cache_0_cache
File "<2011>", line 565, in template_2011_t_cache_0
AttributeError: 'res.company' object has no attribute '_get_favicon'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 2554, in call
response = request._serve_db()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/http.py", line 2081, in _serve_db
return self._transactioning(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/http.py", line 2144, in _transactioning
return service_model.retrying(func, env=self.env)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 156, in retrying
result = func()
^^^^^^
File "/usr/lib/python3/dist-packages/odoo/http.py", line 2111, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/http.py", line 2272, in dispatch
return self.request.registry['ir.http']._dispatch(endpoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 335, in dispatch
result.flatten()
File "/usr/lib/python3/dist-packages/odoo/tools/facade.py", line 83, in wrap_func
func(self.wrapped
, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1418, in flatten
self.response.append(self.render())
^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1410, in render
return request.env["ir.ui.view"]._render_template(self.template, self.qcontext)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_ui_view.py", line 453, in _render_template
return super()._render_template(template, values=values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 2218, in _render_template
return self.env['ir.qweb']._render(template, values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/tools/profiler.py", line 313, in _tracked_method_render
return method_render(self, template, values, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_qweb.py", line 607, in _render
result = ''.join(rendering)
^^^^^^^^^^^^^^^^^^
File "<185>", line 263, in template_185
File "<185>", line 252, in template_185_content
File "<184>", line 51, in template_184
File "<184>", line 40, in template_184_content
File "<2011>", line 1939, in template_2011
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
AttributeError: 'res.company' object has no attribute '_get_favicon'
Template: website.layout
Path: /t/html/head/link[3]
Node:

Dominant language
JavaScript
Stars
1.2k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
30

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OCA/web

All issues in OCA/web

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.