From a613ea8abf2ac27c0cb505144dea14dd0d8157f9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 20 Jan 2016 18:31:20 +0530 Subject: [PATCH] [patch] Create manufacturer records --- erpnext/patches.txt | 3 ++- .../v6_16/create_manufacturer_records.py | 19 +++++++++++++++++++ erpnext/stock/doctype/item/item_list.js | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v6_16/create_manufacturer_records.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 3cfc83b481..71aed12b97 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -241,4 +241,5 @@ erpnext.patches.v6_10.fix_billed_amount_in_drop_ship_po erpnext.patches.v6_10.fix_delivery_status_of_drop_ship_item #2015-12-08 erpnext.patches.v5_8.tax_rule #2015-12-08 erpnext.patches.v6_12.set_overdue_tasks -erpnext.patches.v6_16.update_billing_status_in_dn_and_pr \ No newline at end of file +erpnext.patches.v6_16.update_billing_status_in_dn_and_pr +erpnext.patches.v6_16.create_manufacturer_records \ No newline at end of file diff --git a/erpnext/patches/v6_16/create_manufacturer_records.py b/erpnext/patches/v6_16/create_manufacturer_records.py new file mode 100644 index 0000000000..9e18e8fb07 --- /dev/null +++ b/erpnext/patches/v6_16/create_manufacturer_records.py @@ -0,0 +1,19 @@ +# Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import cstr + +def execute(): + frappe.reload_doctype("Manufacturer") + frappe.reload_doctype("Item") + + for d in frappe.db.sql("""select distinct manufacturer from tabItem + where ifnull(manufacturer, '') != '' and disabled=0"""): + manufacturer_name = cstr(d[0]).strip() + if manufacturer_name and not frappe.db.exists("Manufacturer", manufacturer_name): + man = frappe.new_doc("Manufacturer") + man.short_name = manufacturer_name + man.full_name = manufacturer_name + man.save() \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item_list.js b/erpnext/stock/doctype/item/item_list.js index 1074bd0039..fffc7fe526 100644 --- a/erpnext/stock/doctype/item/item_list.js +++ b/erpnext/stock/doctype/item/item_list.js @@ -1,6 +1,7 @@ frappe.listview_settings['Item'] = { add_fields: ["item_name", "stock_uom", "item_group", "image", "variant_of", "has_variants", "end_of_life", "disabled", "is_sales_item"], + filters: [["disabled", "=", "0"]], get_indicator: function(doc) { if (doc.disabled) {