# -*- coding: utf-8 -*- from openerp import http from openerp.http import request from openerp.addons.website.models.website import slug from openerp.addons.website_sale.controllers.main import website_sale class WebsiteSale(website_sale): @http.route(['/shop/cart/update'], type='http', auth="public", methods=['POST'], website=True) def cart_update(self, product_id, add_qty=1, set_qty=0, **kw): cr, uid, context, registry = request.cr, request.uid, request.context, request.registry res = super(WebsiteSale, self).cart_update(product_id, add_qty, set_qty, **kw) product = registry.get('product.product').browse(cr, uid, int(product_id)) back_to_product_href = "/shop/product/" + slug(product.product_tmpl_id) return request.redirect(back_to_product_href)