Browse Source

[IMP] privacy: pre-commit run

pull/55/head
Jairo Llopis 4 years ago
committed by Valtteri Lattu
parent
commit
f74459a745
  1. 40
      privacy/__manifest__.py
  2. 6
      privacy/demo/res_users.xml
  3. 21
      privacy/models/privacy_activity.py
  4. 25
      privacy/security/data_protection.xml
  5. 73
      privacy/views/data_protection_menu_view.xml
  6. 82
      privacy/views/privacy_activity_view.xml

40
privacy/__manifest__.py

@ -1,28 +1,22 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L. # Copyright 2018 Eficent Business and IT Consulting Services S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{ {
'name': 'Data Privacy and Protection',
'version': '12.0.1.1.0',
'category': 'Data Protection',
'summary': 'Provides data privacy and protection features '
'to comply to regulations, such as GDPR.',
'author': "Eficent, "
"Tecnativa, "
"Odoo Community Association (OCA)",
'website': 'http://www.github.com/OCA/data-protection',
'license': 'AGPL-3',
'data': [
'security/data_protection.xml',
'security/ir.model.access.csv',
'views/data_protection_menu_view.xml',
'views/privacy_activity_view.xml',
"name": "Data Privacy and Protection",
"version": "12.0.1.1.0",
"category": "Data Protection",
"summary": "Provides data privacy and protection features "
"to comply to regulations, such as GDPR.",
"author": "Eficent, " "Tecnativa, " "Odoo Community Association (OCA)",
"website": "http://www.github.com/OCA/data-protection",
"license": "AGPL-3",
"data": [
"security/data_protection.xml",
"security/ir.model.access.csv",
"views/data_protection_menu_view.xml",
"views/privacy_activity_view.xml",
], ],
'demo': [
'demo/res_users.xml',
],
'depends': [
'mail',
],
'installable': True,
'application': True,
"demo": ["demo/res_users.xml"],
"depends": ["mail"],
"installable": True,
"application": True,
} }

6
privacy/demo/res_users.xml

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Tecnativa - Jairo Llopis <!-- Copyright 2018 Tecnativa - Jairo Llopis
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<data> <data>
<record id="base.user_demo" model="res.users"> <record id="base.user_demo" model="res.users">
<field name="groups_id" eval="[(4, ref('group_data_protection_user'))]"/>
<field name="groups_id" eval="[(4, ref('group_data_protection_user'))]" />
</record> </record>
</data> </data>

21
privacy/models/privacy_activity.py

@ -7,20 +7,12 @@ from odoo import api, fields, models
class PrivacyActivity(models.Model): class PrivacyActivity(models.Model):
_name = "privacy.activity" _name = "privacy.activity"
_description = "Data processing activities" _description = "Data processing activities"
_inherit = ['mail.thread', 'mail.activity.mixin']
_inherit = ["mail.thread", "mail.activity.mixin"]
active = fields.Boolean(
default=True,
index=True,
)
name = fields.Char(
index=True,
required=True,
translate=True,
)
active = fields.Boolean(default=True, index=True,)
name = fields.Char(index=True, required=True, translate=True,)
description = fields.Html( description = fields.Html(
translate=True,
help="How is personal data used here? Why? Etc."
translate=True, help="How is personal data used here? Why? Etc."
) )
controller_id = fields.Many2one( controller_id = fields.Many2one(
"res.partner", "res.partner",
@ -28,7 +20,7 @@ class PrivacyActivity(models.Model):
required=True, required=True,
default=lambda self: self._default_controller_id(), default=lambda self: self._default_controller_id(),
help="Whoever determines the purposes and means of the processing " help="Whoever determines the purposes and means of the processing "
"of personal data.",
"of personal data.",
) )
processor_ids = fields.Many2many( processor_ids = fields.Many2many(
"res.partner", "res.partner",
@ -37,8 +29,7 @@ class PrivacyActivity(models.Model):
help="Whoever processes personal data on behalf of the controller.", help="Whoever processes personal data on behalf of the controller.",
) )
subject_find = fields.Boolean( subject_find = fields.Boolean(
"Define subjects",
help="Are affected subjects present in this database?",
"Define subjects", help="Are affected subjects present in this database?",
) )
subject_domain = fields.Char( subject_domain = fields.Char(
"Subjects filter", "Subjects filter",

25
privacy/security/data_protection.xml

@ -1,30 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L. <!-- Copyright 2018 Eficent Business and IT Consulting Services S.L.
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) --> License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
<odoo> <odoo>
<data noupdate="0"> <data noupdate="0">
<record model="ir.module.category" id="module_category_data_protection"> <record model="ir.module.category" id="module_category_data_protection">
<field name="name">Data Protection</field> <field name="name">Data Protection</field>
<field name="sequence">30</field> <field name="sequence">30</field>
</record> </record>
<record id="group_data_protection_user" model="res.groups"> <record id="group_data_protection_user" model="res.groups">
<field name="name">Data Protection User</field> <field name="name">Data Protection User</field>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="category_id" ref="module_category_data_protection"/>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]" />
<field name="category_id" ref="module_category_data_protection" />
</record> </record>
<record id="group_data_protection_manager" model="res.groups"> <record id="group_data_protection_manager" model="res.groups">
<field name="name">Data Protection Manager</field> <field name="name">Data Protection Manager</field>
<field name="implied_ids" eval="[(4, ref('privacy.group_data_protection_user'))]"/>
<field name="category_id" ref="module_category_data_protection"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
<field
name="implied_ids"
eval="[(4, ref('privacy.group_data_protection_user'))]"
/>
<field name="category_id" ref="module_category_data_protection" />
<field name="users" eval="[(4, ref('base.user_root'))]" />
</record> </record>
<record id="base.user_root" model="res.users"> <record id="base.user_root" model="res.users">
<field name="groups_id" eval="[(4, ref('group_data_protection_manager'))]"/>
<field
name="groups_id"
eval="[(4, ref('group_data_protection_manager'))]"
/>
</record> </record>
</data> </data>
</odoo> </odoo>

