Skip to content

Commit

Permalink
fix: Child row docs must have blank parent values
Browse files Browse the repository at this point in the history
  • Loading branch information
netchampfaris committed Jul 14, 2020
1 parent 2ca691f commit f17b8a9
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions frappe/core/doctype/data_import/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,8 @@ def parse_next_row_for_import(self, data):

# if there are child doctypes, find the subsequent rows
if len(doctypes) > 1:
# subsequent rows either dont have any parent value set
# or have the same value as the parent row
# we include a row if either of conditions match
# subsequent rows that have blank values in parent columns
# are considered as child rows
parent_column_indexes = self.header.get_column_indexes(self.doctype)
parent_row_values = first_row.get_values(parent_column_indexes)

Expand All @@ -454,11 +453,8 @@ def parse_next_row_for_import(self, data):
if all([v in INVALID_VALUES for v in row_values]):
rows.append(row)
continue
# if the row has same values as parent row, it's a child row doc
if row_values == parent_row_values:
rows.append(row)
continue
# if any of those conditions dont match, it's the next doc
# if we encounter a row which has values in parent columns,
# then it is the next doc
break

parent_doc = None
Expand Down

0 comments on commit f17b8a9

Please sign in to comment.