We are trying to override the default controller for the /web/login route in odoo/addons/web/controllers/main.py
The custom code is as follows:
from odoo import http
from odoo.addons.web.controllers.main import Home
class ProductivityCardHome(Home):
@http.route('/web/login', type='http', auth="none")
def web_login(self, redirect=None, **kw):
res = super(ProductivityCardHome, self).web_login(redirect=redirect, kw=kw)
return res
Unfortunately, the code above results in the following errors that we don't know what is the cause.
Traceback (most recent call last):
File "/project/src/odoo/odoo/models.py", line 5199, in ensure_one
_id, = self._ids
ValueError: not enough values to unpack (expected 1, got 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 219, in render_template
yield from compiled_fn(self, values, log)
File "", line 5, in template_1741
File "/project/src/odoo/addons/website_sale_stock/models/website.py", line 28, in sale_get_order
so = super().sale_get_order(force_create=force_create, code=code, update_pricelist=update_pricelist, force_pricelist=force_pricelist)
File "/project/src/odoo/addons/website_sale/models/website.py", line 250, in sale_get_order
if not sale_order_id and not self.env.user._is_public():
File "/project/src/odoo/odoo/addons/base/models/res_users.py", line 905, in _is_public
self.ensure_one()
File "/project/src/odoo/odoo/models.py", line 5202, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: res.users()
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/project/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/project/src/odoo/odoo/http.py", line 810, in dispatch
r = self._call_function(**self.params)
File "/project/src/odoo/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/project/src/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/project/src/odoo/odoo/http.py", line 351, in checked_call
result.flatten()
File "/project/src/odoo/odoo/http.py", line 1277, in flatten
self.response.append(self.render())
File "/project/src/odoo/odoo/http.py", line 1270, in render
return env["ir.ui.view"]._render_template(self.template, self.qcontext)
File "/project/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 1980, in _render_template
return self.browse(self.get_view_id(template))._render(values, engine)
File "/project/src/odoo/addons/website/models/ir_ui_view.py", line 433, in _render
return super(View, self)._render(values, engine=engine, minimal_qcontext=minimal_qcontext)
File "/project/src/odoo/addons/web_editor/models/ir_ui_view.py", line 29, in _render
return super(IrUiView, self)._render(values=values, engine=engine, minimal_qcontext=minimal_qcontext)
File "/project/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 1988, in _render
return self.env[engine]._render(self.id, qcontext)
File "/project/src/odoo/odoo/tools/profiler.py", line 289, in _tracked_method_render
return method_render(self, template, values, **options)
File "/project/src/odoo/odoo/addons/base/models/ir_qweb.py", line 76, in _render
result = super()._render(template, values=values, **compile_options)
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 134, in _render
result = ''.join(rendering)
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 221, in render_template
raise e
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 219, in render_template
yield from compiled_fn(self, values, log)
File "", line 186, in template_190
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 221, in render_template
raise e
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 219, in render_template
yield from compiled_fn(self, values, log)
File "", line 29, in template_189
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 221, in render_template
raise e
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 219, in render_template
yield from compiled_fn(self, values, log)
File "", line 1222, in template_1388
File "", line 1157, in t_call_content
File "", line 1109, in t_call_content
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 223, in render_template
raise QWebException("Error when render the template", self, options,
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/project/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/project/src/odoo/odoo/http.py", line 810, in dispatch
r = self._call_function(**self.params)
File "/project/src/odoo/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/project/src/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/project/src/odoo/odoo/http.py", line 351, in checked_call
result.flatten()
File "/project/src/odoo/odoo/http.py", line 1277, in flatten
self.response.append(self.render())
File "/project/src/odoo/odoo/http.py", line 1270, in render
return env["ir.ui.view"]._render_template(self.template, self.qcontext)
File "/project/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 1980, in _render_template
return self.browse(self.get_view_id(template))._render(values, engine)
File "/project/src/odoo/addons/website/models/ir_ui_view.py", line 433, in _render
return super(View, self)._render(values, engine=engine, minimal_qcontext=minimal_qcontext)
File "/project/src/odoo/addons/web_editor/models/ir_ui_view.py", line 29, in _render
return super(IrUiView, self)._render(values=values, engine=engine, minimal_qcontext=minimal_qcontext)
File "/project/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 1988, in _render
return self.env[engine]._render(self.id, qcontext)
File "/project/src/odoo/odoo/tools/profiler.py", line 289, in _tracked_method_render
return method_render(self, template, values, **options)
File "/project/src/odoo/odoo/addons/base/models/ir_qweb.py", line 76, in _render
result = super()._render(template, values=values, **compile_options)
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 134, in _render
result = ''.join(rendering)
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 221, in render_template
raise e
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 219, in render_template
yield from compiled_fn(self, values, log)
File "", line 186, in template_190
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 221, in render_template
raise e
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 219, in render_template
yield from compiled_fn(self, values, log)
File "", line 29, in template_189
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 221, in render_template
raise e
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 219, in render_template
yield from compiled_fn(self, values, log)
File "", line 1222, in template_1388
File "", line 1157, in t_call_content
File "", line 1109, in t_call_content
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 223, in render_template
raise QWebException("Error when render the template", self, options,
odoo.addons.base.models.qweb.QWebException: Expected singleton: res.users()
Traceback (most recent call last):
File "/project/src/odoo/odoo/models.py", line 5199, in ensure_one
_id, = self._ids
ValueError: not enough values to unpack (expected 1, got 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/project/src/odoo/odoo/addons/base/models/qweb.py", line 219, in render_template
yield from compiled_fn(self, values, log)
File "", line 5, in template_1741
File "/project/src/odoo/addons/website_sale_stock/models/website.py", line 28, in sale_get_order
so = super().sale_get_order(force_create=force_create, code=code, update_pricelist=update_pricelist, force_pricelist=force_pricelist)
File "/project/src/odoo/addons/website_sale/models/website.py", line 250, in sale_get_order
if not sale_order_id and not self.env.user._is_public():
File "/project/src/odoo/odoo/addons/base/models/res_users.py", line 905, in _is_public
self.ensure_one()
File "/project/src/odoo/odoo/models.py", line 5202, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: res.users()
Error when render the template
ValueError: Expected singleton: res.users()
Template: website_sale.header_cart_link
Path: /t/t[1]
Node: