From 517eacf9e3b6bea3c06ffeacbf8f8987eafb18e0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 23 May 2012 16:21:39 +0530 Subject: [PATCH] packing list code updated for duplicate items in item table --- erpnext/selling/doctype/sales_common/sales_common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py index 4817bdc473..dd462f3f57 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.py +++ b/erpnext/selling/doctype/sales_common/sales_common.py @@ -402,7 +402,7 @@ class DocType(TransactionBase): # check if exists exists = 0 for d in getlist(obj.doclist, 'packing_details'): - if d.parent_item == line.item_code and d.item_code == packing_item_code: + if d.parent_item == line.item_code and d.item_code == packing_item_code and d.parent_detail_docname == line.name: pi, exists = d, 1 break @@ -440,15 +440,15 @@ class DocType(TransactionBase): self.update_packing_list_item(obj, i['item_code'], flt(i['qty'])*flt(d.qty), warehouse, d) else: self.update_packing_list_item(obj, d.item_code, d.qty, warehouse, d) - if d.item_code not in parent_items: - parent_items.append(d.item_code) + if [d.item_code, d.name] not in parent_items: + parent_items.append([d.item_code, d.name]) self.cleanup_packing_list(obj, parent_items) def cleanup_packing_list(self, obj, parent_items): """Remove all those parent items which are no longer present in main item table""" for d in getlist(obj.doclist, 'packing_details'): - if d.parent_item not in parent_items: + if [d.parent_item, d.parent_detail_docname] not in parent_items: d.parent = ''