Merge pull request #1143 from odoo-dev/8.0-fix-website_sale-chm

[FIX] website_sale: fiscal_position is undefined; website: add user into the tour logs
This commit is contained in:
Christophe Matthieu 2014-07-14 12:10:03 +02:00
commit 9b8e307eb1
3 changed files with 25 additions and 18 deletions

View File

@ -75,7 +75,7 @@ var Tour = {
if (!tour) {
return Tour.error(null, "Can't run '"+tour_id+"' (tour undefined)");
}
console.log("Tour '"+tour_id+"' Begin from run method");
Tour.log("Tour '"+tour_id+"' Begin from run method", true);
var state = Tour.getState();
if (state) {
if (state.mode === "test") {
@ -311,7 +311,7 @@ var Tour = {
"step_id": 0
};
window.location.hash = "";
console.log("Tour '"+state.id+"' Begin from url hash");
Tour.log("Tour '"+state.id+"' Begin from url hash");
Tour.saveState(state.id, state.mode, state.step_id, 0);
}
if (!state.id) {
@ -321,6 +321,14 @@ var Tour = {
state.step = state.tour && state.tour.steps[state.step_id === -1 ? 0 : state.step_id];
return state;
},
log: function (message, add_user) {
if (add_user) {
var user = $(".navbar .dropdown:has(>.js_usermenu) a:first, .navbar .oe_topbar_name").text();
if (!user && $('a[href*="/login"]')) user = 'Public User';
message += " (" + (user||"").replace(/^\s*|\s*$/g, '') + ")";
}
console.log(message);
},
error: function (step, message) {
var state = Tour.getState();
message += '\n tour: ' + state.id
@ -332,7 +340,7 @@ var Tour = {
+ (step ? '\n waitFor: ' + Boolean(!step.waitFor || $(step.waitFor).size()) : '' )
+ "\n localStorage: " + JSON.stringify(localStorage)
+ '\n\n' + $("body").html();
console.log(message);
Tour.log(message, true);
Tour.endTour();
},
lists: function () {
@ -363,7 +371,7 @@ var Tour = {
clearTimeout(Tour.timer);
clearTimeout(Tour.testtimer);
Tour.closePopover();
console.log("Tour reset");
Tour.log("Tour reset");
},
running: function () {
var state = Tour.getState();
@ -373,7 +381,7 @@ var Tour = {
Tour.load_template().then(Tour.running);
return;
}
console.log("Tour '"+state.id+"' is running");
Tour.log("Tour '"+state.id+"' is running", true);
Tour.registerSteps(state.tour, state.mode);
Tour.nextStep();
} else {
@ -381,7 +389,7 @@ var Tour = {
return Tour.error(state.step, "Tour '"+state.id+"' undefined");
}
Tour.saveState(state.id, state.mode, state.step_id, state.number-1, state.wait+1);
console.log("Tour '"+state.id+"' wait for running (tour undefined)");
Tour.log("Tour '"+state.id+"' wait for running (tour undefined)");
setTimeout(Tour.running, Tour.retryRunningDelay);
}
},
@ -441,7 +449,7 @@ var Tour = {
Tour.saveState(state.id, state.mode, step.id, state.number);
if (step.id !== state.step_id) {
console.log("Tour '"+state.id+"' Step: '" + (step._title || step.title) + "' (" + (new Date().getTime() - this.time) + "ms)");
Tour.log("Tour '"+state.id+"' Step: '" + (step._title || step.title) + "' (" + (new Date().getTime() - this.time) + "ms)");
}
Tour.autoTogglePopover(true);
@ -473,11 +481,11 @@ var Tour = {
var test = state.step && state.step.id >= state.tour.steps.length-1;
Tour.reset();
if (test) {
console.log("Tour '"+state.id+"' finish: ok");
console.log('ok');
Tour.log("Tour '"+state.id+"' finish: ok");
Tour.log('ok');
} else {
console.log("Tour '"+state.id+"' finish: error");
console.log('error');
Tour.log("Tour '"+state.id+"' finish: error");
Tour.log('error');
}
},
autoNextStep: function (tour, step) {

View File

@ -975,12 +975,10 @@
},
clean_for_save: function () {
this._super();
$(".carousel").find(".item").removeClass("next prev left right active");
this.$target.find(".item").removeClass("next prev left right active");
this.$target.find(".item:first").addClass("active");
this.$indicators.find('li').removeClass('active');
this.$indicators.find('li:first').addClass('active');
if(!this.$target.find(".item.active").length) {
this.$target.find(".item:first").addClass("active");
}
},
start : function () {
var self = this;

View File

@ -176,9 +176,10 @@ class website(orm.Model):
fiscal_position = sale_order.fiscal_position and sale_order.fiscal_position.id or False
values = sale_order_obj.onchange_partner_id(cr, SUPERUSER_ID, [sale_order_id], partner.id, context=context)['value']
order_lines = map(int,sale_order.order_line)
values.update(sale_order_obj.onchange_fiscal_position(cr, SUPERUSER_ID, [],
values['fiscal_position'], [[6, 0, order_lines]], context=context)['value'])
if values.get('fiscal_position'):
order_lines = map(int,sale_order.order_line)
values.update(sale_order_obj.onchange_fiscal_position(cr, SUPERUSER_ID, [],
values['fiscal_position'], [[6, 0, order_lines]], context=context)['value'])
values['partner_id'] = partner.id
sale_order_obj.write(cr, SUPERUSER_ID, [sale_order_id], values, context=context)