Browse Source

ADD privacy_right_to_be_forgotten_message module

pull/23/head
Florian da Costa 6 years ago
parent
commit
fdef3832dc
  1. 69
      privacy_right_to_be_forgotten_message/README.rst
  2. 4
      privacy_right_to_be_forgotten_message/__init__.py
  3. 20
      privacy_right_to_be_forgotten_message/__openerp__.py
  4. BIN
      privacy_right_to_be_forgotten_message/static/description/icon.png
  5. 4
      privacy_right_to_be_forgotten_message/tests/__init__.py
  6. 19
      privacy_right_to_be_forgotten_message/tests/test_privacy_right_to_be_forgotten_message.py
  7. 4
      privacy_right_to_be_forgotten_message/wizards/__init__.py
  8. 27
      privacy_right_to_be_forgotten_message/wizards/res_partner_gdpr.py

69
privacy_right_to_be_forgotten_message/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 Message
====================
This module was written to complete the module privacy_right_to_be_forgotten
by erasing the messages linked to the partner we are erasing the personal datas.
Installation
============
This module will be installed automatically in case you have the modules
privacy_right_to_be_forgotten and mail 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_message/__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_message/__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 Messages",
"version": "8.0.1.0.0",
"author": "Akretion,Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "GDPR",
"summary": "Delete messages linked to a customer when erasing its datas",
"depends": [
'privacy_right_to_be_forgotten',
'mail',
],
"data": [
],
"installable": True,
"application": False,
'auto_install': True,
}

BIN
privacy_right_to_be_forgotten_message/static/description/icon.png

After

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

4
privacy_right_to_be_forgotten_message/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_message

19
privacy_right_to_be_forgotten_message/tests/test_privacy_right_to_be_forgotten_message.py

@ -0,0 +1,19 @@
# -*- 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 TestPrivacyGdprMessage(TestPrivacyGdpr):
def test_privacy_gdpr_message(self):
vals = {
'name': 'Test',
}
partner = self.env['res.partner'].create(vals)
# A message is created automatically on creation
self.assertEqual(1, len(partner.message_ids))
self._gdpr_cleanup(partner)
self.assertEqual(0, len(partner.message_ids))

4
privacy_right_to_be_forgotten_message/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

27
privacy_right_to_be_forgotten_message/wizards/res_partner_gdpr.py

@ -0,0 +1,27 @@
# -*- 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
from openerp.addons.privacy_right_to_be_forgotten.wizards import (
res_partner_gdpr
)
FIELDS_GDPR = [
'message_ids'
]
res_partner_gdpr.FIELDS_GDPR += FIELDS_GDPR
class ResPartnerGdpr(models.TransientModel):
_inherit = 'res.partner.gdpr'
@api.model
def _do_gdpr_cleanup(self, fields, records):
res = super(ResPartnerGdpr, self)._do_gdpr_cleanup(fields, records)
message_field = fields.filtered(
lambda f: f.name == 'message_ids' and
f.relation == 'mail.message')
if message_field:
messages = records.mapped('message_ids')
messages.unlink()
return res
Loading…
Cancel
Save