Hi All,
Below I attached my code ...
class pos_website_sale (http.Controller):
@ http.route ([ '/ shop / clear_cart' ], auth = "public" , website = True )
def clear_cart ( self ): order = request.website.sale_get_order ()
if order: for line in order.website_order_line: line.unlink ()
UPDATED CODE#############
$(document).ready(function (instance)
{//debugger;$('.oe_website_sale').each(function ()
{ var oe_website_sale = this;
$(oe_website_sale).on("click", ".oe_cart #clear_cart_button", function ()
{// debugger; var ajax = require('web.ajax');
ajax.jsonRpc("/shop/clear_cart", "call", {}).then(function(data){
location.reload(true); })
return false; })})})
I got this error from the console...
website.assets_frontend.js 910 Uncaught ReferenceError: openerp is not defined (anonymous function) @ website.assets_frontend.js: 910jQuery.event.dispatch web.assets_common.js @: @ 740elemData.handle web.assets_common.js: 713
Post bug here https://github.com/odoo/odoo/issues/new, official guys supports you.