website_search_products: fix warnings

This commit is contained in:
Luis 2026-02-03 18:55:55 +01:00
parent f1a3a75988
commit 46634fcdc0
2 changed files with 10 additions and 9 deletions

View file

@ -4,6 +4,7 @@
from odoo import http from odoo import http
from odoo.http import request from odoo.http import request
from odoo.addons.website.controllers.main import Website from odoo.addons.website.controllers.main import Website
from werkzeug.utils import redirect
import logging import logging
@ -22,7 +23,7 @@ class InventoryForm(http.Controller):
has_internal = user.has_group("base.group_user") has_internal = user.has_group("base.group_user")
if not has_portal and not has_internal: if not has_portal and not has_internal:
return http.redirect("/web") return redirect("/web")
# Fetch active products available in POS # Fetch active products available in POS
products = ( products = (
@ -49,11 +50,11 @@ class WebsiteController(Website):
# Redirect internal users to web, others to inventory search # Redirect internal users to web, others to inventory search
if user.has_group("base.group_user"): if user.has_group("base.group_user"):
# Keep original redirect for internal users # Keep original redirect for internal users
redirect = "/web" redirect_url = "/web"
else: else:
# Redirect portal users to inventory search # Redirect portal users to inventory search
redirect = "/inventory/search" redirect_url = "/inventory/search"
return http.redirect(redirect) return redirect(redirect_url)
return response return response

View file

@ -37,21 +37,21 @@
<t t-foreach="products" t-as="product"> <t t-foreach="products" t-as="product">
<tr> <tr>
<td> <td>
<span t-esc="product.name" /> <span t-out="product.name" />
</td> </td>
<td> <td>
<span t-esc="product.categ_id.name" /> <span t-out="product.categ_id.name" />
</td> </td>
<td> <td>
<span t-esc="product.list_price" <span t-out="product.list_price"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}" /> t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}" />
</td> </td>
<td> <td>
<span t-esc="product.sudo().qty_available" <span t-out="product.sudo().qty_available"
t-options="{'widget': 'float', 'precision': 2}" /> t-options="{'widget': 'float', 'precision': 2}" />
</td> </td>
<td> <td>
<span t-esc="product.sudo().uom_id.name" /> <span t-out="product.sudo().uom_id.name" />
</td> </td>
</tr> </tr>
</t> </t>