fix: Test

- Preserve order of supplier list while removing duplicates
- Dont use list of set, but list of dict with unique keys
This commit is contained in:
marination 2021-03-31 12:27:57 +05:30
parent 8451da7924
commit 120da991d0

View File

@ -821,10 +821,10 @@ def make_purchase_order_for_default_supplier(source_name, selected_items=None, t
target.stock_qty = (flt(source.stock_qty) - flt(source.ordered_qty))
target.project = source_parent.project
suppliers = [item.get('supplier') for item in selected_items if item.get('supplier') and item.get('supplier')]
suppliers = list(set(suppliers))
suppliers = [item.get('supplier') for item in selected_items if item.get('supplier')]
suppliers = list(dict.fromkeys(suppliers)) # remove duplicates while preserving order
items_to_map = [item.get('item_code') for item in selected_items if item.get('item_code') and item.get('item_code')]
items_to_map = [item.get('item_code') for item in selected_items if item.get('item_code')]
items_to_map = list(set(items_to_map))
if not suppliers: