跳至内容
菜单
此问题已终结
3 回复
11189 查看

Hi

how i can access fields values by java script ?

i tried to get language field value in java script variable, but i failed.

and i tried to know where is the function that retrieve the current language, and i failed too.

so please anyone can help me

形象
丢弃
最佳答案
Confirm, this approach posted by Handelux worked like a charm, tested on v16
var lang = ('; '+document.cookie).split(`; frontend_lang=`).pop().split(';')[0];

形象
丢弃
最佳答案

User language is stored in a cookie frontend_lang so you can access it with pure javascript:

var lang = ('; '+document.cookie).split(`; frontend_lang=`).pop().split(';')[0];
形象
丢弃
最佳答案

The language value should be instance.session.user_context.lang.

形象
丢弃
编写者

please i am new in openerp. so where i can find "instance.session.user_context.lang" and how to put language in alert message

You need to read the OpenERP web module development guide. instance is sent by OpenERP to web modules during session startup.

相关帖文 回复 查看 活动
0
11月 21
994
0
4月 18
3389
0
9月 21
1806
1
11月 21
16164
3
5月 25
1421