|
|
@ -2,17 +2,16 @@ |
|
|
|
Copyright 2015 Javi Melendez <javi.melendez@algios.com> |
|
|
|
Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com> |
|
|
|
Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu> |
|
|
|
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
|
|
|
Copyright 2017 Xavier Jiménez <xavier.jimenez@qubiq.es> |
|
|
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
|
|
|
|
|
|
|
odoo.define('web_environment_ribbon.ribbon', function(require) { |
|
|
|
"use strict"; |
|
|
|
|
|
|
|
var $ = require('jquery'); |
|
|
|
var Model = require('web.Model'); |
|
|
|
var rpc = require('web.rpc'); |
|
|
|
var core = require('web.core'); |
|
|
|
|
|
|
|
var backend_model = new Model('web.environment.ribbon.backend'); |
|
|
|
|
|
|
|
// Code from: http://jsfiddle.net/WK_of_Angmar/xgA5C/
|
|
|
|
function validStrColour(strToTest) { |
|
|
|
if (strToTest === "") { return false; } |
|
|
@ -32,7 +31,10 @@ core.bus.on('web_client_ready', null, function () { |
|
|
|
$('body').append(ribbon); |
|
|
|
ribbon.hide(); |
|
|
|
// Get ribbon data from backend
|
|
|
|
backend_model.call('get_environment_ribbon').then( |
|
|
|
rpc.query({ |
|
|
|
model: 'web.environment.ribbon.backend', |
|
|
|
method: 'get_environment_ribbon', |
|
|
|
}).then( |
|
|
|
function (ribbon_data) { |
|
|
|
// Ribbon name
|
|
|
|
if (ribbon_data.name && ribbon_data.name != 'False') { |
|
|
@ -50,5 +52,4 @@ core.bus.on('web_client_ready', null, function () { |
|
|
|
} |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
}); // odoo.define
|