)]
+ def _chantier_selection(self, cr, uid, context=None):
+ chantier_model = self.pool.get("cmmi.axes.palier")
+
+ if context is None or not context.has_key("project_id"):
+ return
+
+ chantier_ids = chantier_model.search(
+ cr,
+ uid,
+ [('projet_id', '=', context["projet_id"])],
+ context=context
+ )
+
+ print [(c["id"], c["name"]) for c in chantier_model.read(
+ cr,
+ uid,
+ chantier_ids,
+ fields=["id", "name"],
+ context=context
+ )]
+ return [(c["id"], c["name"]) for c in chantier_model.read(
+ cr,
+ uid,
+ chantier_ids,
+ fields=["id", "name"],
+ context=context
+ )]
+
+
_columns = {
"projet_id": fields.many2one("cmmi.projet",
"palier_id": fields.selection(_palier_selection,
string="Palier",
required=True),
- "chantier_id": fields.many2one("cmmi.axes.chantier",
+ "chantier_id": fields.selection(_chantier_selection,
string="Chantier",
required=True),
}