Ajout d'un champ charge_reel dans chantier
authorAlicia FLOREZ <alicflorez@gmail.com>
Fri, 14 Jun 2013 09:46:08 +0000 (11:46 +0200)
committerAlicia FLOREZ <alicflorez@gmail.com>
Fri, 14 Jun 2013 09:46:08 +0000 (11:46 +0200)
axes.py

diff --git a/axes.py b/axes.py
index aa2e4ac..e7e46ca 100644 (file)
--- a/axes.py
+++ b/axes.py
@@ -441,6 +441,12 @@ class Chantier(osv.Model):
             result[chantier.id] = sum([e.charge_plan for e in chantier.evolutions])
         return result
 
+    def _get_charge_reel(self, cr, uid, ids, field, arg, context=None):
+        result = {}
+        for c in self.browse(cr, uid, ids, context=context):
+            result[c.id] = sum([e.charge_reel for e in c.evolutions])
+        return result
+
 
     _columns = {
         "projet_id": fields.many2one("cmmi.projet",
@@ -460,4 +466,7 @@ class Chantier(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 réelle"),
     }