George Daramouskas
6 years ago
committed by
Holger Brunn
11 changed files with 260 additions and 0 deletions
-
71privacy_right_to_be_forgotten/README.rst
-
4privacy_right_to_be_forgotten/__init__.py
-
20privacy_right_to_be_forgotten/__openerp__.py
-
16privacy_right_to_be_forgotten/data/ir_actions_act_window.xml
-
3privacy_right_to_be_forgotten/models/__init__.py
-
BINprivacy_right_to_be_forgotten/static/description/icon.png
-
4privacy_right_to_be_forgotten/tests/__init__.py
-
37privacy_right_to_be_forgotten/tests/test_privacy_right_to_be_forgotten.py
-
32privacy_right_to_be_forgotten/views/res_partner_gdpr.xml
-
4privacy_right_to_be_forgotten/wizards/__init__.py
-
69privacy_right_to_be_forgotten/wizards/res_partner_gdpr.py
@ -0,0 +1,71 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
============ |
|||
Privacy GDPR |
|||
============ |
|||
|
|||
This module was written to extend the functionality of CRM to support |
|||
the new article 7 "Right to be forgotten" and allow you to delete customer's |
|||
personal information from your system. |
|||
|
|||
Installation |
|||
============ |
|||
|
|||
To install this module, you need to: |
|||
|
|||
Follow the usual procedure |
|||
|
|||
Usage |
|||
===== |
|||
|
|||
To use this module, you need to: |
|||
|
|||
Navigate to a customer's form, click More -> GDPR Cleanup. You can see the |
|||
fields that will have their data removed from the system. Adjust and click |
|||
Cleanup for the operation to continue. |
|||
Keep in mind that |
|||
|
|||
#. go to ... |
|||
image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
|||
:alt: Try me on Runbot |
|||
:target: https://runbot.odoo-community.org/runbot/263/8.0 |
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues |
|||
<https://github.com/OCA/data-protection/issues>`_. In case of trouble, please |
|||
check there if your issue has already been reported. If you spotted it first, |
|||
help us smashing it by providing a detailed and welcomed feedback. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Images |
|||
------ |
|||
|
|||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* George Daramouskas <gdaramouskas@therp.nl> |
|||
|
|||
Do not contact contributors directly about help with questions or problems concerning this addon, but use the `community mailing list <mailto:community@mail.odoo.com>`_ or the `appropriate specialized mailinglist <https://odoo-community.org/groups>`_ for help, and the bug tracker linked in `Bug Tracker`_ above for technical issues. |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: https://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: https://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
OCA, or the Odoo Community Association, is a nonprofit organization whose |
|||
mission is to support the collaborative development of Odoo features and |
|||
promote its widespread use. |
|||
|
|||
To contribute to this module, please visit https://odoo-community.org. |
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2018 Therp BV <https://therp.nl> |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
|||
from . import wizards |
@ -0,0 +1,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2018 Therp BV <https://therp.nl> |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
|||
{ |
|||
"name": "Privacy GDPR", |
|||
"version": "8.0.1.0.0", |
|||
"author": "Therp BV,Odoo Community Association (OCA)", |
|||
"license": "AGPL-3", |
|||
"category": "GDPR", |
|||
"summary": "Allow a user to delete personal information for a customer.", |
|||
"depends": [ |
|||
'base', |
|||
], |
|||
"data": [ |
|||
'views/res_partner_gdpr.xml', |
|||
'data/ir_actions_act_window.xml', |
|||
], |
|||
"installable": True, |
|||
"application": False, |
|||
} |
@ -0,0 +1,16 @@ |
|||
<openerp> |
|||
<data> |
|||
|
|||
<act_window id="gdpr_action" |
|||
name="GDPR Cleanup" |
|||
res_model="res.partner.gdpr" |
|||
src_model="res.partner" |
|||
view_mode="form" |
|||
view_id="res_partner_gdpr_form" |
|||
target="new" |
|||
context="{'default_partner_ids': active_ids}" |
|||
multi="True" |
|||
key2="client_action_multi" /> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2018 Therp BV <https://therp.nl> |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
After Width: 128 | Height: 128 | Size: 9.2 KiB |
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2018 Therp BV <https://therp.nl> |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
|||
from . import test_privacy_right_to_be_forgotten |
@ -0,0 +1,37 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2018 Therp BV <https://therp.nl> |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). |
|||
from openerp.tests.common import SingleTransactionCase |
|||
from ..wizards.res_partner_gdpr import FIELDS_GDPR |
|||
|
|||
CLEANUP_STRING = '*** GDPR removed ***' |
|||
|
|||
|
|||
class TestPrivacyGdpr(SingleTransactionCase): |
|||
|
|||
at_install = False |
|||
post_install = True |
|||
|
|||
def test_privacy_gdpr(self): |
|||
res_partner_gdpr = self.env['res.partner.gdpr'] |
|||
customer = self._create_test_customer() |
|||
self._gdpr_cleanup(customer) |
|||
for field in FIELDS_GDPR: |
|||
attr = getattr(customer, field) |
|||
if attr: |
|||
self.assertTrue(res_partner_gdpr._get_remove_text() in attr) |
|||
|
|||
def _create_test_customer(self): |
|||
vals = {} |
|||
for field in FIELDS_GDPR: |
|||
if field == 'name': |
|||
vals.update({field: 'Name'}) |
|||
else: |
|||
vals.update({field: False}) |
|||
return self.env['res.partner'].create(vals) |
|||
|
|||
def _gdpr_cleanup(self, customer): |
|||
wiz = self.env['res.partner.gdpr'].create({ |
|||
'partner_ids': [(6, False, customer.ids)]}) |
|||
self.assertTrue(wiz.fields, True) |
|||
wiz.action_gdpr_res_partner_cleanup() |
@ -0,0 +1,32 @@ |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="res_partner_gdpr_form" model="ir.ui.view"> |
|||
<field name="name">res.partner.gdpr.form</field> |
|||
<field name="model">res.partner.gdpr</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="GDPR Cleanup"> |
|||
<group col="4" colspan="4"> |
|||
<field name="fields" colspan="2"> |
|||
<field name="name" /> |
|||
<field name="model" /> |
|||
</field> |
|||
</group> |
|||
<footer> |
|||
<button |
|||
class="oe_highlight" |
|||
icon="gtk-execute" |
|||
name="action_gdpr_res_partner_cleanup" |
|||
string="Cleanup" |
|||
type="object"/> |
|||
<button |
|||
icon="gtk-close" |
|||
special="cancel" |
|||
string="Close"/> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2018 Therp BV <https://therp.nl> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
from . import res_partner_gdpr |
@ -0,0 +1,69 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2018 Therp BV <https://therp.nl> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
from openerp import api, fields, models, _ |
|||
|
|||
FIELDS_GDPR = [ |
|||
'image', |
|||
'name', |
|||
'street', |
|||
'street2', |
|||
'zip', |
|||
'city', |
|||
'website', |
|||
'function', |
|||
'phone', |
|||
'mobile', |
|||
'fax', |
|||
'email', |
|||
'title', |
|||
'child_ids', |
|||
] |
|||
|
|||
|
|||
class ResPartnerGdpr(models.TransientModel): |
|||
_name = 'res.partner.gdpr' |
|||
|
|||
def _default_fields(self): |
|||
res_partner = self.env['ir.model'].search([ |
|||
('model', '=', 'res.partner')]) |
|||
return [(6, 0, self.env['ir.model.fields'].search([ |
|||
('model_id', '=', res_partner.id), |
|||
('name', 'in', FIELDS_GDPR)]).ids)] |
|||
|
|||
partner_ids = fields.Many2many('res.partner') |
|||
fields = fields.Many2many( |
|||
'ir.model.fields', |
|||
default=_default_fields, |
|||
domain=[('model_id.model', '=', 'res.partner')], |
|||
help='Fields to delete data from.', |
|||
) |
|||
|
|||
@api.multi |
|||
def _get_remove_text(self): |
|||
return _('*** GDPR removed ***') |
|||
|
|||
@api.multi |
|||
def action_gdpr_res_partner_cleanup(self): |
|||
self._pre_gdpr_cleanup() |
|||
self._gdpr_cleanup() |
|||
self._post_gdpr_cleanup() |
|||
|
|||
@api.multi |
|||
def _pre_gdpr_cleanup(self): |
|||
pass |
|||
|
|||
@api.multi |
|||
def _gdpr_cleanup(self): |
|||
self.ensure_one() |
|||
vals = {} |
|||
for field in self.fields: |
|||
if field.ttype in ['many2many', 'many2one', 'one2many', 'binary']: |
|||
vals.update({field.name: False}) |
|||
else: |
|||
vals.update({field.name: self._get_remove_text()}) |
|||
self.partner_ids.write(vals) |
|||
|
|||
@api.multi |
|||
def _post_gdpr_cleanup(self): |
|||
self.partner_ids.write({'active': False}) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue