From 075b299673122ad7f1bce3f18a09095a0657af90 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 11 Apr 2017 16:00:48 +0530 Subject: [PATCH] bom traversing: argument mutable issue --- erpnext/manufacturing/doctype/bom/bom.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index abb2817e4f0..b8a8ae8aea3 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -281,12 +281,15 @@ class BOM(WebsiteGenerator): return bom_list - def traverse_tree(self, bom_list=[]): + def traverse_tree(self, bom_list=None): def _get_children(bom_no): return [cstr(d[0]) for d in frappe.db.sql("""select bom_no from `tabBOM Item` where parent = %s and ifnull(bom_no, '') != ''""", bom_no)] count = 0 + if not bom_list: + bom_list = [] + if self.name not in bom_list: bom_list.append(self.name)