I have written following code in js to change the odoo menu-color:
odoo.define('cof_backend_theme.style', function (require) {'use strict';
var ajax = require('web.ajax');
ajax.jsonRpc("/action_get_menu_color", 'call').then(function(value){
$(document).ready(function(){
$(".o_main_navbar").css("background-color", value); //value #000 comes correctly
});
}); });
The js value #000 comes from the backend. But the color in odoo isn't changing.
If I debug the controller code in pycharm I can see the menu color change (works) but when I run the code without debugging the color doesn't change.
What to do? Please suggest.
I had faced the same issue
Same selector works in css, but not in js
I think the line
$(document).ready(function(){ }); is not required
yes, that doesn't require. I was seeing if the js loads while loading the page.
Is there any fix you know about?
Which is your version?
odoo 10 EE
I just tested on community edition it worked. But not works on enterprise edition. That is even more weirder :(
See this reference in odoo 8
https://www.odoo.com/apps/themes/8.0/editable_theme/
You download it
go to the file
/editable_theme/static/src/js/js_role.js
You can see many examples
Such as
$(".navbar-collapse.collapse").css("background-color", topBar_background_COLOR_CODE);
thank you very much. I will study this module tonight and let you know.
But my concern is why a code is working on debug mode or CE but not on EE. :\
I have no idea about EE.
ok, np. I will let you know.
can you help me with this? - https://www.odoo.com/forum/help-1/question/html-field-not-saving-and-product-price-on-website-not-showing-comma-113873
@Shameem, I used the method the module used but no result. If I write static css, it works. But not from js.