Odoo Help

Welcome!

This community 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.

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 312 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

--Prakash Sharma--
815
| 2 1 4
Delhi, India
--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) {
});

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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