Merge pull request #27515 from Ninad1306/map_docs_fix

fix: Update Child table from the Last Source Doc
This commit is contained in:
Akhil Narang 2024-08-27 13:29:20 +05:30 committed by GitHub
commit dcd14d07dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -129,6 +129,12 @@ def get_mapped_doc(
table_map = {"doctype": target_child_doctype}
if table_map:
target_child_doctype = table_map["doctype"]
target_parentfield = target_doc.get_parentfield_of_doctype(target_child_doctype)
if table_map.get("reset_value"):
setattr(target_doc, target_parentfield, [])
for source_d in source_doc.get(df.fieldname):
if "condition" in table_map:
if not table_map["condition"](source_d):
@ -143,9 +149,6 @@ def get_mapped_doc(
):
continue
target_child_doctype = table_map["doctype"]
target_parentfield = target_doc.get_parentfield_of_doctype(target_child_doctype)
# does row exist for a parentfield?
if target_parentfield not in row_exists_for_parentfield:
row_exists_for_parentfield[target_parentfield] = (