Added patch to fetch Item Template Attributes

This commit is contained in:
Neil Trini Lasrado 2015-08-06 13:35:12 +05:30
parent ebf4cbeae3
commit b9b49632f2
3 changed files with 18 additions and 1 deletions

View File

@ -192,3 +192,4 @@ erpnext.patches.v5_4.fix_missing_item_images
erpnext.patches.v5_4.stock_entry_additional_costs
erpnext.patches.v5_4.cleanup_journal_entry
execute:frappe.db.sql("update `tabProduction Order` pro set description = (select description from tabItem where name=pro.production_item) where ifnull(description, '') = ''")
erpnext.patches.v5_4.item_template

View File

@ -0,0 +1,16 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
item_attribute = {}
for d in frappe.db.sql("""select DISTINCT va.attribute, i.variant_of from `tabVariant Attribute` va, `tabItem` i \
where va.parent = i.name""", as_dict=1):
item_attribute.setdefault(d.variant_of, []).append({"attribute": d.attribute})
for item, attributes in item_attribute.items():
template = frappe.get_doc("Item", item)
template.set('valid_attributes', attributes)
template.save()

View File

@ -6,7 +6,7 @@ frappe.listview_settings['Item'] = {
if(doc.end_of_life && doc.end_of_life < frappe.datetime.get_today()) {
return [__("Expired"), "grey", "end_of_life,<,Today"]
} else if(doc.has_variants) {
return [__("Template"), "blue", "has_variant,=,1"]
return [__("Template"), "blue", "has_variants,=,Yes"]
} else if(doc.variant_of) {
return [__("Variant"), "green", "variant_of,=," + doc.variant_of]
} else {