diff --git a/privacy_right_to_be_forgotten_message/README.rst b/privacy_right_to_be_forgotten_message/README.rst new file mode 100644 index 0000000..f63c8b1 --- /dev/null +++ b/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 +`_. 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 `_. + +Contributors +------------ + +* Florian da Costa + +Do not contact contributors directly about help with questions or problems concerning this addon, but use the `community mailing list `_ or the `appropriate specialized mailinglist `_ 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. diff --git a/privacy_right_to_be_forgotten_message/__init__.py b/privacy_right_to_be_forgotten_message/__init__.py new file mode 100644 index 0000000..632cd00 --- /dev/null +++ b/privacy_right_to_be_forgotten_message/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Akretion +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from . import wizards diff --git a/privacy_right_to_be_forgotten_message/__openerp__.py b/privacy_right_to_be_forgotten_message/__openerp__.py new file mode 100644 index 0000000..379624a --- /dev/null +++ b/privacy_right_to_be_forgotten_message/__openerp__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Akretion +# 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, +} diff --git a/privacy_right_to_be_forgotten_message/static/description/icon.png b/privacy_right_to_be_forgotten_message/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/privacy_right_to_be_forgotten_message/static/description/icon.png differ diff --git a/privacy_right_to_be_forgotten_message/tests/__init__.py b/privacy_right_to_be_forgotten_message/tests/__init__.py new file mode 100644 index 0000000..ab3eb48 --- /dev/null +++ b/privacy_right_to_be_forgotten_message/tests/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Akretion +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from . import test_privacy_right_to_be_forgotten_message diff --git a/privacy_right_to_be_forgotten_message/tests/test_privacy_right_to_be_forgotten_message.py b/privacy_right_to_be_forgotten_message/tests/test_privacy_right_to_be_forgotten_message.py new file mode 100644 index 0000000..b21c48a --- /dev/null +++ b/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 +# 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)) diff --git a/privacy_right_to_be_forgotten_message/wizards/__init__.py b/privacy_right_to_be_forgotten_message/wizards/__init__.py new file mode 100644 index 0000000..741ddaf --- /dev/null +++ b/privacy_right_to_be_forgotten_message/wizards/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Akretion +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from . import res_partner_gdpr diff --git a/privacy_right_to_be_forgotten_message/wizards/res_partner_gdpr.py b/privacy_right_to_be_forgotten_message/wizards/res_partner_gdpr.py new file mode 100644 index 0000000..b08af2e --- /dev/null +++ b/privacy_right_to_be_forgotten_message/wizards/res_partner_gdpr.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Akretion +# 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