From ddb6a943de17cd3d4f2d24d44a04f448ff020088 Mon Sep 17 00:00:00 2001 From: Mitesh Date: Mon, 18 Jun 2012 13:14:21 +0530 Subject: [PATCH] updating the idx of field within its parent doctype --- py/webnotes/model/doctype.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/py/webnotes/model/doctype.py b/py/webnotes/model/doctype.py index 72d21f40be..bb265f69d6 100644 --- a/py/webnotes/model/doctype.py +++ b/py/webnotes/model/doctype.py @@ -180,7 +180,7 @@ class _DocType: for doc_type in doc_type_list: docfields = self.get_sorted_docfields(doclist, doc_type) docfields = self.sort_docfields(doc_type, docfields, prev_field_dict) - if docfields: self.change_idx(doclist, docfields) + if docfields: self.change_idx(doclist, docfields, doc_type) def get_previous_field_properties(self, property_dict): """ @@ -252,9 +252,9 @@ class _DocType: return docfields - def change_idx(self, doclist, docfields): + def change_idx(self, doclist, docfields, doc_type): for d in doclist: - if d.fieldname and d.fieldname in docfields: + if d.fieldname and d.fieldname in docfields and d.parent == doc_type: d.idx = docfields.index(d.fieldname) + 1 def add_code(self, doc):