Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
7263 Tampilan

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.

 

Avatar
Buang
Jawaban Terbai

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. 

Avatar
Buang
Jawaban Terbai

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,

Avatar
Buang

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)

Penulis

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.

Jawaban Terbai

here is the video reference


Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
0
Feb 25
498
2
Nov 24
4308
2
Okt 24
1660
2
Agu 24
980
0
Apr 24
965