Correction apporté sur un many2many
[OpenERP/cmmi.git] / projet.py
index 96e0502..91c6e8b 100644 (file)
--- a/projet.py
+++ b/projet.py
@@ -69,9 +69,16 @@ class Projet(osv.Model):
     _columns = {
         "name": fields.char(string="Title", size=64, required=True),
         "description": fields.text(string="Description"),
+        # Backrefs
         "domains": fields.one2many("cmmi.projet.domaine",
                                     "project_id",
                                     string="Domaines"),
+        "moe_ids": fields.one2many("cmmi.projet.moe",
+                                   "project_id",
+                                   string="MOEs"),
+        "moa_ids": fields.one2many("cmmi.projet.moa",
+                                   "project_id",
+                                   string="MOAs"),
         "team_members": fields.one2many("cmmi.projet.teammember",
                                          "projet_id",
                                          string="Team Members"),
@@ -90,12 +97,9 @@ class Projet(osv.Model):
         "evolutions": fields.one2many("cmmi.evolution",
                                       "projet_id",
                                       string="Evolutions"),
-        "moe_ids": fields.one2many("cmmi.projet.moe",
-                                   "project_id",
-                                   string="MOEs"),
-        "moa_ids": fields.one2many("cmmi.projet.moa",
-                                   "project_id",
-                                   string="MOAs"),
+        # TODO: faire un champs fonction qui renvoie uniquement les domaines sélectionnés
+        
+        # Champs fonction rapatriant les mo ou domaine principaux
         "moe_id": fields.function(_get_main_moe,
                                   type="string",
                                   string="MOE principale"),
@@ -112,7 +116,7 @@ class Projet(osv.Model):
         project_id = osv.Model.create(self, cr, uid, vals, context=context)
 
         # Récupération des ids de toutes les phases
-        phase_model = self.pool.get("cmmi.phase.type")
+        phase_model = self.pool.get("cmmi.phase")
         phases_ids = phase_model.search(cr, uid, [])
 
         # Création des relations
@@ -310,7 +314,7 @@ class ProjetMoa(osv.Model):
 class ProjetPhase(osv.Model):
     _name = "cmmi.projet.phase"
 
-    _description = "Linking of phases to projects / Rattachement des Phases aux projets"
+    _description = "Rattachement des Phases aux projets"
 
     def _get_name(self, cr, uid, ids, field_name=None, arg=None, context=None):
         if isinstance(ids, (int, long)):
@@ -366,4 +370,4 @@ class ProjetTeammember(osv.Model):
         "partner_id": fields.many2one("res.partner",
                                     string="Team Member",
                                     required=True),
-    }
\ No newline at end of file
+    }