73
privacy/views/data_protection_menu_view.xml

@ -1,8 +1,7 @@
<?xml version="1.0"?>
<?xml version="1.0" ?>
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L. <!-- Copyright 2018 Eficent Business and IT Consulting Services S.L.
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) --> License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
<data> <data>
<record id="action_data_protection_partner_form" model="ir.actions.act_window"> <record id="action_data_protection_partner_form" model="ir.actions.act_window">
<field name="name">Partners</field> <field name="name">Partners</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
@ -10,38 +9,40 @@
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field> <field name="view_mode">kanban,tree,form</field>
</record> </record>
<menuitem id="parent_menu_data_protection"
name="Privacy"
groups="group_data_protection_user"
web_icon="privacy,static/description/icon.png"
<menuitem
id="parent_menu_data_protection"
name="Privacy"
groups="group_data_protection_user"
web_icon="privacy,static/description/icon.png"
/> />
<menuitem id="menu_data_protection_master_data"
name="Master Data"
parent="parent_menu_data_protection"
groups="group_data_protection_user"
sequence="10"
<menuitem
id="menu_data_protection_master_data"
name="Master Data"
parent="parent_menu_data_protection"
groups="group_data_protection_user"
sequence="10"
/> />
<menuitem id="menu_data_protection_partner"
name="Partners"
parent="menu_data_protection_master_data"
action="action_data_protection_partner_form"
sequence="1010"
<menuitem
id="menu_data_protection_partner"
name="Partners"
parent="menu_data_protection_master_data"
action="action_data_protection_partner_form"
sequence="1010"
/> />
<menuitem id="menu_data_protection_transaction"
name="Transactions"
parent="parent_menu_data_protection"
groups="group_data_protection_user"
sequence="20"
<menuitem
id="menu_data_protection_transaction"
name="Transactions"
parent="parent_menu_data_protection"
groups="group_data_protection_user"
sequence="20"
/> />
<menuitem id="menu_data_protection_report"
name="Reports"
parent="parent_menu_data_protection"
groups="group_data_protection_user"
sequence="30"
<menuitem
id="menu_data_protection_report"
name="Reports"
parent="parent_menu_data_protection"
groups="group_data_protection_user"
sequence="30"
/> />
<record id="action_data_protection_config" model="ir.actions.act_window"> <record id="action_data_protection_config" model="ir.actions.act_window">
<field name="name">Data Protection Settings</field> <field name="name">Data Protection Settings</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
@ -50,12 +51,12 @@
<field name="target">inline</field> <field name="target">inline</field>
<field name="context">{'module': 'data_protection'}</field> <field name="context">{'module': 'data_protection'}</field>
</record> </record>
<menuitem id="menu_data_protection_setting"
name="Settings"
parent="parent_menu_data_protection"
action="action_data_protection_config"
groups="group_data_protection_manager"
sequence="90"
<menuitem
id="menu_data_protection_setting"
name="Settings"
parent="parent_menu_data_protection"
action="action_data_protection_config"
groups="group_data_protection_manager"
sequence="90"
/> />
</data> </data>

