Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
12902 Lượt xem

Hi,

I am trying to create a module, which when server starts reads the conf file from Javascript?

I am able to do this in python like this:

from openerp.tools.config import config

class my_test(osv.osv):
   _name = "my_test"

  dbUser = config.get("db_user")

  print "Database user >>> " + dbUser

my_test()

and It is working fine,

I have two questions now:

  1. Is there a way to do this through Javascript?
  2. Or is it possible to pass dbUser variable to Javascript?

Any suggestions on how to do this?

Ảnh đại diện
Huỷ bỏ

var file_obj = new XMLHttpRequest(); file_obj.open("GET", file, true);

Tác giả

Could you please explain it a little more.

Câu trả lời hay nhất

Hi

Try this

import logging
from openerp.tools.config import config
_logger = logging.getLogger(__name__)

class my_test(osv.osv):
   _name = "my_test"

  dbUser = config.get("db_user")

  print "Database user >>> " + dbUser

my_test()
Ảnh đại diện
Huỷ bỏ
Tác giả

Well the code that I have provided above is working fine for me, that prints database user on log. But I want to get dbUser variable in Java-script.