跳至內容
選單
此問題已被標幟
921 瀏覽次數

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?

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
6月 23
3273
0
6月 23
1262
0
5月 22
1910
2
5月 22
2756
0
5月 17
3222