82
privacy/views/privacy_activity_view.xml

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Tecnativa - Jairo Llopis <!-- Copyright 2018 Tecnativa - Jairo Llopis
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<data> <data>
<record model="ir.ui.view" id="activity_form"> <record model="ir.ui.view" id="activity_form">
<field name="name">Privacy Activity Form</field> <field name="name">Privacy Activity Form</field>
<field name="model">privacy.activity</field> <field name="model">privacy.activity</field>
@ -27,86 +26,83 @@
</button> </button>
</div> </div>
<div class="oe_title"> <div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
<label for="name" class="oe_edit_only" />
<h1>
<field name="name" />
</h1>
</div> </div>
<group name="basic"> <group name="basic">
<group name="owners"> <group name="owners">
<field name="controller_id"/>
<field name="controller_id" />
</group> </group>
<group name="dates"> <group name="dates">
<field name="create_date" readonly="1"/>
<field name="write_date" readonly="1"/>
<field name="write_uid" readonly="1"/>
<field name="create_date" readonly="1" />
<field name="write_date" readonly="1" />
<field name="write_uid" readonly="1" />
</group> </group>
</group> </group>
<separator name="subjects" string="Subjects details"/>
<separator name="subjects" string="Subjects details" />
<group name="subjects"> <group name="subjects">
<field name="subject_find"/>
<field
name="subject_domain"
widget="domain"
options='{"model": "res.partner"}'
attrs='{"required": [("subject_find", "=", True)],
<field name="subject_find" />
<field
name="subject_domain"
widget="domain"
options='{"model": "res.partner"}'
attrs='{"required": [("subject_find", "=", True)],
"invisible": [("subject_find", "=", False)]}' "invisible": [("subject_find", "=", False)]}'
/>
/>
</group> </group>
<separator name="processors" string="Processors"/>
<separator name="processors" string="Processors" />
<group name="processors"> <group name="processors">
<field
name="processor_ids"
widget="many2many"
>
<tree string="processors">
<field name="name"/>
<field name="email"/>
<field name="country_id"/>
</tree>
</field>
<field name="processor_ids" widget="many2many">
<tree string="processors">
<field name="name" />
<field name="email" />
<field name="country_id" />
</tree>
</field>
</group> </group>
<notebook string="Details" name="advanced"> <notebook string="Details" name="advanced">
<page string="Description"> <page string="Description">
<group> <group>
<field name="description" nolabel="1"/>
<field name="description" nolabel="1" />
</group> </group>
</page> </page>
</notebook> </notebook>
</sheet> </sheet>
<div class="oe_chatter"> <div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
<field name="message_follower_ids" widget="mail_followers" />
<field name="message_ids" widget="mail_thread" />
</div> </div>
</form> </form>
</field> </field>
</record> </record>
<record model="ir.ui.view" id="activity_tree"> <record model="ir.ui.view" id="activity_tree">
<field name="name">Privacy Activity Tree</field> <field name="name">Privacy Activity Tree</field>
<field name="model">privacy.activity</field> <field name="model">privacy.activity</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree> <tree>
<field name="name"/>
<field name="controller_id"/>
<field name="processor_ids"/>
<field name="name" />
<field name="controller_id" />
<field name="processor_ids" />
</tree> </tree>
</field> </field>
</record> </record>
<record model="ir.ui.view" id="activity_search"> <record model="ir.ui.view" id="activity_search">
<field name="name">Privacy Activity Search</field> <field name="name">Privacy Activity Search</field>
<field name="model">privacy.activity</field> <field name="model">privacy.activity</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search> <search>
<field name="name"/>
<field name="controller_id"/>
<field name="processor_ids"/>
<separator/>
<field name="name" />
<field name="controller_id" />
<field name="processor_ids" />
<separator />
<filter <filter
string="Archived" string="Archived"
name="inactive" name="inactive"
domain="[('active', '=', False)]" domain="[('active', '=', False)]"
/> />
<separator/>
<separator />
<group string="Group By" name="groupby"> <group string="Group By" name="groupby">
<filter <filter
name="controller_id_groupby" name="controller_id_groupby"
@ -117,7 +113,6 @@
</search> </search>
</field> </field>
</record> </record>
<record id="activity_action" model="ir.actions.act_window"> <record id="activity_action" model="ir.actions.act_window">
<field name="name">Activities</field> <field name="name">Activities</field>
<field name="res_model">privacy.activity</field> <field name="res_model">privacy.activity</field>
@ -125,18 +120,17 @@
<field name="help" type="html"> <field name="help" type="html">
<p class="oe_view_nocontent_create"> <p class="oe_view_nocontent_create">
Click to add a data processing activity. Click to add a data processing activity.
</p><p>
</p>
<p>
Data processing activities define why, how and what you do Data processing activities define why, how and what you do
with subjects' personal data. with subjects' personal data.
</p> </p>
</field> </field>
</record> </record>
<menuitem <menuitem
action="activity_action" action="activity_action"
groups="group_data_protection_user" groups="group_data_protection_user"
id="menu_privacy_activity" id="menu_privacy_activity"
parent="menu_data_protection_master_data" parent="menu_data_protection_master_data"
/> />
</data> </data>
Loading…
Cancel
Save