Skip to content

Commit

Permalink
fix(dn): regression from bulk transaction fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao authored and s-aga-r committed Nov 16, 2023
1 parent e769e75 commit 426c245
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions erpnext/selling/doctype/sales_order/sales_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,11 @@ def set_missing_values(source, target):
if target.company_address:
target.update(get_fetch_values("Delivery Note", "company_address", target.company_address))

# set target items names to ensure proper linking with packed_items
target.set_new_name()
# if invoked in bulk creation, validations are ignored and thus this method is nerver invoked
if frappe.flags.bulk_transaction:
# set target items names to ensure proper linking with packed_items
target.set_new_name()

make_packing_list(target)

def condition(doc):
Expand Down
2 changes: 2 additions & 0 deletions erpnext/utilities/bulk_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def task(doc_name, from_doctype, to_doctype):
},
"Purchase Receipt": {"Purchase Invoice": purchase_receipt.make_purchase_invoice},
}
frappe.flags.bulk_transaction = True
if to_doctype in ["Payment Entry"]:
obj = mapper[from_doctype][to_doctype](from_doctype, doc_name)
else:
Expand All @@ -106,6 +107,7 @@ def task(doc_name, from_doctype, to_doctype):
obj.flags.ignore_validate = True
obj.set_title_field()
obj.insert(ignore_mandatory=True)
del frappe.flags.bulk_transaction


def check_logger_doc_exists(log_date):
Expand Down

0 comments on commit 426c245

Please sign in to comment.