[FIX] website_sale & tour
bzr revid: chm@openerp.com-20140502155124-98xz2b4gd2zzzrkx
This commit is contained in:
parent
bbfdc57ad9
commit
939b2f2d44
|
@ -104,11 +104,11 @@ var T = website.Tour = {
|
|||
if (tour.path && !window.location.href.match(new RegExp("("+T.getLang()+")?"+tour.path+"#?$", "i"))) {
|
||||
var href = "/"+T.getLang()+tour.path;
|
||||
console.log("Tour Begin from run method (redirection to "+href+")");
|
||||
T.saveState(tour.id, mode || tour.mode, -1);
|
||||
T.saveState(tour.id, mode || tour.mode, -1, 0);
|
||||
window.location.href = href;
|
||||
} else {
|
||||
console.log("Tour Begin from run method");
|
||||
T.saveState(tour.id, mode || tour.mode, 0);
|
||||
T.saveState(tour.id, mode || tour.mode, 0, 0);
|
||||
T.running();
|
||||
}
|
||||
},
|
||||
|
@ -311,7 +311,7 @@ var T = website.Tour = {
|
|||
};
|
||||
window.location.hash = "";
|
||||
console.log("Tour Begin from url hash");
|
||||
T.saveState(state.id, state.mode, state.step_id);
|
||||
T.saveState(state.id, state.mode, state.step_id, 0);
|
||||
}
|
||||
if (!state.id) {
|
||||
return;
|
||||
|
@ -341,8 +341,8 @@ var T = website.Tour = {
|
|||
}
|
||||
return tour_ids;
|
||||
},
|
||||
saveState: function (tour_id, mode, step_id) {
|
||||
localStorage.setItem("tour", JSON.stringify({"id":tour_id, "mode":mode, "step_id":step_id || 0, "time": this.time}));
|
||||
saveState: function (tour_id, mode, step_id, number) {
|
||||
localStorage.setItem("tour", JSON.stringify({"id":tour_id, "mode":mode, "step_id":step_id || 0, "time": this.time, "number": number+1}));
|
||||
},
|
||||
reset: function () {
|
||||
var state = T.getState();
|
||||
|
@ -402,6 +402,7 @@ var T = website.Tour = {
|
|||
if (T.check(next)) {
|
||||
clearTimeout(T.currentTimer);
|
||||
// use an other timeout for cke dom loading
|
||||
T.saveState(state.id, state.mode, state.step.id, 0);
|
||||
setTimeout(function () {
|
||||
T.nextStep(next);
|
||||
}, T.defaultDelay);
|
||||
|
@ -421,7 +422,13 @@ var T = website.Tour = {
|
|||
}
|
||||
|
||||
step = step || state.step;
|
||||
T.saveState(state.id, state.mode, step.id);
|
||||
var next = state.tour.steps[step.id+1];
|
||||
|
||||
if (state.number > 3) {
|
||||
T.error(next, "Cycling. Can't reach the next step");
|
||||
}
|
||||
|
||||
T.saveState(state.id, state.mode, step.id, state.number);
|
||||
|
||||
if (step.id !== state.step_id) {
|
||||
console.log("Tour Step: '" + (step._title || step.title) + "' (" + (new Date().getTime() - this.time) + "ms)");
|
||||
|
@ -433,7 +440,6 @@ var T = website.Tour = {
|
|||
step.onload();
|
||||
}
|
||||
|
||||
var next = state.tour.steps[step.id+1];
|
||||
if (next) {
|
||||
setTimeout(function () {
|
||||
T.waitNextStep();
|
||||
|
|
|
@ -109,6 +109,7 @@ class sale_order(osv.Model):
|
|||
def _cart_accessories(self, cr, uid, ids, context=None):
|
||||
for order in self.browse(cr, uid, ids, context=context):
|
||||
s = set(j.id for l in (order.website_order_line or []) for j in (l.product_id.accessory_product_ids or []))
|
||||
s -= set(l.product_id.id for l in order.order_line)
|
||||
product_ids = random.sample(s, min(len(s),3))
|
||||
return self.pool['product.template'].browse(cr, uid, product_ids, context=context)
|
||||
|
||||
|
|
|
@ -20,31 +20,32 @@
|
|||
{
|
||||
title: "click on add to cart",
|
||||
waitFor: 'input[name="product_id"]:eq(1)[checked]',
|
||||
element: 'form[action="/shop/add_cart"] .btn',
|
||||
element: 'form[action="/shop/cart/update"] .btn',
|
||||
},
|
||||
{
|
||||
title: "add suggested",
|
||||
element: 'form[action="/shop/add_cart"] .btn-link:contains("Add to Cart")',
|
||||
waitNot: '#cart_products:contains("[A8767] Apple In-Ear Headphones")',
|
||||
element: 'form[action="/shop/cart/update"] .btn-link:contains("Add to Cart")',
|
||||
},
|
||||
{
|
||||
title: "add one more iPod",
|
||||
waitFor: '.my_cart_quantity:contains(2)',
|
||||
element: '#mycart_products tr:contains("iPod: 32 Gb") a.js_add_cart_json:eq(1)',
|
||||
element: '#cart_products tr:contains("iPod - 32 Gb") a.js_add_cart_json:eq(1)',
|
||||
},
|
||||
{
|
||||
title: "remove Headphones",
|
||||
waitFor: '#mycart_products tr:contains("iPod: 32 Gb") input.js_quantity[value=2]',
|
||||
element: '#mycart_products tr:contains("Apple In-Ear Headphones") a.js_add_cart_json:first',
|
||||
waitFor: '#cart_products tr:contains("iPod - 32 Gb") input.js_quantity[value=2]',
|
||||
element: '#cart_products tr:contains("Apple In-Ear Headphones") a.js_add_cart_json:first',
|
||||
},
|
||||
{
|
||||
title: "set one iPod",
|
||||
waitNot: '#mycart_products tr:contains("Apple In-Ear Headphones")',
|
||||
element: '#mycart_products input.js_quantity',
|
||||
waitNot: '#cart_products tr:contains("Apple In-Ear Headphones")',
|
||||
element: '#cart_products input.js_quantity',
|
||||
sampleText: '1',
|
||||
},
|
||||
{
|
||||
title: "go to checkout",
|
||||
waitFor: '#mycart_products input.js_quantity[value=1]',
|
||||
waitFor: '#cart_products input.js_quantity[value=1]',
|
||||
element: 'a[href="/shop/checkout"]',
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue