Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] odooDebug: Enable debug mode by default exclusively for only localhost #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions pageScript.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
const body = document.getElementsByTagName('body')[0];
let odooVersion = 'legacy';
let debugMode = '';

const autoEnableDevMode = (function(){
let isEnable = false;
return function (){
isEnable = true;
if(!isEnable){
const url = window.location.href;
const regex = /localhost/i;
const regex2 = /127.0.0.1/i;
if(body.getAttribute('o_web_client') && (url.search(regex) || url.search(regex2))){
if(window.hasOwnProperty('odoo') && odoo && odoo.hasOwnProperty('debug')){
if(odoo.debug === '0'){
debugMode = '1';
}
debugMode = debugMode === '0' ? '' : debugMode;
body.setAttribute('data-odoo', odooVersion);
body.setAttribute('data-odoo-debug-mode', debugMode);
}
}
else{
debugMode = '0';
debugMode = debugMode === '0' ? '' : debugMode;
body.setAttribute('data-odoo', odooVersion);
body.setAttribute('data-odoo-debug-mode', debugMode);
}
}
}
})();
autoEnableDevMode();

if (window.hasOwnProperty('odoo') && odoo && odoo.hasOwnProperty('debug')) {
let odooVersion = 'legacy';
let debugMode = '';
const body = document.getElementsByTagName('body')[0];
if (typeof odoo.debug === 'boolean') {
const url = window.location.href;
if (url.search(/[&|?]debug=assets/) !== -1) {
Expand Down