[FIX] Issue #105 switch the user to non language

This commit is contained in:
Chintan Ambaliya 2018-08-30 16:06:31 +05:30
parent 9fc7c5a96b
commit 325caf822e

View File

@ -161,30 +161,32 @@ var UserProfile = Widget.extend({
method: 'search_read', method: 'search_read',
args: [[["code", "=", session.user_context.lang]], ['name', 'direction']], args: [[["code", "=", session.user_context.lang]], ['name', 'direction']],
}).then(function(lang_data){ }).then(function(lang_data){
var img_src = session.url('/web/image', { if (lang_data.length) {
model:'res.lang', var img_src = session.url('/web/image', {
field: 'image', model: 'res.lang',
id: lang_data[0].id, field: 'image',
}); id: lang_data[0].id,
$lang_logo.attr('title', lang_data[0].name).attr('src', img_src).attr('data-lang-dir', lang_data[0].direction); });
$lang_logo.attr('title', lang_data[0].name).attr('src', img_src).attr('data-lang-dir', lang_data[0].direction);
// Web RTL(Right to Left) Snippet // Web RTL(Right to Left) Snippet
if (lang_data[0].direction == 'rtl') { if (lang_data[0].direction == 'rtl') {
var head = document.getElementsByTagName('head')[0]; var head = document.getElementsByTagName('head')[0];
// BootStrap RTL CSS // BootStrap RTL CSS
var link = document.createElement('link'); var link = document.createElement('link');
link.rel = 'stylesheet'; link.rel = 'stylesheet';
link.type = 'text/css'; link.type = 'text/css';
link.href = '/web/static/lib/rtl/bootstrap-rtl.min.css'; link.href = '/web/static/lib/rtl/bootstrap-rtl.min.css';
head.appendChild(link); head.appendChild(link);
// Flectra RTL Custom CSS // Flectra RTL Custom CSS
var link1 = document.createElement('link'); var link1 = document.createElement('link');
link1.rel = 'stylesheet'; link1.rel = 'stylesheet';
link1.type = 'text/css'; link1.type = 'text/css';
link1.href = '/web/static/lib/rtl/flectra-rtl-custom.css'; link1.href = '/web/static/lib/rtl/flectra-rtl-custom.css';
head.appendChild(link1); head.appendChild(link1);
}
} }
}); });
$avatar.attr('src', avatar_src); $avatar.attr('src', avatar_src);