# Copyright 2022 Le Filament (https://le-filament.com) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) from odoo import fields, models class PartnerModuleVersion(models.Model): _name = "res.partner.module.version" _description = "Modules par client" _rec_name = "partner_id" # ------------------------------------------------------ # Fields declaration # ------------------------------------------------------ partner_id = fields.Many2one( comodel_name="res.partner", string="Client", domain=[("is_company", "=", True)], required=True, ) module_id = fields.Many2one( comodel_name="res.partner.module", string="Module Odoo", required=True, ) latest_version = fields.Char("Version installée") # ------------------------------------------------------ # SQL Constraints # ------------------------------------------------------ _sql_constraints = [ ( "uniq_module_partner", "unique(partner_id, module_id)", "Ce module existe déjà pour ce client", ), ] # ------------------------------------------------------ # Default methods # ------------------------------------------------------ # ------------------------------------------------------ # Computed fields / Search Fields # ------------------------------------------------------ # ------------------------------------------------------ # Onchange / Constraints # ------------------------------------------------------ # ------------------------------------------------------ # CRUD methods (ORM overrides) # ------------------------------------------------------ # ------------------------------------------------------ # Actions # ------------------------------------------------------ # ------------------------------------------------------ # Business methods # ------------------------------------------------------