Ajout d'un champ charge_reel dans palier
[OpenERP/cmmi.git] / mo.py
diff --git a/mo.py b/mo.py
index 1726e40..76799ad 100644 (file)
--- a/mo.py
+++ b/mo.py
@@ -11,11 +11,14 @@ MOA = Maîtrise d'ouvrage (ceux qui demandent et contrôlent)
 from openerp.osv import osv, fields
 
 
+# ================================= ROLE MO ================================= #
 class RoleMO(osv.Model):
     """Role MO: différents types de MOE et MOA"""
 
     _name = "cmmi.mo.role"
 
+    _description = "Rattachement des MOs et des roles."
+
     _statuts = [("actif", "Actif"), ("inactif", "Inactif")]
 
     _types_mo = [("MOE", "MOE"), ("MOA", "MOA")]
@@ -28,18 +31,18 @@ class RoleMO(osv.Model):
         "type_mo": fields.selection(_types_mo,
                                     string="Type de MO",
                                     required=True),
-        "structures": fields.one2many("cmmi.mo.structure",
-                                      "role_mo_id",
-                                      string="MOs"),
-        "mo_ids": fields.one2many("cmmi.mo",
+        "mo_ids": fields.one2many("cmmi.mo", #TODO: à vérifier si pas de bugs
                                   "role_mo_id",
                                   string="MOs"),
     }
 
 
+# ==================================== MO =================================== #
 class Mo(osv.Model):
     _name = "cmmi.mo"
 
+    _description = "Table de reference des MOs."
+
     _rangs = [("primaire", "Primaire"),
               ("secondaire", "Secondaire"),
               ("generique", "Générique")]
@@ -58,11 +61,19 @@ class Mo(osv.Model):
         "rang": "primaire"}
 
 
+
+# =================================== MOE =================================== #
 class Moe(osv.Model):
     _name = "cmmi.mo.moe"
+
+    _description = "Table de referencement des MOEs."
+
     _inherit = "cmmi.mo"
 
     _columns = {
+        "role_mo_id": fields.many2one("cmmi.mo.role",
+                                      string="Role",
+                                      domain=[("type_mo", "=", "MOE")]),
         "projets": fields.one2many("cmmi.projet",
                                    "moe_id",
                                    string="Projets"),
@@ -70,32 +81,19 @@ class Moe(osv.Model):
 
 
 
+# =================================== MOA =================================== #
 class Moa(osv.Model):
     _name = "cmmi.mo.moa"
+
+    _description = "Table de referencement des MOAs."
+
     _inherit = "cmmi.mo"
 
     _columns = {
+        "role_mo_id": fields.many2one("cmmi.mo.role",
+                                      string="Role",
+                                      domain=[("type_mo", "=", "MOA")]),
         "projets": fields.one2many("cmmi.projet",
                                    "moa_id",
                                    string="Projets"),
     }
-
-
-class Structure(osv.Model):
-
-    _name = "cmmi.mo.structure"
-
-    _statuts = [("actif", "Actif"), ("inactif", "Inactif")]
-
-    _columns = {
-        "name": fields.char(string="Title", size=64, required=True),
-        "code": fields.char(string="Code", size=8, required=True),
-        "description": fields.text(string="Description"),
-        "parent_id": fields.many2one("cmmi.mo.structure", string="Parent_id"),
-        "statut": fields.selection(_statuts, string="Statut"),
-        "role_mo_id": fields.many2one("cmmi.mo.role", string="Role MO"),
-        "projets": fields.many2many("cmmi.projet",
-                                    "projet_projet_structure_rel",
-                                    "structures",
-                                    string="Projets"),
-    }