From e5b9ee5cf977ede8356df77b7af7793d7cdcb57f Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 23 Nov 2008 12:27:27 +0100 Subject: [PATCH] improve bzr revid: fp@tinyerp.com-20081123112727-yd1xxf6qe34xgw0i --- bin/osv/osv.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/osv/osv.py b/bin/osv/osv.py index e1f52838224..58a98da347b 100644 --- a/bin/osv/osv.py +++ b/bin/osv/osv.py @@ -229,7 +229,18 @@ class osv(orm.orm): if hasattr(new, 'update'): new.update(cls.__dict__.get(s, {})) else: - new.extend(cls.__dict__.get(s, [])) + if s=='_constraints': + for c in cls.__dict__.get(s, []): + exist = False + for c2 in range(len(new)): + if new[c2][2]==c[2]: + new[c2] = c + exist = True + break + if not exist: + new.append(c) + else: + new.extend(cls.__dict__.get(s, [])) nattr[s] = new name = hasattr(cls, '_name') and cls._name or cls._inherit cls = type(name, (cls, parent_class), nattr)