You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.5 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2018 Tecnativa - Jairo Llopis
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  4. from odoo import api, fields, models
  5. class PrivacyActivity(models.Model):
  6. _name = "privacy.activity"
  7. _description = "Data processing activities"
  8. _inherit = "mail.thread"
  9. active = fields.Boolean(
  10. default=True,
  11. index=True,
  12. )
  13. name = fields.Char(
  14. index=True,
  15. required=True,
  16. translate=True,
  17. )
  18. description = fields.Html(
  19. translate=True,
  20. help="How is personal data used here? Why? Etc."
  21. )
  22. controller_id = fields.Many2one(
  23. "res.partner",
  24. string="Controller",
  25. required=True,
  26. default=lambda self: self._default_controller_id(),
  27. help="Whoever determines the purposes and means of the processing "
  28. "of personal data.",
  29. )
  30. processor_ids = fields.Many2many(
  31. "res.partner",
  32. "privacy_activity_res_partner_processor_ids",
  33. string="Processors",
  34. help="Whoever processes personal data on behalf of the controller.",
  35. )
  36. subject_find = fields.Boolean(
  37. "Define subjects",
  38. help="Are affected subjects present in this database?",
  39. )
  40. subject_domain = fields.Char(
  41. "Subjects filter",
  42. default="[]",
  43. help="Selection filter to find specific subjects included.",
  44. )
  45. @api.model
  46. def _default_controller_id(self):
  47. """By default it should be the current user's company."""
  48. return self.env.user.company_id