When I super a function def pricelist_change() i got this error.
Error: 'ProductConfiguratorController (extended by Website' object has no attribute 'selectable' in odoo
Controller.py
from odoo import fields, http, tools
from odoo.http import request
from odoo.addons.website_sale.controllers.main import WebsiteSale
class WebsiteSaleInherit(WebsiteSale):
@http.route(['/shop/change_pricelist/<model("product.pricelist"):pl_id>'], type='http', auth="public", website=True,
sitemap=False)
def pricelist_change(self, pl_id, qcontext=None, **post):
res = super(WebsiteSaleInherit, self).pricelist_change(self, **post)
if (pl_id.selectable or pl_id == request.env.user.partner_id.property_product_pricelist) \
and request.website.is_pricelist_available(pl_id.id):
request.session['website_sale_current_pl'] = pl_id.id
request.website.sale_get_order(force_pricelist=pl_id.id)
sample = request.env['product.pricelist.item'].sudo().search([])
print(sample)
self.qcontext.update({
'order': sample,
})
return {
'type': 'ir.actions.act_url',
'url': '/shop%s' % qcontext,
'target': 'self',
}, res
When i print pl_id of this function and main.py(source function) i got following result.
pl_id in super function: product.pricelist(1,)
pl_id in main function: <odoo.http.ProductConfiguratorController (extended by WebsiteSaleInherit, WebsiteSale) object at 0x7fccf05ff6a0>