diff --git a/privacy_right_to_be_forgotten_crm/README.rst b/privacy_right_to_be_forgotten_crm/README.rst new file mode 100644 index 0000000..2711794 --- /dev/null +++ b/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 +`_. 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_crm/__init__.py b/privacy_right_to_be_forgotten_crm/__init__.py new file mode 100644 index 0000000..632cd00 --- /dev/null +++ b/privacy_right_to_be_forgotten_crm/__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_crm/__openerp__.py b/privacy_right_to_be_forgotten_crm/__openerp__.py new file mode 100644 index 0000000..51a1cd0 --- /dev/null +++ b/privacy_right_to_be_forgotten_crm/__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 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, +} diff --git a/privacy_right_to_be_forgotten_crm/static/description/icon.png b/privacy_right_to_be_forgotten_crm/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/privacy_right_to_be_forgotten_crm/static/description/icon.png differ diff --git a/privacy_right_to_be_forgotten_crm/tests/__init__.py b/privacy_right_to_be_forgotten_crm/tests/__init__.py new file mode 100644 index 0000000..035fbd6 --- /dev/null +++ b/privacy_right_to_be_forgotten_crm/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_crm diff --git a/privacy_right_to_be_forgotten_crm/tests/test_privacy_right_to_be_forgotten_crm.py b/privacy_right_to_be_forgotten_crm/tests/test_privacy_right_to_be_forgotten_crm.py new file mode 100644 index 0000000..3f74bca --- /dev/null +++ b/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 +# 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) diff --git a/privacy_right_to_be_forgotten_crm/wizards/__init__.py b/privacy_right_to_be_forgotten_crm/wizards/__init__.py new file mode 100644 index 0000000..741ddaf --- /dev/null +++ b/privacy_right_to_be_forgotten_crm/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_crm/wizards/res_partner_gdpr.py b/privacy_right_to_be_forgotten_crm/wizards/res_partner_gdpr.py new file mode 100644 index 0000000..cb44666 --- /dev/null +++ b/privacy_right_to_be_forgotten_crm/wizards/res_partner_gdpr.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Akretion +# 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})