Permalink
Browse files

[FIX] web,*: replace core.debug by config.debug

  • Loading branch information...
Khoi Nguyen
Khoi Nguyen committed Oct 18, 2017
1 parent 28491aa commit 3f962dbe631ac26e71d4df8263771594b01359ce
@@ -2,6 +2,7 @@ odoo.define('payment.payment_form', function (require) {
"use strict";
var ajax = require('web.ajax');
var config = require('web.config');
var core = require('web.core');
var Dialog = require("web.Dialog");
var Widget = require("web.Widget");
@@ -117,7 +118,7 @@ odoo.define('payment.payment_form', function (require) {
self.displayError(
_t('Server Error'),
_t("<p>We are not able to add your payment method at the moment.</p>") + (core.debug ? data.data.message : '')
_t("<p>We are not able to add your payment method at the moment.</p>") + (config.debug ? data.data.message : '')
);
});
}
@@ -158,7 +159,7 @@ odoo.define('payment.payment_form', function (require) {
}).fail(function (message, data) {
self.displayError(
_t('Server Error'),
_t("<p>We are not able to redirect you to the payment form.</p>") + (core.debug ? data.data.message : '')
_t("<p>We are not able to redirect you to the payment form.</p>") + (config.debug ? data.data.message : '')
);
});
}
@@ -264,7 +265,7 @@ odoo.define('payment.payment_form', function (require) {
self.displayError(
_t('Server error'),
_t("<p>We are not able to add your payment method at the moment.</p>") + (core.debug ? data.data.message : '')
_t("<p>We are not able to add your payment method at the moment.</p>") + (config.debug ? data.data.message : '')
);
});
}
@@ -330,7 +331,7 @@ odoo.define('payment.payment_form', function (require) {
}, function (type, err) {
self.displayError(
_t('Server Error'),
_t("<p>We are not able to delete your payment method at the moment.</p>") + (core.debug ? err.data.message : '')
_t("<p>We are not able to delete your payment method at the moment.</p>") + (config.debug ? err.data.message : '')
);
});
},
@@ -6,6 +6,7 @@ var BarcodeParser = require('barcodes.BarcodeParser');
var PosDB = require('point_of_sale.DB');
var devices = require('point_of_sale.devices');
var concurrency = require('web.concurrency');
var config = require('web.config');
var core = require('web.core');
var field_utils = require('web.field_utils');
var rpc = require('web.rpc');
@@ -44,7 +45,7 @@ exports.PosModel = Backbone.Model.extend({
this.proxy_queue = new devices.JobQueue(); // used to prevent parallels communications to the proxy
this.db = new PosDB(); // a local database used to search trough products and categories & store pending orders
this.debug = core.debug; //debug mode
this.debug = config.debug; //debug mode
// Business data; loaded from the server at launch
this.company_logo = null;
@@ -2068,7 +2069,7 @@ exports.Order = Backbone.Model.extend({
} else {
subreceipt = subreceipt.split('\n').slice(1).join('\n');
var qweb = new QWeb2.Engine();
qweb.debug = core.debug;
qweb.debug = config.debug;
qweb.default_dict = _.clone(QWeb.default_dict);
qweb.add_template('<templates><t t-name="subreceipt">'+subreceipt+'</t></templates>');
@@ -2,7 +2,7 @@ odoo.define('web.WebClient', function (require) {
"use strict";
var AbstractWebClient = require('web.AbstractWebClient');
var core = require('web.core');
var config = require('web.config');
var data_manager = require('web.data_manager');
var framework = require('web.framework');
var Menu = require('web.Menu');
@@ -16,7 +16,7 @@ return AbstractWebClient.extend({
'click .oe_logo img': function(ev) {
ev.preventDefault();
return this.clear_uncommitted_changes().then(function() {
framework.redirect("/web" + (core.debug ? "?debug" : ""));
framework.redirect("/web" + (config.debug ? "?debug" : ""));
});
},
},
@@ -1,6 +1,7 @@
odoo.define('report.client_action', function (require) {
'use strict';
var config = require('web.config');
var core = require('web.core');
var ControlPanelMixin = require('web.ControlPanelMixin');
var session = require('web.session');
@@ -108,7 +109,7 @@ var ReportAction = Widget.extend(ControlPanelMixin, {
_update_control_panel_buttons: function () {
this.$buttons.filter('div.o_report_edit_mode').toggle(this.in_edit_mode);
this.$buttons.filter('div.o_report_no_edit_mode').toggle(! this.in_edit_mode);
this.$buttons.filter('div.o_edit_mode_available').toggle(core.debug && this.edit_mode_available && ! this.in_edit_mode);
this.$buttons.filter('div.o_edit_mode_available').toggle(config.debug && this.edit_mode_available && ! this.in_edit_mode);
},
/**
@@ -10,8 +10,6 @@ odoo.define('web.config', function (require) {
* this file someday.
*/
var core = require('web.core');
var config = {
/**
* debug is a boolean flag. It is only considered true if the flag is set
@@ -79,7 +77,6 @@ function _updateSizeProps() {
if (sc !== config.device.size_class) {
config.device.size_class = sc;
config.device.isMobile = config.device.size_class <= config.device.SIZES.XS;
core.bus.trigger('size_class', sc);
}
}
@@ -3,6 +3,7 @@ odoo.define('web.core', function (require) {
var Bus = require('web.Bus');
var Class = require('web.Class');
var config = require('web.config');
var QWeb = require('web.QWeb');
var Registry = require('web.Registry');
var translation = require('web.translation');
@@ -12,8 +13,6 @@ var translation = require('web.translation');
*
* @type Boolean
*/
var debug = $.deparam($.param.querystring()).debug !== undefined;
var bus = new Bus ();
_.each('click,dblclick,keydown,keypress,keyup'.split(','), function(evtype) {
@@ -28,8 +27,7 @@ _.each('resize,scroll'.split(','), function(evtype) {
});
return {
debug: debug,
qweb: new QWeb(debug),
qweb: new QWeb(config.debug),
// core classes and functions
Class: Class,
@@ -6,6 +6,7 @@ odoo.define('web.KanbanRecord', function (require) {
* a Kanban view.
*/
var config = require('web.config');
var core = require('web.core');
var Domain = require('web.Domain');
var field_utils = require('web.field_utils');
@@ -193,7 +194,7 @@ var KanbanRecord = Widget.extend({
if (Widget) {
widget = self._processWidget($field, field_name, Widget);
self.subWidgets[field_name] = widget;
} else if (core.debug) {
} else if (config.debug) {
// the widget is not implemented
$field.replaceWith($('<span>', {
text: _.str.sprintf(_t('[No widget %s]'), field_widget),
@@ -3,6 +3,7 @@ odoo.define('web.DebugManager', function (require) {
var ActionManager = require('web.ActionManager');
var dialogs = require('web.view_dialogs');
var config = require('web.config');
var core = require('web.core');
var Dialog = require('web.Dialog');
var field_utils = require('web.field_utils');
@@ -770,7 +771,7 @@ var RequestDetails = Widget.extend({
}
});
if (core.debug) {
if (config.debug) {
SystrayMenu.Items.push(DebugManager);
WebClient.include({

0 comments on commit 3f962db

Please sign in to comment.