[patch] Create manufacturer records

This commit is contained in:
Nabin Hait 2016-01-20 18:31:20 +05:30
parent d737390b80
commit a613ea8abf
3 changed files with 22 additions and 1 deletions

View File

@ -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
erpnext.patches.v6_16.update_billing_status_in_dn_and_pr
erpnext.patches.v6_16.create_manufacturer_records

View File

@ -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()

View File

@ -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) {