Skip to content

Commit

Permalink
fix: Remove duplicates from customer_code field (frappe#27555)
Browse files Browse the repository at this point in the history
  • Loading branch information
marination committed Sep 17, 2021
1 parent c9c8957 commit 41f11ec
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions erpnext/stock/doctype/item/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,12 @@ def check_for_active_boms(self):
_("Default BOM ({0}) must be active for this item or its template").format(bom_item))

def fill_customer_code(self):
""" Append all the customer codes and insert into "customer_code" field of item table """
self.customer_code = ','.join(d.ref_code for d in self.get("customer_items", []))
"""
Append all the customer codes and insert into "customer_code" field of item table.
Used to search Item by customer code.
"""
customer_codes = set(d.ref_code for d in self.get("customer_items", []))
self.customer_code = ','.join(customer_codes)

def check_item_tax(self):
"""Check whether Tax Rate is not entered twice for same Tax Type"""
Expand Down

0 comments on commit 41f11ec

Please sign in to comment.