Rajout d'une méthode permettant d'abandonner un mesurable
authorAlicia FLOREZ <alicflorez@gmail.com>
Tue, 4 Jun 2013 09:03:26 +0000 (11:03 +0200)
committerAlicia FLOREZ <alicflorez@gmail.com>
Tue, 4 Jun 2013 09:03:26 +0000 (11:03 +0200)
axes.py

diff --git a/axes.py b/axes.py
index 5ef14ed..df046d6 100644 (file)
--- a/axes.py
+++ b/axes.py
@@ -126,6 +126,26 @@ class Mesurable(osv.Model):
         )
         return self
 
+    def abandonner(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 not ('encours', 'cree').__contains__(mesurable['state']):
+            return
+        self.write(
+            cr,
+            uid,
+            ids,
+            {'state': 'abandonne'},
+            context,
+        )
+        return self
+
+
+
 
 
 #------------ TRAVAIL CALCUL JOURS OUVRES ------------