Reviewers: ,

Description:
trytond: Fix Pool.setup to re-allow extra_depends behavior

Please review this at http://codereview.tryton.org/898002/

Affected files:
  M trytond/pool.py


Index: trytond/pool.py
===================================================================
--- a/trytond/pool.py
+++ b/trytond/pool.py
@@ -62,6 +62,7 @@
         for cls in classes:
             mpool = Pool.classes[type_].setdefault(module, [])
             assert cls not in mpool, cls
+            assert issubclass(cls.__class__, PoolMeta)
             mpool.append(cls)

     @classmethod
@@ -194,6 +195,9 @@
Setup classes for module and return a list of classes for each type in
         a dictionary.
         '''
+        from trytond.model import Model
+        from trytond.wizard import Wizard
+        from trytond.report import Report
         classes = {}
         for type_ in self.classes.keys():
             classes[type_] = []
@@ -203,11 +207,9 @@
                     cls = type(cls.__name__, (cls, previous_cls), {})
                 except KeyError:
                     pass
-                if (not hasattr(cls, '__setup__')
-                        and issubclass(cls.__class__, PoolMeta)):
+                if not issubclass(cls, (Model, Wizard, Report)):
                     continue
-                else:
-                    cls.__setup__()
+                cls.__setup__()
                 self.add(cls, type=type_)
                 classes[type_].append(cls)
             for cls in classes[type_]:


Reply via email to