From 29cc32b1e67545a533df96542c9f880fec2f9edd Mon Sep 17 00:00:00 2001 From: Nicolas JEUDY Date: Tue, 2 Nov 2021 15:08:39 +0100 Subject: [PATCH] [NEW] track privacy activity --- privacy_personal_data/__init__.py | 1 + privacy_personal_data/__manifest__.py | 27 ++++ privacy_personal_data/models/__init__.py | 3 + .../models/privacy_activity.py | 59 +++++++++ .../models/privacy_personal_data.py | 74 +++++++++++ privacy_personal_data/models/res_partner.py | 10 ++ .../readme/CONFIGURATION.rst | 2 + privacy_personal_data/readme/CONTRIBUTORS.rst | 1 + privacy_personal_data/readme/DESCRIPTION.rst | 1 + privacy_personal_data/readme/USAGE.rst | 6 + .../security/ir.model.access.csv | 11 ++ .../static/description/icon.png | Bin 0 -> 2130 bytes .../static/description/icon.svg | 115 ++++++++++++++++++ .../views/privacy_activity_view.xml | 45 +++++++ .../views/privacy_objective_view.xml | 40 ++++++ .../views/privacy_personal_category_view.xml | 91 ++++++++++++++ .../views/privacy_personal_data_view.xml | 105 ++++++++++++++++ .../views/res_partner_view.xml | 19 +++ 18 files changed, 610 insertions(+) create mode 100644 privacy_personal_data/__init__.py create mode 100644 privacy_personal_data/__manifest__.py create mode 100644 privacy_personal_data/models/__init__.py create mode 100644 privacy_personal_data/models/privacy_activity.py create mode 100644 privacy_personal_data/models/privacy_personal_data.py create mode 100644 privacy_personal_data/models/res_partner.py create mode 100644 privacy_personal_data/readme/CONFIGURATION.rst create mode 100644 privacy_personal_data/readme/CONTRIBUTORS.rst create mode 100644 privacy_personal_data/readme/DESCRIPTION.rst create mode 100644 privacy_personal_data/readme/USAGE.rst create mode 100644 privacy_personal_data/security/ir.model.access.csv create mode 100644 privacy_personal_data/static/description/icon.png create mode 100644 privacy_personal_data/static/description/icon.svg create mode 100644 privacy_personal_data/views/privacy_activity_view.xml create mode 100644 privacy_personal_data/views/privacy_objective_view.xml create mode 100644 privacy_personal_data/views/privacy_personal_category_view.xml create mode 100644 privacy_personal_data/views/privacy_personal_data_view.xml create mode 100644 privacy_personal_data/views/res_partner_view.xml diff --git a/privacy_personal_data/__init__.py b/privacy_personal_data/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/privacy_personal_data/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/privacy_personal_data/__manifest__.py b/privacy_personal_data/__manifest__.py new file mode 100644 index 0000000..5c3ff88 --- /dev/null +++ b/privacy_personal_data/__manifest__.py @@ -0,0 +1,27 @@ +# Copyright 2019 Myceliandre - Nicolas JEUDY +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +{ + 'name': 'Private Personal Data details', + 'version': '12.0.1.0.0', + 'category': 'Data Protection', + 'summary': 'Provides private data details on privacy activity ', + 'author': "Nicolas JEUDY, " + "Odoo Community Association (OCA)", + 'website': 'http://www.github.com/OCA/data-protection', + 'license': 'AGPL-3', + 'data': [ + 'security/ir.model.access.csv', + 'views/privacy_activity_view.xml', + 'views/privacy_personal_data_view.xml', + 'views/privacy_personal_category_view.xml', + 'views/privacy_objective_view.xml', + 'views/res_partner_view.xml', + ], + 'demo': [ + ], + 'depends': [ + 'mail', 'privacy', + ], + 'installable': True, + 'application': False, +} diff --git a/privacy_personal_data/models/__init__.py b/privacy_personal_data/models/__init__.py new file mode 100644 index 0000000..08a9285 --- /dev/null +++ b/privacy_personal_data/models/__init__.py @@ -0,0 +1,3 @@ +from . import privacy_personal_data +from . import privacy_activity +from . import res_partner diff --git a/privacy_personal_data/models/privacy_activity.py b/privacy_personal_data/models/privacy_activity.py new file mode 100644 index 0000000..e20dc98 --- /dev/null +++ b/privacy_personal_data/models/privacy_activity.py @@ -0,0 +1,59 @@ +# Copyright 2019 Myceliandre - Nicolas JEUDY +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class PersonalDataCategory(models.Model): + _name = "privacy.subject.category" + _description = "Subjects category" + + name = fields.Char('Name', index=True, required=True, translate=True) + + +class PersonalDataLegal(models.Model): + _name = "privacy.legal" + _description = "Legal" + + name = fields.Char('Name', index=True, required=True, translate=True) + + +class PrivacyActivity(models.Model): + _inherit = 'privacy.activity' + + def _default_company(self): + return self.env['res.company']._company_default_get('privacy.activity') + + @api.multi + def _compute_has_sensitive(self): + for record in self: + record.has_sensitive = 'sensitive' in record.personal_data_ids.mapped('type') + + value = fields.Boolean(compute='_get_value') + personal_data_ids = fields.Many2many('privacy.personal.data') + subjects_categ_ids = fields.Many2many('privacy.subject.category') + has_sensitive = fields.Boolean(compute='_compute_has_sensitive') + legal_ids = fields.Many2many('privacy.legal') + controller_ids = fields.Many2many( + "res.partner", + "privacy_activity_res_partner_controler_ids", + string="Controllers", + ) + define_objective = fields.Boolean( + "Define objective", + help="Add detailed objectif from a custom list.", + ) + objective_ids = fields.Many2many('privacy.objective', string="Details") + company_id = fields.Many2one('res.company', 'Company', index=True, default=_default_company) + + +class PrivacyObjective(models.Model): + _name = "privacy.objective" + _description = "Objective database" + + name = fields.Char('Name', index=True, required=True, translate=True) + description = fields.Html('Description') + active = fields.Boolean( + default=True, + index=True, + ) diff --git a/privacy_personal_data/models/privacy_personal_data.py b/privacy_personal_data/models/privacy_personal_data.py new file mode 100644 index 0000000..5a18858 --- /dev/null +++ b/privacy_personal_data/models/privacy_personal_data.py @@ -0,0 +1,74 @@ +# Copyright 2019 Myceliandre - Nicolas JEUDY +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class PersonalDataCategory(models.Model): + _name = "privacy.personal.category" + _description = "Personal Data category" + _parent_name = "parent_id" + _parent_store = True + _rec_name = 'complete_name' + _order = 'complete_name' + + name = fields.Char('Name', index=True, required=True, translate=True) + description = fields.Html( + translate=True, + help="Give more example, explanation of personal data" + ) + complete_name = fields.Char( + 'Complete Name', compute='_compute_complete_name', + store=True) + parent_id = fields.Many2one('privacy.personal.category', 'Parent Category', index=True, ondelete='cascade') + parent_path = fields.Char(index=True) + type = fields.Selection([ + ('common', 'Common'), + ('risk', 'High Risk'), + ('sensitive', 'Sensitive')], + string='Type', + default='common', + required=True,) + child_id = fields.One2many('privacy.personal.category', 'parent_id', 'Child Categories') + + @api.depends('name', 'parent_id.complete_name') + def _compute_complete_name(self): + for category in self: + if category.parent_id: + category.complete_name = '%s / %s' % (category.parent_id.complete_name, category.name) + else: + category.complete_name = category.name + + @api.constrains('parent_id') + def _check_category_recursion(self): + if not self._check_recursion(): + raise ValidationError(_('You cannot create recursive categories.')) + return True + + @api.model + def name_create(self, name): + return self.create({'name': name}).name_get()[0] + + +class PersonalData(models.Model): + _name = "privacy.personal.data" + _description = "Personal Data" + + active = fields.Boolean( + default=True, + index=True, + ) + name = fields.Char( + index=True, + required=True, + translate=True, + ) + description = fields.Html( + translate=True, + help="Data list used in activity" + ) + + categ_id = fields.Many2one('privacy.personal.category', + string="Category", + domain=[('child_id', '=', False)]) + type = fields.Selection(related="categ_id.type",) diff --git a/privacy_personal_data/models/res_partner.py b/privacy_personal_data/models/res_partner.py new file mode 100644 index 0000000..c3726fa --- /dev/null +++ b/privacy_personal_data/models/res_partner.py @@ -0,0 +1,10 @@ +# Copyright 2019 Myceliandre - Nicolas JEUDY +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + internal = fields.Boolean('Internal') diff --git a/privacy_personal_data/readme/CONFIGURATION.rst b/privacy_personal_data/readme/CONFIGURATION.rst new file mode 100644 index 0000000..6c93652 --- /dev/null +++ b/privacy_personal_data/readme/CONFIGURATION.rst @@ -0,0 +1,2 @@ +In the "Privacy", open the "Settings" menu to find and enable +the personal data details feature. diff --git a/privacy_personal_data/readme/CONTRIBUTORS.rst b/privacy_personal_data/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..c97a74f --- /dev/null +++ b/privacy_personal_data/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Nicolas JEUDY diff --git a/privacy_personal_data/readme/DESCRIPTION.rst b/privacy_personal_data/readme/DESCRIPTION.rst new file mode 100644 index 0000000..dce3893 --- /dev/null +++ b/privacy_personal_data/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module provides personal data details in privacy activity. diff --git a/privacy_personal_data/readme/USAGE.rst b/privacy_personal_data/readme/USAGE.rst new file mode 100644 index 0000000..fbf3d8f --- /dev/null +++ b/privacy_personal_data/readme/USAGE.rst @@ -0,0 +1,6 @@ +To define data processing activities: + +#. Go to *Privacy > Master Data > Activities* and create one. +#. Define impacted personal data details + +Consult your lawyer! diff --git a/privacy_personal_data/security/ir.model.access.csv b/privacy_personal_data/security/ir.model.access.csv new file mode 100644 index 0000000..a63dd5a --- /dev/null +++ b/privacy_personal_data/security/ir.model.access.csv @@ -0,0 +1,11 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +read_all,Permission to read category,model_privacy_personal_category,privacy.group_data_protection_user,1,0,0,0 +write_all,Permission to write category,model_privacy_personal_category,privacy.group_data_protection_manager,1,1,1,1 +read,Permission to read personal data,model_privacy_personal_data,privacy.group_data_protection_user,1,0,0,0 +write,Permission to write personal data,model_privacy_personal_data,privacy.group_data_protection_manager,1,1,1,1 +read_objective,Permission to read objectives,model_privacy_objective,privacy.group_data_protection_user,1,0,0,0 +write_objective,Permission to write objectives,model_privacy_objective,privacy.group_data_protection_manager,1,1,1,1 +read_subject_category,Permission to read subject category,model_privacy_subject_category,privacy.group_data_protection_user,1,0,0,0 +write_subject_category,Permission to write subject category,model_privacy_subject_category,privacy.group_data_protection_manager,1,1,1,1 +read_legal,Permission to read legal,model_privacy_legal,privacy.group_data_protection_user,1,0,0,0 +write_legal,Permission to write legal,model_privacy_legal,privacy.group_data_protection_manager,1,1,1,1 diff --git a/privacy_personal_data/static/description/icon.png b/privacy_personal_data/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..f36112ba49ad9f832f68a0a2140c8c523f4bd13a GIT binary patch literal 2130 zcmb7F`8U*U8~=`_u}vza(rbxIZ`p;$qd^UWVr+x5q-H2E04;) zHDq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~m@`*Wi zizKsYSKL)0FqczzS!U|?(p}-{XiM&lJ};0wixdJE6+dhGPl9uBFWMRtnsagOBrZdAo<_tHOalXs*&xad zkGRgad4qKJz$}6?iDjdHx^ldw!PJp{82KFnF;=|;aq(Li&7a=CD2;x~12yG;wr`J} z*A0JLx-_cZM)Xq0;k$|5m~SExVg>S7X6Ik7v>4d*ld~$yYChi!pSNrQtdis%l?}Jc zp!%>b|6g@u{W?8x(@q{aiyaxw`I}Yksud!6(g25te-3Suc#YP$ zY5kPY6WvWKWU~(XwEvKbUlu=a=a7nvQ_04eL0@5Db>wtV=wp0J0wvZ5uwu(jqul^$ z*78|Rd=gi-V6R1o0J0{l#@>*@O8&{alX6GQMo1#7fR5o<*S$qVnumgja&DR{TXl4^ z>Fpuf)e-V$zTG6}{T4;NJ3;nFo;x*%kV{xB9aXY^m@FQ)9=8DAz8PpdFgUD*R7D!b zcMD5U&3cX6^y|V$N|~GJJ0_tA6NZNyDxD`URkW>{AR`B4{p9S+5|r{HL0S(IL{A*n zT${3#iixm`y6+OSL?;D3GnZFlMfghk(E!EH9aoyz-9~=xzU}zG(NA ziftujOpe*6zkFq+=es6PwyqA|o=wx7BsI0NZjN)Tv(Eim><}CM@G0~C${OS^pVvnh zO910aUUo9QRh$|DKd?oGd0FLP>L>4uq#Nfah@{hop2jCtYFkQQjY!-_VoLP|K0i(95CdL4=JN63*-}*lbQPb5^cs|+jm57WY1w=|ETVN4w~jDY0PSs zrRRIDWl2q}oc6x>m;x?!S}iY|SLcEMD6U@3UVPJ==XG!6s@;Fz9h5LaF5*^aPGTZh zrLS{}$3AXo??%4G-iS$klHKw)?Hp$2s)RTwJS@Tu^~Ger46mhiZF#717-nYzr)XkP zinyiKqq`xc9!<~x8J2x{@#(!OKl=6zEB;2EUHk$t$G!FA5%h}UZYny)HMPBab63l^%0c~B_7AxLqGh!t + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/privacy_personal_data/views/privacy_activity_view.xml b/privacy_personal_data/views/privacy_activity_view.xml new file mode 100644 index 0000000..1b5f991 --- /dev/null +++ b/privacy_personal_data/views/privacy_activity_view.xml @@ -0,0 +1,45 @@ + + + + + Privacy Activity Form Personal Data + privacy.activity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/privacy_personal_data/views/privacy_objective_view.xml b/privacy_personal_data/views/privacy_objective_view.xml new file mode 100644 index 0000000..cd17a5e --- /dev/null +++ b/privacy_personal_data/views/privacy_objective_view.xml @@ -0,0 +1,40 @@ + + + + Privacy objective Form + privacy.objective + +
+ +
+ +
+
+
+ + + + + +
+
+
+
+ + Privacy Objective + privacy.objective + tree,form + +

