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.

0

How declare a dynamic JS script to manage API KEYs [Closed]

By
Nhomar Hernandez
on 10/19/13, 6:35 PM 806 views

The Question has been closed for reason: not relevant or out dated

by
Nhomar Hernandez
on 08/26/2014 22:23:19

Hello all. I have this situation:

To use some API (as google ones) I need pass as parameter the "Developer Key", it is a long char as part of the "url" we need to pass a parameter "The KEy"

It is really ugly pass this kwy wired in my soource code, due to if other person want to use my code i need to put free my key IMHO it is not correct.

What did i tried.

1.- Just declare a wired piece of code in my js file adding the script (It works) the issue with it is outside the "openerp.name_of_module" declaration, i can not access to server configuration due to the leak of conexion yet.

Example:

http://bazaar.launchpad.net/~vauxoo/addons-vauxoo/maps_oscar/view/head:/web_example/static/src/js/first_module.js#L1

It only make the "append" in this way, i don't understand why the init: of my widget in this point doesn't work it is the only way it has worked for me.

2.- Put in the init:

I put the code in case one on init (in this point i can access to server and make an rpc request in this way extract the key from the server config) but the script is not loaded.

3.- Put in start:

I thought, "Ok i need render first" then i repeat this code in start: method and it doesn't declare the information.

4.- Overwrite the web.controllers.main.html_template variable directly in the __init__ of my module, but I think it is too dangerous if we want to load from apps.

There is some "correct way to do that?" or the 2 ways it works are the only correct Wired and __init__ ?

REgards.

About This Community

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

Question tools

0 follower(s)

Stats

Asked: 10/19/13, 6:35 PM
Seen: 806 times
Last updated: 3/16/15, 8:10 AM