Odoo Help


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

on 6/8/16, 8:40 AM 704 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.

on 9/6/16, 8:49 AM

Prakash Sharma

--Prakash Sharma--
--Prakash Sharma--

I like to surround myself with brave, creative people.

My motivation for learning different technologies and algos drive me. I love challenges of a steep learning curve which I believe makes me a better learner. I have a strong desire to learn different technologies, which would enable me to become a full stack developer.

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.


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)


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