[FIX] website_sale: hack link with javascript

bzr revid: chm@openerp.com-20130927134028-f2nl4xinq0zd0rb7
This commit is contained in:
Christophe Matthieu 2013-09-27 15:40:28 +02:00
parent 55bde2ce80
commit 6e3a9e63b7
1 changed files with 5 additions and 1 deletions

View File

@ -39,7 +39,11 @@ $(document).ready(function () {
$('.oe_website_sale a[href*="/add_cart/"], a[href*="/remove_cart/"]').on('click', function (ev) {
ev.preventDefault();
var $link = $(ev.currentTarget);
openerp.jsonRpc("/shop/add_cart_json/", 'call', {'order_line_id': $link.data('id'), 'remove': $link.is('[href*="/remove_cart/"]')})
var product_id = $link.attr("href").match(/product_id=([0-9]+)/)[1];
if (product_id) {
product_id = +product_id;
}
openerp.jsonRpc("/shop/add_cart_json/", 'call', {'product_id': product_id, 'order_line_id': $link.data('id'), 'remove': $link.is('[href*="/remove_cart/"]')})
.then(function (data) {
if (!data[0]) {
location.reload();