mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 10:11:20 +00:00
fix: remove empty dn from bulk creation if date filter renders them empty
This commit is contained in:
@@ -1010,6 +1010,11 @@ def make_delivery_note(source_name, target_doc=None, kwargs=None):
|
|||||||
for idx, item in enumerate(target_doc.items):
|
for idx, item in enumerate(target_doc.items):
|
||||||
item.idx = idx + 1
|
item.idx = idx + 1
|
||||||
|
|
||||||
|
if not kwargs.skip_item_mapping and frappe.flags.bulk_transaction and not target_doc.items:
|
||||||
|
# the (date) condition filter resulted in an unintendedly created empty DN; remove it
|
||||||
|
del target_doc
|
||||||
|
return
|
||||||
|
|
||||||
# Should be called after mapping items.
|
# Should be called after mapping items.
|
||||||
set_missing_values(so, target_doc)
|
set_missing_values(so, target_doc)
|
||||||
|
|
||||||
|
|||||||
@@ -156,9 +156,12 @@ def task(doc_name, from_doctype, to_doctype):
|
|||||||
else:
|
else:
|
||||||
obj = mapper[from_doctype][to_doctype](doc_name)
|
obj = mapper[from_doctype][to_doctype](doc_name)
|
||||||
|
|
||||||
obj.flags.ignore_validate = True
|
if obj:
|
||||||
obj.set_title_field()
|
obj.flags.ignore_validate = True
|
||||||
obj.insert(ignore_mandatory=True)
|
obj.set_title_field()
|
||||||
|
obj.insert(ignore_mandatory=True)
|
||||||
|
|
||||||
|
del obj
|
||||||
del frappe.flags.bulk_transaction
|
del frappe.flags.bulk_transaction
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user