fixup! Add module server_environment_data_encryption

This commit is contained in:
Florian da Costa 2019-10-23 16:33:55 +02:00
parent d51bebf41a
commit 24e7f6d232
3 changed files with 9 additions and 13 deletions

View File

@ -4,11 +4,9 @@
"version": "12.0.1.0.0",
"development_status": 'Alpha',
"category": "Tools",
"website": "https://akretion.com/",
"website": "https://github.com/OCA/server-env",
"author": "Akretion, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["server_environment", "data_encryption"],
"data": [],
}

View File

@ -15,7 +15,7 @@ class ServerEnvMixin(models.AbstractModel):
_inherit = "server.env.mixin"
def _compute_server_env_from_default(self, field_name, options):
"First return database encrypted value then default value"
""" First return database encrypted value then default value """
self.ensure_one()
encrypted_data_name = "%s,%s" % (self._name, self.id)
env = self.env.context.get("environment", None)
@ -54,11 +54,12 @@ class ServerEnvMixin(models.AbstractModel):
def action_change_env_data_encrypted_fields(self):
action_id = self.env.context.get("params", {}).get("action")
if not action_id:
# We don't know which action we are using... take one random.
action_id = self.env['ir.actions.act_window'].search(
[('res_model', '=', self._name)], limit=1).id
action = self.env["ir.actions.act_window"].browse(action_id).read()[0]
action["view_mode"] = "form"
# We don't know which action we are using... take default one
action = self.get_formview_action()
else:
action = self.env["ir.actions.act_window"].browse(
action_id).read()[0]
action["view_mode"] = "form"
action["res_id"] = self.id
views_form = []
for view_id, view_type in action.get("views", []):
@ -68,6 +69,7 @@ class ServerEnvMixin(models.AbstractModel):
return action
def _get_extra_environment_info_div(self, current_env, extra_envs):
# TODO we could use a qweb template here
button_div = "<div>"
button_string = _("Define values for ")
for environment in extra_envs:

View File

@ -6,10 +6,6 @@ from pathlib import Path
class TestServerEnvDataEncrypted(CommonDataEncrypted):
# def test_store_data_no_superuser(self):
# self.env['server.env.mixin']._inverse_server_env('test')
# pass
def test_dynamic_view_current_env(self):
self.maxDiff = None
self.set_new_key_env("prod")