I am creating a custom module to filter the products with deliveries available in the selected municipalities but I am having an error when rendering the view of the products
Error
Error while render the template TypeError: 'NoneType' object is not callable Template: website_sale.search Path: /t/t/t[6] Node:
The error occurred while rendering the template. website_sale.search and evaluate the following expression:
controller:
@http.route('/shop', type='http', auth='public', website=True)
def shop(self, **post):
municipality_id = request.session.get('municipality_id')
domain = []
if municipality_id:
domain.append(('delivery_municipality_ids', '=', int(municipality_id)))
products = request.env['product.template'].search(domain)
_logger.info('Products found: %d', len(products))
return request.render("website_sale.products", {
'products': products,
'display_image': True,
})
I have tried too without:
'display_image': True,
in logs products are found:
2024-08-10 14:33:38,125 1 INFO db_dev odoo.addons.delivery_filter.controllers.main: Products found: 1
some help?