8716880a512fed88380e660239c8ecd925177214
[OpenERP/cmmi.git] / wizards / palierPhase.py
1 #-*- coding: utf8 -*-
2
3 from openerp.osv import osv, fields
4
5 # TODO: finir PalierPhaseWizard
6 class PalierPhaseWizard(osv.TransientModel):
7
8     _name = "cmmi.palier.phase.wizard"
9
10
11     def default_get(self, cr, uid, fields, context=None):
12         result = osv.TransientModel.default_get(self, cr, uid, fields, context=context)
13         palier_id = context.get('palier_id', False)
14         if palier_id:
15             result['palier_id'] = palier_id
16         return result
17
18
19
20     def _phases_selection(self, cr, uid, context=None):
21         phase_model = self.pool.get("cmmi.phase")
22         palier_phase_model = self.pool.get("cmmi.axes.palier.phase")
23
24         if context is None or not context.has_key("palier_id"):
25             return []
26
27
28
29     _columns = {
30         "palier_id": fields.many2one("cmmi.axes.palier",
31                                      string="Palier",
32                                      required=True),
33 #        "phase_id": fields.selection("cmmi.projet.phase",
34 #                                     string="Phase",
35 #                                     required=True,
36 #                                     domain=[("selectionne", "=", True)]),
37         "phase_id": fields.function(_phases_selection,
38                                     string="Phase",
39                                     required=True),
40     }