Reviewers: ,


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

Affected files:
  trytond/model/modelview.py


Index: trytond/model/modelview.py
===================================================================

--- a/trytond/model/modelview.py
+++ b/trytond/model/modelview.py
@@ -238,6 +238,26 @@
         result['arch'] = xarch
         result['fields'] = xfields

+        if result['field_childs']:
+            child_field = result['field_childs']
+            result['children_definitions'] = defs = {}
+            model = cls
+            requisite_fields = result['fields'].keys()
+            requisite_fields.remove(child_field)
+            while model and model.__name__ not in defs:
+                has_fields = all(hasattr(model, rfield)
+                    for rfield in requisite_fields)
+                if has_fields:
+ defs[model.__name__] = model.fields_get(requisite_fields
+                        + [child_field])
+                field = getattr(model, child_field, None)
+                if field:
+                    model = pool.get(field.model_name)
+                else:
+                    model = None
+        else:
+            result['children_definitions'] = {}
+
         cls._fields_view_get_cache.set(key, result)
         return result




--
--
[email protected] mailing list

--- You received this message because you are subscribed to the Google Groups "tryton-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to