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.

114 lines
3.7 KiB

  1. # Copyright 2019 Myceliandre - Nicolas JEUDY
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  3. from odoo import api, fields, models
  4. class PersonalDataCategory(models.Model):
  5. _name = "privacy.subject.category"
  6. _description = "Subjects category"
  7. name = fields.Char("Name", index=True, required=True, translate=True)
  8. class PersonalDataLegal(models.Model):
  9. _name = "privacy.legal"
  10. _description = "Legal"
  11. name = fields.Char("Name", index=True, required=True, translate=True)
  12. class ComputingSystem(models.Model):
  13. _name = "privacy.computing_system"
  14. _description = "Computing System"
  15. name = fields.Char("Name", index=True, required=True, translate=True)
  16. class PrivacyActivity(models.Model):
  17. _inherit = "privacy.activity"
  18. def _default_company(self):
  19. return self.env["res.company"]._company_default_get("privacy.activity")
  20. @api.multi
  21. def _compute_has_sensitive(self):
  22. for record in self:
  23. record.has_sensitive = "sensitive" in record.personal_data_ids.mapped(
  24. "type"
  25. )
  26. value = fields.Boolean(compute="_get_value")
  27. personal_data_ids = fields.Many2many("privacy.personal.data")
  28. subjects_categ_ids = fields.Many2many("privacy.subject.category")
  29. has_sensitive = fields.Boolean(compute="_compute_has_sensitive")
  30. legal_ids = fields.Many2many("privacy.legal")
  31. controller_ids = fields.Many2many(
  32. "res.partner",
  33. "privacy_activity_res_partner_controler_ids",
  34. string="Controllers",
  35. )
  36. define_objective = fields.Boolean(
  37. "Define objective",
  38. help="Add detailed objectif from a custom list.",
  39. )
  40. objective_ids = fields.Many2many("privacy.objective", string="Details")
  41. company_id = fields.Many2one(
  42. "res.company", "Company", index=True, default=_default_company
  43. )
  44. define_medium = fields.Boolean("Define Medium")
  45. recipient_ids = fields.Many2many("res.partner", string="Recipients")
  46. contract_duration = fields.Boolean("Contract Duration")
  47. erase_type = fields.Selection(
  48. [("legal", "Legal"), ("internal", "Internal")], string="Erase Type"
  49. )
  50. hr_department_ids = fields.Many2many("hr.department", string="Hr Department")
  51. legal_erase = fields.Integer("Legal Erase (month)")
  52. keep_for_life = fields.Integer("Keep for life")
  53. legal_erase_year = fields.Float("Nb Year")
  54. medium_ids = fields.One2many(
  55. "privacy.storage_medium", "privacy_activity_id", string="Support and storage"
  56. )
  57. person_right = fields.Html("Right to the person")
  58. priority = fields.Selection(
  59. [
  60. ("0", "Low"),
  61. ("1", "Normal"),
  62. ("2", "High"),
  63. ("3", "Very High"),
  64. ],
  65. string="priority",
  66. )
  67. ref = fields.Char("Reference")
  68. risk_value = fields.Selection(
  69. [
  70. ("yes", "Yes"),
  71. ("no", "No"),
  72. ("recommended", "Recommended"),
  73. ("not_retained", "Not Retained"),
  74. ],
  75. string="Risk Value",
  76. )
  77. class PrivacyObjective(models.Model):
  78. _name = "privacy.objective"
  79. _description = "Objective database"
  80. name = fields.Char("Name", index=True, required=True, translate=True)
  81. description = fields.Html("Description")
  82. active = fields.Boolean(
  83. default=True,
  84. index=True,
  85. )
  86. class StorageMedium(models.Model):
  87. _name = "privacy.storage_medium"
  88. _description = "Storage Medium"
  89. name = fields.Char("Name", index=True, required=True, translate=True)
  90. computing_system_id = fields.Many2one(
  91. "privacy.computing_system", string="Computing System"
  92. )
  93. privacy_activity_id = fields.Many2one("privacy.activity", string="Privacy Activity")