Ajout d'un champ fonction charge réel à palier_phase
authorAlicia FLOREZ <alicflorez@gmail.com>
Thu, 13 Jun 2013 15:47:33 +0000 (17:47 +0200)
committerAlicia FLOREZ <alicflorez@gmail.com>
Thu, 13 Jun 2013 15:47:33 +0000 (17:47 +0200)
axes.py

diff --git a/axes.py b/axes.py
index 23437c1..aa2e4ac 100644 (file)
--- a/axes.py
+++ b/axes.py
@@ -371,6 +371,12 @@ class PalierPhase(osv.Model):
             result[pp.id] = sum([p.charge_plan for p in pp.phases])
         return result
 
+    def _get_charge_reel(self, cr, uid, ids, field, arg, context=None):
+        result = {}
+        for pp in self.browse(cr, uid, ids, context=context):
+            result[pp.id] = sum([c.quantite for c in pp.charges])
+        return result
+
 
     _columns = {
         "name": fields.function(_get_name,
@@ -387,6 +393,9 @@ class PalierPhase(osv.Model):
         "charge_plan": fields.function(_get_charge_plan,
                                        type="integer",
                                        string="Charge plannifiée"),
+        "charge_reel": fields.function(_get_charge_reel,
+                                       type="integer",
+                                       string="Charge plannifiée"),
         # backrefs
         "charges": fields.one2many("cmmi.evolution.charge",
                                    "phase_id",