Ajout à la classe cmmi.evolution.phase une méthode commencer
[OpenERP/cmmi.git] / evolution.py
index 4921278..8db0df3 100644 (file)
@@ -166,6 +166,8 @@ class Phase(osv.Model):
                                 store=True,
                                 string="Nom de la phase"),
         "description": fields.text(string="Description"),
+        "charge_init": fields.integer(string="Charge initiale"),
+        "charge_plan": fields.integer(string="Charge plannifiée"),
         "phase_id": fields.many2one("cmmi.axes.palier.phase",
                                     string="Phase"),
         "evolution_id": fields.many2one("cmmi.evolution",
@@ -196,6 +198,23 @@ class Phase(osv.Model):
 
         return osv.Model.create(self, cr, uid, vals, context=context)
 
+    def commencer(self, cr, uid, ids, context=None):
+        if type(ids) == list:
+            if len(ids) != 1:
+                return
+            ids = ids[0]
+
+        phase = self.read(cr, uid, ids, ['charge_plan'], context)
+
+        self.write(
+            cr,
+            uid,
+            ids, {
+                'charge_init' : phase['charge_plan'],
+            },
+            context)
+        return self
+
 
 # =========================== EVOLUTION CHARGE ============================== #
 class Charge(osv.Model):