Séparation MO
authorSébastien CHAZALLET <s.chazallet@gmail.com>
Fri, 3 May 2013 07:05:10 +0000 (09:05 +0200)
committerSébastien CHAZALLET <s.chazallet@gmail.com>
Fri, 3 May 2013 07:05:10 +0000 (09:05 +0200)
__init__.py
mo.py [new file with mode: 0644]
projet.py

index ba79513..41faac9 100644 (file)
@@ -1 +1,2 @@
-import projet
\ No newline at end of file
+import mo
+import projet
diff --git a/mo.py b/mo.py
new file mode 100644 (file)
index 0000000..1873041
--- /dev/null
+++ b/mo.py
@@ -0,0 +1,78 @@
+#-*- coding: utf8 -*-
+'''
+Ce module contient tout ce qui est nécessaire pour qualifier une MO
+
+On distingue deux grands rôles qui sont les MOE et les MOA :
+
+MOE = Maîtrise d'oeuvre (ceuf qui font)
+MOA = Maîtrise d'ouvrage (ceux qui demandent et contrôlent)
+'''
+
+from openerp.osv import osv, fields
+
+
+class Role_MO(osv.Model):
+    """Role MO: différents types de MOE et MOA"""
+
+    _name = "projet.role_mo"
+
+    _statuts = [("actif", "Actif"), ("inactif", "Inactif")]
+
+    _types_mo = [("MOE", "MOE"), ("MOA", "MOA")]
+
+    _columns = {
+        "name": fields.char(string="Title", size=64, required=True),
+        "code": fields.char(string="Code", size=8, required=True),
+        "description": fields.text(string="Description"),
+        "statut": fields.selection(_statuts, string="Statut"),
+        "type_mo": fields.selection(_types_mo, string="Type de MO", required=True),
+        "structures": fields.one2many("projet.structure",
+                                   "role_mo_id",
+                                   string="MOs"),
+        "mo_ids": fields.one2many("projet.mo",
+                                   "role_mo_id",
+                                   string="MOs"),
+    }
+
+
+class mo(osv.Model):
+    _name = "projet.mo"
+
+    _choses = [("primaire", "Primaire"),
+               ("secondaire", "Secondaire"),
+               ("generique", "Générique")]
+
+    _columns = {
+        "name": fields.char(string="Title"),
+        "description": fields.text(string="Description"),
+        "chose": fields.selection(_choses, string="Chose", required=True),
+        "role_mo_id": fields.many2one("projet.role_mo", string="Role"),
+        "charges": fields.one2many("projet.charge",
+                                   "mo_id",
+                                   string="Charges"),
+    }
+
+    _defaults = {
+        "chose": "generique"}
+
+
+class moe(osv.Model):
+    _name = "projet.moe"
+    _inherit = "projet.mo"
+
+    _columns = {
+        "projets": fields.one2many("projet.projet",
+                                     "moe_id",
+                                     string="Projets"),
+    }
+
+
+class moa(osv.Model):
+    _name= "projet.moa"
+    _inherit = "projet.mo"
+
+    _columns = {
+        "projets": fields.one2many("projet.projet",
+                                     "moa_id",
+                                     string="Projets"),
+    }
index da2cdb4..0a00efb 100644 (file)
--- a/projet.py
+++ b/projet.py
@@ -3,7 +3,6 @@
 '''
 
 from openerp.osv import osv, fields
-from gtk import TRUE
 
 class Projet(osv.Model):
 
@@ -114,27 +113,6 @@ class Structure(osv.Model):
     }
 
 
-class Role_MO(osv.Model):
-    _name = "projet.role_mo"
-
-    _statuts = [("actif", "Actif"), ("inactif", "Inactif")]
-
-    _types_mo = [("MOE", "MOE"), ("MOA", "MOA")]
-
-    _columns = {
-        "name": fields.char(string="Title", size=64, required=True),
-        "code": fields.char(string="Code", size=8, required=True),
-        "description": fields.text(string="Description"),
-        "statut": fields.selection(_statuts, string="Statut"),
-        "type_mo": fields.selection(_types_mo, string="Type de MO", required=True),
-        "structures": fields.one2many("projet.structure",
-                                   "role_mo_id",
-                                   string="MOs"),
-        "mo_ids": fields.one2many("projet.mo",
-                                   "role_mo_id",
-                                   string="MOs"),
-    }
-
 class Module(osv.Model):
     _name = "projet.module"
 
@@ -224,9 +202,8 @@ class Phase(osv.Model):
                                      string="Palier"),
     }
 
-#TODO trouver un nom a cette chose
-class qqch(osv.Model):
-    _name = "projet.qqch"
+class mesurable(osv.Model):
+    _name = "projet.mesurable"
 
     _statuts = [("cree", "Crée"), ("encours", "En cours"),
                 ("termine", "Terminé"), ("abandonne", "Abandonné"),
@@ -269,7 +246,7 @@ class qqch(osv.Model):
 class Chantier(osv.Model):
     _name = "projet.chantier"
 
-    _inherit = "projet.qqch"
+    _inherit = "projet.mesurable"
 
     _columns = {
         "projet_id": fields.many2one("projet.projet",
@@ -287,7 +264,7 @@ class Palier(osv.Model):
     _types_palier = [("normal", "Normal"), ("exceptionnel", "Exceptionnel"),
                      ("correctif", "Correctif"), ("autre", "Autre")]
 
-    _inherit = "projet.qqch"
+    _inherit = "projet.mesurable"
 
     _columns = {
         "type_palier": fields.selection(_types_palier, string="Type"),
@@ -321,45 +298,3 @@ class Charge(osv.Model):
         "mo_id": fields.many2one("projet.mo",
                                  string="Mo"),
     }
-
-class mo(osv.Model):
-    _name = "projet.mo"
-
-    _choses = [("primaire", "Primaire"),
-               ("secondaire", "Secondaire"),
-               ("generique", "Générique")]
-
-    _columns = {
-        "name": fields.char(string="Title"),
-        "description": fields.text(string="Description"),
-        "chose": fields.selection(_choses, string="Chose", required=True),
-        "role_mo_id": fields.many2one("projet.role_mo", string="Role"),
-        "charges": fields.one2many("projet.charge",
-                                   "mo_id",
-                                   string="Charges"),
-    }
-
-    _defaults = {
-        "chose": "generique"}
-
-
-class moe(osv.Model):
-    _name = "projet.moe"
-    _inherit = "projet.mo"
-
-    _columns = {
-        "projets": fields.one2many("projet.projet",
-                                     "moe_id",
-                                     string="Projets"),
-    }
-
-
-class moa(osv.Model):
-    _name= "projet.moa"
-    _inherit = "projet.mo"
-
-    _columns = {
-        "projets": fields.one2many("projet.projet",
-                                     "moa_id",
-                                     string="Projets"),
-    }