[IMP] server_environment_data_encryption, data_encryption: black, isort, prettier

This commit is contained in:
Mourad 2020-10-12 14:07:41 +02:00 committed by Sébastien BEAU
parent 4e38d0e359
commit 76a77780bd
9 changed files with 107 additions and 36 deletions

View File

@ -24,7 +24,9 @@ class EncryptedData(models.Model):
name = fields.Char(required=True, readonly=True, index=True, help="Technical name")
environment = fields.Char(
required=True, index=True, help="Concerned Odoo environment (prod, preprod...)",
required=True,
index=True,
help="Concerned Odoo environment (prod, preprod...)",
)
encrypted_data = fields.Binary(attachment=False)

View File

@ -150,7 +150,10 @@ class ServerEnvMixin(models.AbstractModel):
self, view_id=None, view_type="form", toolbar=False, submenu=False
):
res = super().fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu,
view_id=view_id,
view_type=view_type,
toolbar=toolbar,
submenu=submenu,
)
res["arch"] = self._update_form_view_from_env(res["arch"], view_type)
return res

View File

@ -1,15 +1,22 @@
<form string="Test">
<header>
<button string="Reset Confirmation"
type="object" name="set_draft"
states="done"/>
<button
string="Reset Confirmation"
type="object"
name="set_draft"
states="done"
/>
</header>
<sheet>
<group col="4">
<field name="test" modifiers="{&quot;required&quot;: true}"/>
<field name="test2" attrs="{'readonly': [('type_env_is_editable', '=', False)]}"
on_change="1" modifiers="{&quot;readonly&quot;: [[&quot;type_env_is_editable&quot;, &quot;=&quot;, false]]}"/>
<field name="date" modifiers="{&quot;readonly&quot;: true}"/>
<field name="test" modifiers="{&quot;required&quot;: true}" />
<field
name="test2"
attrs="{'readonly': [('type_env_is_editable', '=', False)]}"
on_change="1"
modifiers="{&quot;readonly&quot;: [[&quot;type_env_is_editable&quot;, &quot;=&quot;, false]]}"
/>
<field name="date" modifiers="{&quot;readonly&quot;: true}" />
</group>
</sheet>
</form>

View File

@ -1,6 +1,11 @@
<form string="Test">
<header>
<button string="Reset Confirmation" type="object" name="set_draft" states="done"/>
<button
string="Reset Confirmation"
type="object"
name="set_draft"
states="done"
/>
</header>
<sheet>
<div class="d-flex justify-content-between">
@ -8,14 +13,31 @@
<strong>Modify values for test environment</strong>
</div>
<div>
<button name="action_change_env_data_encrypted_fields" type="object" string="Define values for preprod" class="btn btn-lg btn-primary ml-2" context="{'environment': 'preprod'}"/>
<button name="action_change_env_data_encrypted_fields" type="object" string="Define values for prod" class="btn btn-lg btn-primary ml-2" context="{'environment': 'prod'}"/>
<button
name="action_change_env_data_encrypted_fields"
type="object"
string="Define values for preprod"
class="btn btn-lg btn-primary ml-2"
context="{'environment': 'preprod'}"
/>
<button
name="action_change_env_data_encrypted_fields"
type="object"
string="Define values for prod"
class="btn btn-lg btn-primary ml-2"
context="{'environment': 'prod'}"
/>
</div>
</div><group col="4">
<field name="test" modifiers="{&quot;required&quot;: true}"/>
<field name="test2" attrs="{'readonly': [('type_env_is_editable', '=', False)]}" on_change="1" modifiers="{&quot;readonly&quot;: [[&quot;type_env_is_editable&quot;, &quot;=&quot;, false]]}"/>
<field name="date" modifiers="{&quot;readonly&quot;: true}"/>
</div>
<group col="4">
<field name="test" modifiers="{&quot;required&quot;: true}" />
<field
name="test2"
attrs="{'readonly': [('type_env_is_editable', '=', False)]}"
on_change="1"
modifiers="{&quot;readonly&quot;: [[&quot;type_env_is_editable&quot;, &quot;=&quot;, false]]}"
/>
<field name="date" modifiers="{&quot;readonly&quot;: true}" />
</group>
</sheet>
</form>

View File

@ -1,6 +1,11 @@
<form string="Test">
<header>
<button string="Reset Confirmation" type="object" name="set_draft" states="done"/>
<button
string="Reset Confirmation"
type="object"
name="set_draft"
states="done"
/>
</header>
<sheet>
<div class="d-flex justify-content-between">
@ -8,14 +13,32 @@
<strong>Modify values for prod environment</strong>
</div>
<div>
<button name="action_change_env_data_encrypted_fields" type="object" string="Define values for preprod" class="btn btn-lg btn-primary ml-2" context="{'environment': 'preprod'}"/>
<button name="action_change_env_data_encrypted_fields" type="object" string="Define values for test" class="btn btn-lg btn-primary ml-2" context="{'environment': 'test'}"/>
<button
name="action_change_env_data_encrypted_fields"
type="object"
string="Define values for preprod"
class="btn btn-lg btn-primary ml-2"
context="{'environment': 'preprod'}"
/>
<button
name="action_change_env_data_encrypted_fields"
type="object"
string="Define values for test"
class="btn btn-lg btn-primary ml-2"
context="{'environment': 'test'}"
/>
</div>
</div><group col="4">
<field name="test" modifiers="{&quot;readonly&quot;: true}" readonly="1"/>
<field name="test2" attrs="{'readonly': [('type_env_is_editable', '=', False)]}" on_change="1" modifiers="{&quot;readonly&quot;: true}" readonly="1"/>
<field name="date" modifiers="{&quot;readonly&quot;: true}" readonly="1"/>
</div>
<group col="4">
<field name="test" modifiers="{&quot;readonly&quot;: true}" readonly="1" />
<field
name="test2"
attrs="{'readonly': [('type_env_is_editable', '=', False)]}"
on_change="1"
modifiers="{&quot;readonly&quot;: true}"
readonly="1"
/>
<field name="date" modifiers="{&quot;readonly&quot;: true}" readonly="1" />
</group>
</sheet>
</form>

View File

@ -0,0 +1 @@
../../../../data_encryption

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@ -0,0 +1 @@
../../../../server_environment_data_encryption

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)