fix(dn): regression from bulk transaction fix
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index e4f1a28..a97198a 100755
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -767,8 +767,11 @@
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):
diff --git a/erpnext/utilities/bulk_transaction.py b/erpnext/utilities/bulk_transaction.py
index fcee265..56f3b41 100644
--- a/erpnext/utilities/bulk_transaction.py
+++ b/erpnext/utilities/bulk_transaction.py
@@ -98,6 +98,7 @@
},
"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:
@@ -106,6 +107,7 @@
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):