Newer
Older
# 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"
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# ------------------------------------------------------
# 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
# ------------------------------------------------------