Skip to Content
Menu
This question has been flagged
1 Reply
2605 Views

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; })})})


 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



Avatar
Discard

Post bug here https://github.com/odoo/odoo/issues/new, official guys supports you.

Best Answer

in odoo9 use ajax.jsonRpc instead of   openerp.jsonRpc

 var ajax = require('web.ajax');
ajax.jsonRpc('/shop/clear_cart/' ,'call', {}).then(function (data) {
});
Avatar
Discard