# Copyright 2019 Myceliandre - Nicolas JEUDY # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import api, fields, models class PersonalDataCategory(models.Model): _name = "privacy.subject.category" _description = "Subjects category" name = fields.Char("Name", index=True, required=True, translate=True) class PersonalDataLegal(models.Model): _name = "privacy.legal" _description = "Legal" name = fields.Char("Name", index=True, required=True, translate=True) class ComputingSystem(models.Model): _name = "privacy.computing_system" _description = "Computing System" name = fields.Char("Name", index=True, required=True, translate=True) class PrivacyActivity(models.Model): _inherit = "privacy.activity" def _default_company(self): return self.env["res.company"]._company_default_get("privacy.activity") @api.multi def _compute_has_sensitive(self): for record in self: record.has_sensitive = "sensitive" in record.personal_data_ids.mapped( "type" ) value = fields.Boolean(compute="_get_value") personal_data_ids = fields.Many2many("privacy.personal.data") subjects_categ_ids = fields.Many2many("privacy.subject.category") has_sensitive = fields.Boolean(compute="_compute_has_sensitive") legal_ids = fields.Many2many("privacy.legal") controller_ids = fields.Many2many( "res.partner", "privacy_activity_res_partner_controler_ids", string="Controllers", ) define_objective = fields.Boolean( "Define objective", help="Add detailed objectif from a custom list.", ) objective_ids = fields.Many2many("privacy.objective", string="Details") company_id = fields.Many2one( "res.company", "Company", index=True, default=_default_company ) define_medium = fields.Boolean("Define Medium") recipient_ids = fields.Many2many("res.partner", string="Recipients") contract_duration = fields.Boolean("Contract Duration") erase_type = fields.Selection( [("legal", "Legal"), ("internal", "Internal")], string="Erase Type" ) hr_department_ids = fields.Many2many("hr.department", string="Hr Department") legal_erase = fields.Integer("Legal Erase (month)") keep_for_life = fields.Integer("Keep for life") legal_erase_year = fields.Float("Nb Year") medium_ids = fields.One2many( "privacy.storage_medium", "privacy_activity_id", string="Support and storage" ) person_right = fields.Html("Right to the person") priority = fields.Selection( [ ("0", "Low"), ("1", "Normal"), ("2", "High"), ("3", "Very High"), ], string="priority", ) ref = fields.Char("Reference") risk_value = fields.Selection( [ ("yes", "Yes"), ("no", "No"), ("recommended", "Recommended"), ("not_retained", "Not Retained"), ], string="Risk Value", ) class PrivacyObjective(models.Model): _name = "privacy.objective" _description = "Objective database" name = fields.Char("Name", index=True, required=True, translate=True) description = fields.Html("Description") active = fields.Boolean( default=True, index=True, ) class StorageMedium(models.Model): _name = "privacy.storage_medium" _description = "Storage Medium" name = fields.Char("Name", index=True, required=True, translate=True) computing_system_id = fields.Many2one( "privacy.computing_system", string="Computing System" ) privacy_activity_id = fields.Many2one("privacy.activity", string="Privacy Activity")