From d46abb49f33b5346983b07fdd1959720582d27a9 Mon Sep 17 00:00:00 2001 From: gabtzi Date: Mon, 28 Dec 2015 12:03:24 +0200 Subject: [PATCH] Fix for Issue #4543: Suffix now uses attribute abbreviation if it exists or value for numeric attributes --- erpnext/stock/doctype/item/item.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 830e62d549..7ac7a15dcd 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -34,7 +34,8 @@ class Item(WebsiteGenerator): if self.variant_of: item_code_suffix = "" for attribute in self.attributes: - item_code_suffix += "-" + str(attribute.attribute_value) + attribute_abbr = frappe.db.get_value("Item Attribute Value", {"parent": attribute.attribute, "attribute_value": attribute.attribute_value}, "abbr") + item_code_suffix += "-" + str(attribute_abbr or attribute.attribute_value) self.item_code = str(self.variant_of) + item_code_suffix else: from frappe.model.naming import make_autoname