From: Alicia FLOREZ Date: Fri, 14 Jun 2013 09:47:07 +0000 (+0200) Subject: Ajout d'un champ charge_reel dans palier X-Git-Url: http://git.inspyration.org/?p=OpenERP%2Fcmmi.git;a=commitdiff_plain Ajout d'un champ charge_reel dans palier --- diff --git a/axes.py b/axes.py index e7e46ca..aa5a83f 100644 --- a/axes.py +++ b/axes.py @@ -292,6 +292,13 @@ class Palier(osv.Model): return result + def _get_charge_reel(self, cr, uid, ids, field, arg, context=None): + result = {} + for p in self.browse(cr, uid, ids, context=context): + result[p.id] = sum([e.charge_reel for e in p.evolutions]) + return result + + _columns = { "type_palier": fields.selection(_types_palier, string="Type"), "projet_id": fields.many2one("cmmi.projet", @@ -309,6 +316,9 @@ class Palier(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"), } _defaults = { @@ -441,6 +451,7 @@ 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):