Odoo Help

0

Website Clear cart button is not refreshing when I click on the button in Odoo9 enterprise version?

By
Odoo
on 6/8/16, 8:40 AM 616 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



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

Zahin
on 9/6/16, 8:49 AM
0
Prakash Sharma
On 6/8/16, 12:26 PM

in odoo9 use ajax.jsonRpc instead of   openerp.jsonRpc

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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 6/8/16, 8:40 AM
Seen: 616 times
Last updated: 10/16/16, 1:55 AM