Browse Source

[REF] Use get_param() instead of search_read() to get the configuration parameter

pull/230/head
Sylvain Calador 9 years ago
parent
commit
c216cc3e5f
  1. 11
      web_environment_ribbon/static/src/js/ribbon.js
  2. 3
      web_environment_ribbon/view/base_view.xml

11
web_environment_ribbon/static/src/js/ribbon.js

@ -22,13 +22,12 @@ openerp.web_environment_ribbon = function(instance) {
ribbon.hide();
var model = new instance.web.Model('ir.config_parameter');
var query = [['key', '=', 'ribbon.name']];
var fields = ['value'];
var key = 'ribbon.name';
var res = model.call('search_read', [query, fields]).then(
function (result) {
if (result.length) {
ribbon.html(result[0].value);
var res = model.call('get_param', [key]).then(
function (name) {
if (name && name != 'False') {
ribbon.html(name);
ribbon.show();
}
}

3
web_environment_ribbon/view/base_view.xml

@ -13,10 +13,9 @@
<!-- Add ribbon to page -->
<template id="body_with_ribbon_test" name="ribbon_test web.webclient_bootstrap" inherit_id="web.webclient_bootstrap">
<xpath expr="//div[@class='openerp openerp_webclient_container']" position="before">
<div class="test-ribbon"><b>TEST</b></div>
<div class="test-ribbon"/>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save