Browse Source

[FIX] switch to better key in erp conf file

pull/450/head
David Beal 8 years ago
parent
commit
f2567dea7a
  1. 16
      secure_uninstall/README.rst
  2. 4
      secure_uninstall/i18n/fr.po
  3. 11
      secure_uninstall/models/module.py
  4. BIN
      secure_uninstall/static/description/img1.png
  5. 5
      secure_uninstall/views/module_view.xml

16
secure_uninstall/README.rst

@ -7,14 +7,22 @@
Secure Uninstall
================
Ask Master Password ('admin_passwd' key from config file)
before proceeding to module uninstallation
Odoo erase all data managed by uninstalled modules.
To prevent catastrophe this module ask password
before proceeding to module uninstallation.
.. figure:: secure_uninstall/static/description/img1.png
:alt: Uninstall authorized
:width: 70%
|
Configuration
=============
Check that 'admin_passwd' is set in Odoo configuration file
Set 'secure_uninstall' key in Odoo configuration file.
@ -24,7 +32,7 @@ Usage
#. Go to Settings > Local modules.
#. Click on one module.
#. Click on Uninstall button.
#. You will need to enter admin password before proceeding.
#. You will need to enter 'secure_uninstall' value provided by your administrator before proceeding.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas

4
secure_uninstall/i18n/fr.po

@ -19,8 +19,8 @@ msgstr ""
#. module: secure_uninstall
#: help:base.module.upgrade,password:0
msgid "'admin_passwd' value from Odoo configuration file (aka 'Master Password')"
msgstr "la valeur 'admin_passwd' du fichier de configuration Odoo (aussi appelé 'Mot de passe Maître')"
msgid "'secure_uninstall' value from Odoo configuration file (aka 'Master Password')"
msgstr "la valeur 'secure_uninstall' du fichier de configuration Odoo (aussi appelé 'Mot de passe Maître')"
#. module: secure_uninstall
#: view:base.module.upgrade:secure_uninstall.view_base_module_upgrade

11
secure_uninstall/models/module.py

@ -12,25 +12,24 @@ class BaseModuleUpgrade(models.TransientModel):
password = fields.Char(
string='Password',
help="'admin_passwd' value from Odoo configuration file "
"(aka 'Master Password')")
help="'secure_uninstall' value from Odoo configuration file ")
@api.multi
def upgrade_module(self):
config_passwd = config.get("admin_passwd")
config_passwd = config.get("secure_uninstall")
for elm in self:
if not config_passwd:
raise UserError(
"Missing configuration key\n--------------------\n"
"'admin_passwd' configuration key "
"(aka 'Master Password') is not set in \n"
"'secure_uninstall' configuration key "
"is not set in \n"
"your Odoo server configuration file: "
"please set it a value")
if elm.password != config_passwd:
raise UserError(
"Password Error\n--------------------\n"
"Provided password '%s' doesn't match with "
"'Master Password'\n('admin_passwd' key) found in the "
"'Master Password'\n('secure_uninstall' key) found in the "
"Odoo server configuration file ."
"\n\nResolution\n-------------\n"
"Please check your password and retry or cancel"

BIN
secure_uninstall/static/description/img1.png

After

Width: 819  |  Height: 501  |  Size: 58 KiB

5
secure_uninstall/views/module_view.xml

@ -10,10 +10,11 @@
<field name="arch" type="xml">
<field name="module_info" position="after">
<separator string="Secure Uninstall"/>
<label string="If you want uninstall module, write required password."
<label string="If you want uninstall module, write required password ('secure_uninstall' key in ERP config file)."
colspan="4" />
<group col="4">
<field name="password" password="True" attrs="{'required': 1}"/>
<field name="password" password="True" attrs="{'required': 1}"
placeholder="key_provided_by_administrator"/>
<span/>
</group>
</field>

Loading…
Cancel
Save