+ Click to add a privacy objective. +

+
+
+ + + +
diff --git a/privacy_personal_data/views/privacy_personal_category_view.xml b/privacy_personal_data/views/privacy_personal_category_view.xml new file mode 100644 index 0000000..6f1e2cd --- /dev/null +++ b/privacy_personal_data/views/privacy_personal_category_view.xml @@ -0,0 +1,91 @@ + + + + + Privacy Personal Category Form + privacy.personal.category + +
+
+ +
+ +
+
+ + + + + + + + + + +
+
+
+
+ + + Privacy Personal Category Tree + privacy.personal.category + + + + + + + + + + + + Privacy Personal Category Search + privacy.personal.category + + + + + + + + + + + + + + + + + Personal Data Category + privacy.personal.category + tree,form + +

+ Click to add a personal data category. +

+
+
+ + + +
diff --git a/privacy_personal_data/views/privacy_personal_data_view.xml b/privacy_personal_data/views/privacy_personal_data_view.xml new file mode 100644 index 0000000..7ccf8f5 --- /dev/null +++ b/privacy_personal_data/views/privacy_personal_data_view.xml @@ -0,0 +1,105 @@ + + + + + Privacy Personal Data Form + privacy.personal.data + +
+
+ +
+ +
+ +
+
+
+ + + + + + + + + + +
+
+
+
+ + + Privacy Personal Data Tree + privacy.personal.data + + + + + + + + + + + + Privacy Personal Data Search + privacy.personal.data + + + + + + + + + + + + + + Personal Data + privacy.personal.data + tree,form + +

+ Click to add a personal data details. +

+
+
+ + + + +
diff --git a/privacy_personal_data/views/res_partner_view.xml b/privacy_personal_data/views/res_partner_view.xml new file mode 100644 index 0000000..4b5ce42 --- /dev/null +++ b/privacy_personal_data/views/res_partner_view.xml @@ -0,0 +1,19 @@ + + + + + Privacy Res partner form + res.partner + + + + + + + + + + + + +