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

I have 4 database db1,db2,db3,db4 in my server. I have 4 clients c1,c2,c3,c4. Now if i give my url "http://ip:port" the client1 need to select his datanase from 4 databases. But i want like

When client1 enter our url like "http://IP:port" he should loginto db1 automatically without selecting db1.

 

形象
丢弃
最佳答案

First you have to hide the database list from the openerp interface.

For that you have to edit the below files.

base.xml (path : addons/web/static/src/xml/base.xml)

<t t-name="Login.dblist">

<select name="db">

<t t-foreach="db_list" t-as="db">

<t t-if="selected_db === db">

<option t-att-value="db" selected="true">

<t t-esc="db"/>

</option>

</t>

<t t-if="selected_db !== db">

<option t-att-value="db">

<t t-esc="db"/>

</option>

</t>

</t>

</select>

</t>

Now replace that selection "db" with a text box with the same name of the selection field as

<t t-name="Login.dblist">

<input name="db" type="text" value="" autofocus="autofocus"/>

</t>

EDIT :

Then in chrome.js (addons/web/static/src/js/chrome.js) comment the on_db_loaded method (line 676-690) , which is

on_db_loaded: function (result) {

     var self = this;

     this.db_list = result;

     if (!this.selected_db) {

        this.selected_db = result[0];

     }

     this.$("[name=db]").replaceWith(QWeb.render('Login.dblist', { db_list: this.db_list, selected_db: this.selected_db}));

     if(this.db_list.length === 0)

     { this.do_action("database_manager");

     }

     else if(this.db_list.length === 1)

     { this.$('div.oe_login_dbpane').hide();

    }

    else { this.$('div.oe_login_dbpane').show(); } },

comment the above full code.

For this refer the link 

 

Then provide link to each client. When they click their link, it automatically opens their database without selecting the db's. 

形象
丢弃
最佳答案

Hello Samba,

The best way ( as per my point of view) to do is : 

  1. Create each database with different database users, ( like openerp1, openerp2, openerp3, openerp4)
  2. Create 4 openerp-server (executable file) (Like openerp-server1, ....2,....3,....4)
  3. Create init and conf file separately ( but keep the addons as same)
  4. Start each OpenERP instance with separate port ( 8069, 8070, 8071,8072 etc ...)

​Now each of the OpenERP instance will be started from separate port. You can give this link ( with PORT) to your clients. They can never be able to access other database. Because other database should have been started to other port which they don't know.

Let me know if this helps,

Best Regards,

形象
丢弃

This is also a nice solution. For avoiding more executable file, i suggested the above solution

Yes Above is nice solution too. But remember, if your customer knows the other database then they can easily access that database. So it depends on which type of solution you want to implement. All the best (y)

编写者

I have created 3 openerp-server files,. You said init and conf file separately, Can you please give me exact name with path of these two files?. I am new to openerp, unable to find those files. I can run the instance with different ports.

最佳答案

here is the video reference


形象
丢弃
相关帖文 回复 查看 活动
0
2月 25
607
2
11月 24
4586
2
10月 24
1855
2
8月 24
1084
0
4月 24
1044