fix: prevent spurious defaults for items when making prec from dnote (#25559)

* fix: prevent spurious defaults for items when making prec from dnote

* refactor: make concise, use dict comp
This commit is contained in:
Alan 2021-05-07 11:40:02 +05:30 committed by GitHub
parent 4ecae62194
commit 0e0de6baa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1755,15 +1755,10 @@ def update_pr_items(doc, sales_item_map, purchase_item_map, parent_child_map, wa
item.purchase_order = parent_child_map.get(sales_item_map.get(item.delivery_note_item)) item.purchase_order = parent_child_map.get(sales_item_map.get(item.delivery_note_item))
def get_delivery_note_details(internal_reference): def get_delivery_note_details(internal_reference):
so_item_map = {}
si_item_details = frappe.get_all('Delivery Note Item', fields=['name', 'so_detail'], si_item_details = frappe.get_all('Delivery Note Item', fields=['name', 'so_detail'],
filters={'parent': internal_reference}) filters={'parent': internal_reference})
for d in si_item_details: return {d.name: d.so_detail for d in si_item_details if d.so_detail}
so_item_map.setdefault(d.name, d.so_detail)
return so_item_map
def get_sales_invoice_details(internal_reference): def get_sales_invoice_details(internal_reference):
dn_item_map = {} dn_item_map = {}