From 11e3ba8cc0b4b03b8751168fe91693a94de591ac Mon Sep 17 00:00:00 2001 From: Alicia FLOREZ Date: Tue, 4 Jun 2013 10:49:14 +0200 Subject: [PATCH] =?utf8?q?Rajout=20d'une=20m=C3=A9thode=20permettant=20de=20?= =?utf8?q?terminer=20un=20mesurable?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- axes.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/axes.py b/axes.py index a48e86a..5ef14ed 100644 --- a/axes.py +++ b/axes.py @@ -106,6 +106,25 @@ class Mesurable(osv.Model): {'state': 'suspendu'}, context, ) + return self + + def terminer(self, cr, uid, ids, context=None): + if type(ids) == list: + if len(ids) != 1: + return # TODO: message d'avertissement + ids = ids[0] + + mesurable = self.read(cr, uid, ids, ['state'], context, context) + if mesurable['state'] != 'encours': + return + self.write( + cr, + uid, + ids, + {'state': 'termine'}, + context, + ) + return self -- 1.7.10.4