Browse Source

Add module to remove data on crm when removing data of a partner in the GDPR context

pull/24/head
Florian da Costa 6 years ago
parent
commit
01cc4c7961
  1. 69
      privacy_right_to_be_forgotten_crm/README.rst
  2. 4
      privacy_right_to_be_forgotten_crm/__init__.py
  3. 20
      privacy_right_to_be_forgotten_crm/__openerp__.py
  4. BIN
      privacy_right_to_be_forgotten_crm/static/description/icon.png
  5. 4
      privacy_right_to_be_forgotten_crm/tests/__init__.py
  6. 23
      privacy_right_to_be_forgotten_crm/tests/test_privacy_right_to_be_forgotten_crm.py
  7. 4
      privacy_right_to_be_forgotten_crm/wizards/__init__.py
  8. 44
      privacy_right_to_be_forgotten_crm/wizards/res_partner_gdpr.py

69
privacy_right_to_be_forgotten_crm/README.rst

@ -0,0 +1,69 @@
.. 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 CRM
================
This module was written to complete the module privacy_right_to_be_forgotten
by erasing removing datas on the leads linked to the partner we want to erase the datas
Installation
============
This module will be installed automatically in case you have the modules
privacy_right_to_be_forgotten and crm installed.
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
------------
* Florian da Costa <florian.dacosta@akretion.com>
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.

4
privacy_right_to_be_forgotten_crm/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Akretion <https://akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import wizards

20
privacy_right_to_be_forgotten_crm/__openerp__.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Akretion <https://akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Privacy GDPR CRM",
"version": "8.0.1.0.0",
"author": "Akretion,Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "GDPR",
"summary": "Delete Crm Leads after removing a partner datas",
"depends": [
'privacy_right_to_be_forgotten',
'crm',
],
"data": [
],
"installable": True,
"application": False,
'auto_install': True,
}

BIN
privacy_right_to_be_forgotten_crm/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

4
privacy_right_to_be_forgotten_crm/tests/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Akretion <https://akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import test_privacy_right_to_be_forgotten_crm

23
privacy_right_to_be_forgotten_crm/tests/test_privacy_right_to_be_forgotten_crm.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Akretion <https://akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp.addons.privacy_right_to_be_forgotten.tests.common import (
TestPrivacyGdpr
)
class TestPrivacyGdprCRM(TestPrivacyGdpr):
def test_privacy_gdpr_crm(self):
partner_gdpr = self.env['res.partner.gdpr']
customer = self._create_test_customer()
lead_vals = {
'name': 'Partner Test Lead',
'partner_id': customer.id,
'street': 'test street',
'email_from': 'test email'
}
lead = self.env['crm.lead'].create(lead_vals)
self._gdpr_cleanup(customer)
self.assertEqual(False, lead.active)
self.assertTrue(partner_gdpr._get_remove_text() == lead.email_from)

4
privacy_right_to_be_forgotten_crm/wizards/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Akretion <https://akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import res_partner_gdpr

44
privacy_right_to_be_forgotten_crm/wizards/res_partner_gdpr.py

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Akretion <https://akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp import api, models
CRM_GDPR_FIELDS = [
'name',
'email_from',
'email_cc',
'description',
'contact_name',
'partner_name',
'referred',
'phone',
'street',
'street2',
'zip',
'city',
'state_id',
'phone',
'fax',
'mobile',
'function',
'title',
'message_ids',
]
class ResPartnerGdpr(models.TransientModel):
_inherit = 'res.partner.gdpr'
@api.multi
def _post_gdpr_cleanup(self):
super(ResPartnerGdpr, self)._post_gdpr_cleanup()
leads = self.env['crm.lead'].with_context(active_test=False).search(
[('partner_id', 'in', self.partner_ids.ids)])
if leads:
lead_model = self.env['ir.model'].search([
('model', '=', 'crm.lead')])
fields = self.env['ir.model.fields'].search([
('model_id', '=', lead_model.id),
('name', 'in', CRM_GDPR_FIELDS)])
self._do_gdpr_cleanup(fields, leads)
leads.write({'active': False})
Loading…
Cancel
Save