From 5dd2b286bbd133327414abd3eec53d26a83a2b68 Mon Sep 17 00:00:00 2001 From: Bertrand Chenal Date: Mon, 2 Jun 2008 22:54:55 +0200 Subject: [PATCH] Added constrain to avoid recusive work type. --- work_type.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/work_type.py b/work_type.py index d372ddc6a0..e6810935e4 100644 --- a/work_type.py +++ b/work_type.py @@ -20,6 +20,13 @@ class WorkType(OSV): ('normal', 'Normal'), ], 'Type', required=True, select=1) + def __init__(self): + super(WorkType, self).__init__() + self._constraints += [ + ('check_recursion', + 'Error! You can not create recursive work types.', ['parent']) + ] + def default_active(self, cursor, user, context=None): return True