Added patch to fetch Item Template Attributes
This commit is contained in:
parent
ebf4cbeae3
commit
b9b49632f2
@ -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
|
||||
|
16
erpnext/patches/v5_4/item_template.py
Normal file
16
erpnext/patches/v5_4/item_template.py
Normal 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()
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user