Help

18

How to remove "Manage Databases"

Avatar
Wira Bakti Soenaryo

Hello,

As my subject, how do we remove the "Manage Databases" link on the login screen? Currently using openerp Version 7.0-20130221-002146 And also can we edit the login screen interface? For example editing the logo image. Thank you..

2 Comments
Avatar
Discard
Avatar
Wira Bakti Soenaryo
-

Hello,

Thank you all for the reply.. I will try all the way above..

5 Answers
28
Avatar
Guewen Baconnier
Best Answer

The OpenERP files (server, addons, web) should never be edited. You should always prefer to do your modifications in a custom addon.

You can do this change by creating a custom addon and replacing the part of the UI you don't want.

Usual addons are installed on a database basis. Removing the Manage database link is global to an installation, so you'll need to start your server with the name of your module in the --load option.

./openerp-server --load=web,your_module

Your module should also be auto-installable, use the key auto_install in the __openerp__.py of your module:

'auto_install': True,

To remove the Manage database, you'll need to create a file static/src/xml/base.xml:

<templates>
    <!-- Templates modified at the web start, before loading of a database. -->

    <!-- Remove the Manage database link, but keep the Powered by OpenERP-->
    <t t-extend="Login">
        <t t-jquery="div.oe_login_footer" t-operation="replace">
            <div class="oe_login_footer">
                <a href="http://www.openerp.com" target="_blank">Powered by <span>OpenERP</span></a>
            </div>
        </t>
    </t>

</templates>

Then you need to load the file in __openerp__.py:

'qweb' : [
    "static/src/xml/base.xml",
],

You can edit the logo or other elements interface too. You can refer to the file addons/web/static/src/xml/base.xml in openerp-web to see the base templates.

The templates use the QWeb syntax: QWeb documentation

5 Comments
Avatar
Discard
Avatar
Maxime Chambreuil
-

and there is a great project on Launchpad to host your new module: https://launchpad.net/web-addons

Avatar
dengwei
-

thx ,it help me great

Avatar
exxor
-

great answer, thanks for the help

Avatar
Sandy Carter
-

Should be this to avoid a change in the formatting.

    <t t-jquery="div.oe_login_footer" t-operation="replace">
      <div class="oe_login_footer">
        <a href="http://www.openerp.com" target="_blank">Powered by <span>OpenERP</span></a>
      </div>
    </t>
Avatar
Guewen Baconnier
-

Thanks Sandy. Edited my answer.

8
Avatar
Andrey Kolpakov
Best Answer

Guewen Baconnier's answer is work. But it only hide the link "Manage Databases". Functionality and API will be still active. And if your OpenERP is public someone can hack your database using this api. Especially if you did not change default password 'admin'.

For restricting access additionally to Guewen Baconnier's comment you should override default controller addons/web/controller/main.py (Controller Database). For that you should create controller package in your own module and create file <my_own_module>/controller/main.py with content:

from web import http
from openerp.addons.web.controllers.main import Database, db_list
openerpweb = http

class Database_restrict(Database):
    @openerpweb.jsonrequest
    def create(self, req, fields):

        # check if it is not first installation - restrict!

        dblist = db_list(req)
        if len(dblist) > 0:
            raise Exception('Not allowed')

        return super(Database_restrict, self).create(req, fields)

    @openerpweb.jsonrequest
    def duplicate(self, req, fields):
        raise Exception('Not allowed')

    @openerpweb.jsonrequest
    def drop(self, req, fields):
        raise Exception('Not allowed')

    @openerpweb.httprequest
    def backup(self, req, backup_db, backup_pwd, token):
        raise Exception('Not allowed')

    @openerpweb.httprequest
    def restore(self, req, db_file, restore_pwd, new_db):
        raise Exception('Not allowed')

    @openerpweb.jsonrequest
    def change_password(self, req, fields):
        raise Exception('Not allowed')

Then you should include controllers package in __init__.py of your module.

It overrides functions for database management and rase exception but allow you to create first database.

3 Comments
Avatar
Discard
Avatar
Atul Kumar jain
-

Very nice , Working fine

Avatar
Kelly Stuart
-

I like your approach! Added security is very important.

Avatar
Faris Fathurrahman
-

how to do this in Odoo v14?

3
Avatar
Daniel Reis
Best Answer

There is a server option for that:

Security-related options:
  --no-database-list  disable the ability to return the list of databases

Try starting the server adding the option --no-database-list.

3 Comments
Avatar
Discard
Avatar
Mohammad Alhashash
-

In my updated 7.0 code, this option just removes the database selection box.

Avatar
Wira Bakti Soenaryo
-

To remove database list NOT "manage databases" can be from the openerp configuration file located at /etc/openerp/openerp-server.conf on list_db option.

Avatar
thenon
-

With this option, clicking on the link does nothing anyway, so it works fine for security purposes.

0
Avatar
Marek Toman
Best Answer

Usual addons are installed on a database basis. Removing the Manage database link is global to an installation, so you'll need to start your server with the name of your module in the --load option.

Tried it without --load option and it works. Just added module in setings page and installed it. Works like charm.

Avatar
Discard
0
Avatar
Angela
Best Answer

I have all details about this in 6.1.1, I guess it's similar in 7. Do searches in OpenERP 7.0-20130216-002451\Server\server\openerp\addons\web

For example, take a look in base.xml line 81, I'd say if you comment out stuff around there you'd get rid of "Manage database". You can also change the "openerp" link and text to put your own company.

The logos are in web\static\src\img

1 Comment
Avatar
Discard
Avatar
John Karr
-

The XML File is located at /addons/web/static/src/xml. This should definitely be configurable in the main conf file, requiring neither module nor hack.