5 from openerp.osv import osv, fields
7 class EvolutionWizard(osv.TransientModel):
9 _name = "cmmi.evolution.wizard"
11 def default_get(self, cr, uid, fields, context=None):
12 res = osv.TransientModel.default_get(self, cr, uid, fields, context=context)
13 project_id = context.get('project_id', False)
15 res['project_id'] = project_id
19 def _palier_selection(self, cr, uid, context=None):
20 palier_model = self.pool.get("cmmi.axes.palier")
22 if context is None or not context.has_key("project_id"):
25 palier_ids = palier_model.search(
28 [('projet_id', '=', context["projet_id"])],
32 print [(p["id"], p["name"]) for p in palier_model.read(
36 fields=["id", "name"],
39 return [(p["id"], p["name"]) for p in palier_model.read(
43 fields=["id", "name"],
48 def _chantier_selection(self, cr, uid, context=None):
49 chantier_model = self.pool.get("cmmi.axes.palier")
51 if context is None or not context.has_key("project_id"):
54 chantier_ids = chantier_model.search(
57 [('projet_id', '=', context["projet_id"])],
61 print [(c["id"], c["name"]) for c in chantier_model.read(
65 fields=["id", "name"],
68 return [(c["id"], c["name"]) for c in chantier_model.read(
72 fields=["id", "name"],
79 "projet_id": fields.many2one("cmmi.projet",
82 "palier_id": fields.selection(_palier_selection,
85 "chantier_id": fields.selection(_chantier_selection,