odoo/ext/custom-addons/cam_testenv/static/src/js/testenv.js

33 lines
1.1 KiB
JavaScript

openerp.cam_testenv = function (openerp) {
openerp.web.WebClient = openerp.web.WebClient.extend({
/**
* Test env
*/
start: function() {
var self = this;
return $.when(this._super()).then(function() {
//this._super();
db = null
if (jQuery.param !== undefined && jQuery.deparam(jQuery.param.querystring()).db !== undefined) {
db = jQuery.deparam(jQuery.param.querystring()).db
}
self.rpc("/web/testenv/testmode", {'db': db}).done(function(result) {
// If immediately follows a login (triggered by trying to restore
// an invalid session or no session at all), refresh session data
// (should not change, but just in case...)
if (result) {
$("body").addClass("test-mode-activated");
// $("body").css("background-image", "url(" + openerp.session.origin + "/cam_testenv/static/src/img/back-testenv.jpg" + ")");
}
});
});
}
});
}