Skip to content

Commit

Permalink
Revert "fix: new standard field insert order."
Browse files Browse the repository at this point in the history
This reverts commit 6cdbe42.
  • Loading branch information
dj12djdjs committed Feb 7, 2023
1 parent 8c9967a commit c830f1b
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions frappe/model/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,18 +462,10 @@ def sort_fields_based_on_field_order(self):
self.field_order.remove(field)

# Add fields present in self.fields
for idx, field in enumerate(self.fields):
for field in self.fields:
if field.fieldname not in self.field_order:
# Insert after logic handles rearranging of custom fields
# If field.fieldname doesn't exist in field_order attempt to
# lookup it's previous field order fieldname, then insert
# after that fieldname. If the fieldname doesn't exist.
# Insert at end of list.
try:
position = self.field_order.index(self.fields[idx - 1].fieldname) + 1
self.field_order.insert(position, field.fieldname)
except (ValueError, IndexError):
self.field_order.append(field.fieldname)
# Insert after logic handles rearranding of custom fields
self.field_order.append(field.fieldname)

for idx, fieldname in enumerate(self.field_order, 1):
field = self._fields[fieldname]
Expand Down

0 comments on commit c830f1b

Please sign in to comment.