Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

How to get value from conf file

By
malikge
on 3/23/14, 2:41 PM 930 views

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?

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

silvi
on 3/24/14, 10:10 PM

Could you please explain it a little more.

malikge
on 3/30/14, 9:40 AM
1

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 4/10/14, 9:02 AM

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()

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.

malikge
on 4/12/14, 4:16 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 3/23/14, 2:41 PM
Seen: 930 times
Last updated: 10/5/16, 5:45 AM