diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json index 1d75bb5d99..0923a5b617 100644 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json @@ -4,6 +4,7 @@ "doctype": "DocType", "document_type": "Document", "editable_grid": 1, + "engine": "InnoDB", "field_order": [ "item_code", "col_break1", @@ -15,6 +16,10 @@ "image_section", "image", "image_view", + "manufacture_details", + "manufacturer", + "column_break_13", + "manufacturer_part_no", "quantity_and_rate", "received_qty", "qty", @@ -728,11 +733,32 @@ { "fieldname": "dimension_col_break", "fieldtype": "Column Break" + }, + { + "fieldname": "manufacture_details", + "fieldtype": "Section Break", + "label": "Manufacture" + }, + { + "fieldname": "manufacturer", + "fieldtype": "Link", + "label": "Manufacturer", + "options": "Manufacturer" + }, + { + "fieldname": "column_break_13", + "fieldtype": "Column Break" + }, + { + "fieldname": "manufacturer_part_no", + "fieldtype": "Data", + "label": "Manufacturer Part Number", + "read_only": 1 } ], "idx": 1, "istable": 1, - "modified": "2019-05-25 22:04:48.435730", + "modified": "2019-06-02 06:36:17.078419", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice Item", diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json index c0338fd2d4..1b63f8f857 100644 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -17,6 +17,10 @@ "col_break1", "image", "image_view", + "manufacture_details", + "manufacturer", + "column_break_14", + "manufacturer_part_no", "quantity_and_rate", "qty", "stock_uom", @@ -672,11 +676,32 @@ { "fieldname": "dimension_col_break", "fieldtype": "Column Break" + }, + { + "fieldname": "manufacture_details", + "fieldtype": "Section Break", + "label": "Manufacture" + }, + { + "fieldname": "manufacturer", + "fieldtype": "Link", + "label": "Manufacturer", + "options": "Manufacturer" + }, + { + "fieldname": "column_break_14", + "fieldtype": "Column Break" + }, + { + "fieldname": "manufacturer_part_no", + "fieldtype": "Data", + "label": "Manufacturer Part Number", + "read_only": 1 } ], "idx": 1, "istable": 1, - "modified": "2019-05-25 22:10:32.518941", + "modified": "2019-06-02 06:34:47.495730", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order Item", diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json index b37e0ba075..7d7d6f4d3d 100644 --- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json +++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json @@ -18,6 +18,10 @@ "col_break1", "image", "image_view", + "manufacture_details", + "manufacturer", + "column_break_15", + "manufacturer_part_no", "quantity_and_rate", "qty", "stock_uom", @@ -285,6 +289,7 @@ "read_only": 1 }, { + "default": "0", "fieldname": "is_free_item", "fieldtype": "Check", "label": "Is Free Item", @@ -493,6 +498,7 @@ }, { "allow_on_submit": 1, + "default": "0", "fieldname": "page_break", "fieldtype": "Check", "label": "Page Break", @@ -500,11 +506,33 @@ "oldfieldname": "page_break", "oldfieldtype": "Check", "print_hide": 1 + }, + { + "collapsible": 1, + "fieldname": "manufacture_details", + "fieldtype": "Section Break", + "label": "Manufacture" + }, + { + "fieldname": "manufacturer", + "fieldtype": "Link", + "label": "Manufacturer", + "options": "Manufacturer" + }, + { + "fieldname": "manufacturer_part_no", + "fieldtype": "Data", + "label": "Manufacturer Part Number", + "read_only": 1 + }, + { + "fieldname": "column_break_15", + "fieldtype": "Column Break" } ], "idx": 1, "istable": 1, - "modified": "2019-05-01 17:35:05.078030", + "modified": "2019-06-02 05:32:46.019237", "modified_by": "Administrator", "module": "Buying", "name": "Supplier Quotation Item", diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index 4fc824fcf1..84aa8474d3 100644 --- a/erpnext/config/stock.py +++ b/erpnext/config/stock.py @@ -161,6 +161,10 @@ def get_data(): "type": "doctype", "name": "Item Alternative", }, + { + "type": "doctype", + "name": "Item Manufacturer", + }, { "type": "doctype", "name": "Item Variant Settings", diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index 22846693d1..ccd334ffba 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -437,3 +437,20 @@ def get_batch_numbers(doctype, txt, searchfield, start, page_len, filters): query += " and item = {item}".format(item = frappe.db.escape(filters.get('item'))) return frappe.db.sql(query, filters) + +@frappe.whitelist() +def item_manufacturer_query(doctype, txt, searchfield, start, page_len, filters): + search_txt = "{0}%".format(txt) + + item_filters = { + 'manufacturer': ('like', search_txt), + 'item_code': filters.get("item_code") + } + + return frappe.get_all("Item Manufacturer", + fields = "manufacturer", + filters = item_filters, + limit_start=start, + limit_page_length=page_len, + as_list=1 + ) diff --git a/erpnext/demo/data/drug_list.json b/erpnext/demo/data/drug_list.json index 9b101cb1c8..e91c30d199 100644 --- a/erpnext/demo/data/drug_list.json +++ b/erpnext/demo/data/drug_list.json @@ -39,8 +39,8 @@ "item_name": "Atocopherol", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, + + "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:16.577151", @@ -123,8 +123,8 @@ "item_name": "Abacavir", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, + + "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:16.678257", @@ -207,8 +207,6 @@ "item_name": "Abciximab", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:16.695413", @@ -291,8 +289,6 @@ "item_name": "Acacia", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:16.797774", @@ -375,8 +371,6 @@ "item_name": "Acamprosate", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:16.826952", @@ -459,8 +453,6 @@ "item_name": "Acarbose", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:16.843890", @@ -543,8 +535,6 @@ "item_name": "Acebrofylline", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:16.969984", @@ -627,8 +617,6 @@ "item_name": "Acebrofylline (SR)", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:16.987354", @@ -711,8 +699,6 @@ "item_name": "Aceclofenac", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.004369", @@ -795,8 +781,6 @@ "item_name": "Ash", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.021192", @@ -879,8 +863,6 @@ "item_name": "Asparaginase", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.038058", @@ -963,8 +945,6 @@ "item_name": "Aspartame", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.054463", @@ -1047,8 +1027,6 @@ "item_name": "Aspartic Acid", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.071001", @@ -1131,8 +1109,6 @@ "item_name": "Bleomycin", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.087170", @@ -1215,8 +1191,6 @@ "item_name": "Bleomycin Sulphate", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.103691", @@ -1299,8 +1273,6 @@ "item_name": "Blue cap contains", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.120040", @@ -1383,8 +1355,6 @@ "item_name": "Boran", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.135964", @@ -1467,8 +1437,6 @@ "item_name": "Borax", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.152575", @@ -1551,8 +1519,6 @@ "item_name": "Chlorbutanol", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.168998", @@ -1635,8 +1601,6 @@ "item_name": "Chlorbutol", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.185316", @@ -1719,8 +1683,6 @@ "item_name": "Chlordiazepoxide", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.208361", @@ -1803,8 +1765,6 @@ "item_name": "Chlordiazepoxide and Clidinium Bromide", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.224341", @@ -1887,8 +1847,6 @@ "item_name": "Chlorhexidine", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.240634", @@ -1971,8 +1929,6 @@ "item_name": "Chlorhexidine 40%", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.256922", @@ -2055,8 +2011,6 @@ "item_name": "Chlorhexidine Acetate", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.274789", @@ -2139,8 +2093,6 @@ "item_name": "Chlorhexidine Gluconate", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.295371", @@ -2223,8 +2175,6 @@ "item_name": "Chlorhexidine HCL", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.312916", @@ -2307,8 +2257,6 @@ "item_name": "Chlorhexidine Hydrochloride", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.329570", @@ -2391,8 +2339,6 @@ "item_name": "Chloride", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.346088", @@ -2475,8 +2421,6 @@ "item_name": "Fosfomycin Tromethamine", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.362777", @@ -2559,8 +2503,6 @@ "item_name": "Fosinopril", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.379465", @@ -2643,8 +2585,6 @@ "item_name": "Iodochlorhydroxyquinoline", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.396068", @@ -2727,8 +2667,6 @@ "item_name": "Iodochlorohydroxyquinoline", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.412734", @@ -2811,8 +2749,6 @@ "item_name": "Ipratropium", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.429333", @@ -2895,8 +2831,6 @@ "item_name": "Mebeverine hydrochloride", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.445814", @@ -2979,8 +2913,6 @@ "item_name": "Mecetronium ethylsulphate", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.461696", @@ -3063,8 +2995,6 @@ "item_name": "Meclizine", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.478020", @@ -3147,8 +3077,8 @@ "item_name": "Oxaprozin", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, + + "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.496221", @@ -3231,8 +3161,6 @@ "item_name": "Oxazepam", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.511933", @@ -3315,8 +3243,6 @@ "item_name": "Oxcarbazepine", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.528472", @@ -3399,8 +3325,6 @@ "item_name": "Oxetacaine", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.544177", @@ -3483,8 +3407,6 @@ "item_name": "Oxethazaine", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.560193", @@ -3567,8 +3489,6 @@ "item_name": "Suxamethonium Chloride", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.576447", @@ -3651,8 +3571,6 @@ "item_name": "Tacrolimus", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.593481", @@ -3735,8 +3653,6 @@ "item_name": "Ubiquinol", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.609930", @@ -3819,8 +3735,6 @@ "item_name": "Vitamin B12", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.626225", @@ -3903,8 +3817,6 @@ "item_name": "Vitamin B1Hydrochloride", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.642423", @@ -3987,8 +3899,6 @@ "item_name": "Vitamin B1Monohydrate", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.658946", @@ -4071,8 +3981,6 @@ "item_name": "Vitamin B2", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.675234", @@ -4155,8 +4063,6 @@ "item_name": "Vitamin B3", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.691598", @@ -4239,8 +4145,6 @@ "item_name": "Vitamin D4", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.707840", @@ -4323,8 +4227,6 @@ "item_name": "Vitamin E", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.723859", @@ -4407,8 +4309,6 @@ "item_name": "Wheat Germ Oil", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.739829", @@ -4491,8 +4391,6 @@ "item_name": "Wheatgrass extr", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.757695", @@ -4575,8 +4473,6 @@ "item_name": "Whey Protein", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.774098", @@ -4659,8 +4555,6 @@ "item_name": "Xylometazoline", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.790224", @@ -4743,8 +4637,6 @@ "item_name": "Xylometazoline Hydrochloride", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.806359", @@ -4827,8 +4719,6 @@ "item_name": "Yeast", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.823305", @@ -4911,8 +4801,6 @@ "item_name": "Yellow Fever Vaccine", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.840250", @@ -4995,8 +4883,6 @@ "item_name": "Zafirlukast", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.856856", @@ -5079,8 +4965,6 @@ "item_name": "Zaleplon", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.873287", @@ -5163,8 +5047,6 @@ "item_name": "Zaltoprofen", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.889263", @@ -5247,8 +5129,6 @@ "item_name": "Zanamivir", "last_purchase_rate": 0.0, "lead_time_days": 0, - "manufacturer": null, - "manufacturer_part_no": null, "max_discount": 0.0, "min_order_qty": 0.0, "modified": "2017-07-06 12:53:17.905022", diff --git a/erpnext/patches.txt b/erpnext/patches.txt index a8fb5d6f00..56c51b102c 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -603,4 +603,5 @@ erpnext.patches.v11_1.rename_depends_on_lwp execute:frappe.delete_doc("Report", "Inactive Items") erpnext.patches.v11_1.delete_scheduling_tool erpnext.patches.v12_0.make_custom_fields_for_bank_remittance -execute:frappe.delete_doc_if_exists("Page", "support-analytics") \ No newline at end of file +execute:frappe.delete_doc_if_exists("Page", "support-analytics") +erpnext.patches.v12_0.make_item_manufacturer diff --git a/erpnext/patches/v12_0/make_item_manufacturer.py b/erpnext/patches/v12_0/make_item_manufacturer.py new file mode 100644 index 0000000000..ebc28320ae --- /dev/null +++ b/erpnext/patches/v12_0/make_item_manufacturer.py @@ -0,0 +1,27 @@ +# Copyright (c) 2017, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.reload_doc("stock", "doctype", "item_manufacturer") + + item_manufacturer = [] + for d in frappe.db.sql(""" SELECT name, manufacturer, manufacturer_part_no, creation, owner + FROM `tabItem` WHERE manufacturer is not null and manufacturer != ''""", as_dict=1): + item_manufacturer.append(( + frappe.generate_hash("", 10), + d.name, + d.manufacturer, + d.manufacturer_part_no, + d.creation, + d.owner + )) + + if item_manufacturer: + frappe.db.sql(''' + INSERT INTO `tabItem Manufacturer` + (`name`, `item_code`, `manufacturer`, `manufacturer_part_no`, `creation`, `owner`) + VALUES {}'''.format(', '.join(['%s'] * len(item_manufacturer))), tuple(item_manufacturer) + ) diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js index f2fe3fe72b..7e61f03af9 100644 --- a/erpnext/public/js/controllers/buying.js +++ b/erpnext/public/js/controllers/buying.js @@ -14,8 +14,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ this._super(); }, - onload: function() { - this.setup_queries(); + onload: function(doc, cdt, cdn) { + this.setup_queries(doc, cdt, cdn); this._super(); this.frm.set_query('shipping_rule', function() { @@ -50,7 +50,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ /* eslint-enable */ }, - setup_queries: function() { + setup_queries: function(doc, cdt, cdn) { var me = this; if(this.frm.fields_dict.buying_price_list) { @@ -90,6 +90,15 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } } }); + + + this.frm.set_query("manufacturer", "items", function(doc, cdt, cdn) { + const row = locals[cdt][cdn]; + return { + query: "erpnext.controllers.queries.item_manufacturer_query", + filters:{ 'item_code': row.item_code } + } + }); }, refresh: function(doc) { @@ -338,6 +347,25 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } }) } + }, + + manufacturer: function(doc, cdt, cdn) { + const row = locals[cdt][cdn]; + + if(row.manufacturer) { + frappe.call({ + method: "erpnext.stock.doctype.item_manufacturer.item_manufacturer.get_item_manufacturer_part_no", + args: { + 'item_code': row.item_code, + 'manufacturer': row.manufacturer + }, + callback: function(r) { + if (r.message) { + frappe.model.set_value(cdt, cdn, 'manufacturer_part_no', r.message); + } + } + }); + } } }); diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 329695eb39..bbd1f1c17b 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -460,6 +460,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ weight_per_unit: item.weight_per_unit, weight_uom: item.weight_uom, uom : item.uom, + manufacturer: item.manufacturer, stock_uom: item.stock_uom, pos_profile: me.frm.doc.doctype == 'Sales Invoice' ? me.frm.doc.pos_profile : '', cost_center: item.cost_center, diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 5a287b12f7..fc715c91c5 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -76,9 +76,8 @@ "is_customer_provided_item", "customer", "supplier_details", + "manufacturers", "delivered_by_supplier", - "manufacturer", - "manufacturer_part_no", "column_break2", "supplier_items", "foreign_trade_details", @@ -198,6 +197,7 @@ "search_index": 1 }, { + "default": "0", "fieldname": "is_item_from_hub", "fieldtype": "Check", "label": "Is Item from Hub", @@ -218,11 +218,13 @@ "fieldtype": "Column Break" }, { + "default": "0", "fieldname": "disabled", "fieldtype": "Check", "label": "Disabled" }, { + "default": "0", "fieldname": "allow_alternative_item", "fieldtype": "Check", "label": "Allow Alternative Item" @@ -263,6 +265,7 @@ "label": "Standard Selling Rate" }, { + "default": "0", "fieldname": "is_fixed_asset", "fieldtype": "Check", "label": "Is Fixed Asset", @@ -439,6 +442,7 @@ "label": "Serial Nos and Batches" }, { + "default": "0", "depends_on": "eval:doc.is_stock_item", "fieldname": "has_batch_no", "fieldtype": "Check", @@ -448,6 +452,7 @@ "oldfieldtype": "Select" }, { + "default": "0", "depends_on": "has_batch_no", "fieldname": "create_new_batch", "fieldtype": "Check", @@ -462,12 +467,14 @@ "translatable": 1 }, { + "default": "0", "depends_on": "has_batch_no", "fieldname": "has_expiry_date", "fieldtype": "Check", "label": "Has Expiry Date" }, { + "default": "0", "depends_on": "has_batch_no", "fieldname": "retain_sample", "fieldtype": "Check", @@ -485,6 +492,7 @@ "fieldtype": "Column Break" }, { + "default": "0", "depends_on": "eval:doc.is_stock_item || doc.is_fixed_asset", "fieldname": "has_serial_no", "fieldtype": "Check", @@ -601,6 +609,7 @@ "read_only": 1 }, { + "default": "0", "fieldname": "is_customer_provided_item", "fieldtype": "Check", "label": "Is Customer Provided Item" @@ -619,26 +628,15 @@ "label": "Supplier Details" }, { + "default": "0", "fieldname": "delivered_by_supplier", "fieldtype": "Check", "label": "Delivered by Supplier (Drop Ship)", "print_hide": 1 }, - { - "fieldname": "manufacturer", - "fieldtype": "Link", - "label": "Manufacturer", - "options": "Manufacturer" - }, - { - "fieldname": "manufacturer_part_no", - "fieldtype": "Data", - "label": "Manufacturer Part Number" - }, { "fieldname": "column_break2", "fieldtype": "Column Break", - "label": "Item Code for Suppliers", "oldfieldtype": "Column Break", "width": "50%" }, @@ -718,6 +716,7 @@ "options": "Account" }, { + "default": "0", "fieldname": "enable_deferred_revenue", "fieldtype": "Check", "label": "Enable Deferred Revenue" @@ -747,6 +746,7 @@ "options": "Account" }, { + "default": "0", "fieldname": "enable_deferred_expense", "fieldtype": "Check", "label": "Enable Deferred Expense" @@ -800,6 +800,7 @@ "options": "fa fa-search" }, { + "default": "0", "fieldname": "inspection_required_before_purchase", "fieldtype": "Check", "label": "Inspection Required before Purchase", @@ -807,6 +808,7 @@ "oldfieldtype": "Select" }, { + "default": "0", "fieldname": "inspection_required_before_delivery", "fieldtype": "Check", "label": "Inspection Required before Delivery" @@ -840,6 +842,7 @@ "read_only": 1 }, { + "default": "0", "description": "If subcontracted to a vendor", "fieldname": "is_sub_contracted_item", "fieldtype": "Check", @@ -867,6 +870,7 @@ "options": "fa fa-globe" }, { + "default": "0", "depends_on": "eval:!doc.variant_of", "fieldname": "show_in_website", "fieldtype": "Check", @@ -874,6 +878,7 @@ "search_index": 1 }, { + "default": "0", "depends_on": "variant_of", "fieldname": "show_variant_in_website", "fieldtype": "Check", @@ -1016,6 +1021,12 @@ "fieldtype": "Check", "label": "Synced With Hub", "read_only": 1 + }, + { + "fieldname": "manufacturers", + "fieldtype": "Table", + "label": "Manufacturers", + "options": "Item Manufacturer" } ], "has_web_view": 1, @@ -1023,7 +1034,7 @@ "idx": 2, "image_field": "image", "max_attachments": 1, - "modified": "2019-05-16 09:32:27.056036", + "modified": "2019-06-02 04:45:59.911507", "modified_by": "Administrator", "module": "Stock", "name": "Item", diff --git a/erpnext/stock/doctype/item/item_dashboard.py b/erpnext/stock/doctype/item/item_dashboard.py index 8e4f74ddbb..b3733d357b 100644 --- a/erpnext/stock/doctype/item/item_dashboard.py +++ b/erpnext/stock/doctype/item/item_dashboard.py @@ -41,7 +41,7 @@ def get_data(): }, { 'label': _('Manufacture'), - 'items': ['Work Order'] + 'items': ['Work Order', 'Item Manufacturer'] } ] } \ No newline at end of file diff --git a/erpnext/stock/doctype/item/templates/item.html b/erpnext/stock/doctype/item/templates/item.html new file mode 100644 index 0000000000..db123090aa --- /dev/null +++ b/erpnext/stock/doctype/item/templates/item.html @@ -0,0 +1,7 @@ +{% extends "templates/web.html" %} + +{% block page_content %} +

{{ title }}

+{% endblock %} + + \ No newline at end of file diff --git a/erpnext/stock/doctype/item/templates/item_row.html b/erpnext/stock/doctype/item/templates/item_row.html new file mode 100644 index 0000000000..2b999819cb --- /dev/null +++ b/erpnext/stock/doctype/item/templates/item_row.html @@ -0,0 +1,4 @@ +
+ {{ title }} +
+ \ No newline at end of file diff --git a/erpnext/stock/doctype/item_manufacturer/__init__.py b/erpnext/stock/doctype/item_manufacturer/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/stock/doctype/item_manufacturer/item_manufacturer.js b/erpnext/stock/doctype/item_manufacturer/item_manufacturer.js new file mode 100644 index 0000000000..a4df923f03 --- /dev/null +++ b/erpnext/stock/doctype/item_manufacturer/item_manufacturer.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Item Manufacturer', { + // refresh: function(frm) { + + // } +}); diff --git a/erpnext/stock/doctype/item_manufacturer/item_manufacturer.json b/erpnext/stock/doctype/item_manufacturer/item_manufacturer.json new file mode 100644 index 0000000000..956c92e673 --- /dev/null +++ b/erpnext/stock/doctype/item_manufacturer/item_manufacturer.json @@ -0,0 +1,105 @@ +{ + "allow_import": 1, + "creation": "2019-06-02 04:41:37.332911", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "item_code", + "manufacturer", + "manufacturer_part_no", + "column_break_3", + "item_name", + "description" + ], + "fields": [ + { + "fieldname": "manufacturer", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Manufacturer", + "options": "Manufacturer", + "reqd": 1 + }, + { + "fieldname": "manufacturer_part_no", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Manufacturer Part Number", + "reqd": 1 + }, + { + "fieldname": "item_code", + "fieldtype": "Link", + "label": "Item Code", + "options": "Item", + "reqd": 1 + }, + { + "fetch_from": "item_code.item_name", + "fieldname": "item_name", + "fieldtype": "Data", + "label": "Item Name", + "read_only": 1 + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fetch_from": "item_code.description", + "fieldname": "description", + "fieldtype": "Small Text", + "label": "Description", + "read_only": 1 + } + ], + "modified": "2019-06-06 19:07:31.175919", + "modified_by": "Administrator", + "module": "Stock", + "name": "Item Manufacturer", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock User", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock Manager", + "share": 1, + "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Item Manager", + "share": 1, + "write": 1 + } + ], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "ASC", + "title_field": "item_code", + "track_changes": 1 +} \ No newline at end of file diff --git a/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py b/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py new file mode 100644 index 0000000000..67eab82d97 --- /dev/null +++ b/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals + +import frappe +from frappe import _ +from frappe.model.document import Document + +class ItemManufacturer(Document): + def validate(self): + self.validate_duplicate_entry() + + def validate_duplicate_entry(self): + if self.is_new(): + filters = { + 'item_code': self.item_code, + 'manufacturer': self.manufacturer, + 'manufacturer_part_no': self.manufacturer_part_no + } + + if frappe.db.exists("Item Manufacturer", filters): + frappe.throw(_("Duplicate entry against the item code {0} and manufacturer {1}") + .format(self.item_code, self.manufacturer)) + +@frappe.whitelist() +def get_item_manufacturer_part_no(item_code, manufacturer): + return frappe.db.get_value("Item Manufacturer", + {'item_code': item_code, 'manufacturer': manufacturer}, 'manufacturer_part_no') \ No newline at end of file diff --git a/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py b/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py new file mode 100644 index 0000000000..1cef20c417 --- /dev/null +++ b/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestItemManufacturer(unittest.TestCase): + pass diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.json b/erpnext/stock/doctype/material_request_item/material_request_item.json index 9f4f14a05d..795971b5e3 100644 --- a/erpnext/stock/doctype/material_request_item/material_request_item.json +++ b/erpnext/stock/doctype/material_request_item/material_request_item.json @@ -15,6 +15,10 @@ "brand", "image_section", "image", + "manufacture_details", + "manufacturer", + "column_break_12", + "manufacturer_part_no", "quantity_and_warehouse", "qty", "uom", @@ -378,11 +382,32 @@ { "fieldname": "dimension_col_break", "fieldtype": "Column Break" + }, + { + "fieldname": "manufacture_details", + "fieldtype": "Section Break", + "label": "Manufacture" + }, + { + "fieldname": "manufacturer", + "fieldtype": "Link", + "label": "Manufacturer", + "options": "Manufacturer" + }, + { + "fieldname": "column_break_12", + "fieldtype": "Column Break" + }, + { + "fieldname": "manufacturer_part_no", + "fieldtype": "Data", + "label": "Manufacturer Part Number", + "read_only": 1 } ], "idx": 1, "istable": 1, - "modified": "2019-05-25 22:03:10.517886", + "modified": "2019-06-02 06:49:36.493957", "modified_by": "Administrator", "module": "Stock", "name": "Material Request Item", diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json index 66df86bcf4..bb5cd52002 100644 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json @@ -19,6 +19,10 @@ "image_section", "image", "image_view", + "manufacture_details", + "manufacturer", + "column_break_16", + "manufacturer_part_no", "received_and_accepted", "received_qty", "qty", @@ -788,11 +792,33 @@ { "fieldname": "dimension_col_break", "fieldtype": "Column Break" + }, + { + "collapsible": 1, + "fieldname": "manufacture_details", + "fieldtype": "Section Break", + "label": "Manufacture" + }, + { + "fieldname": "manufacturer", + "fieldtype": "Link", + "label": "Manufacturer", + "options": "Manufacturer" + }, + { + "fieldname": "column_break_16", + "fieldtype": "Column Break" + }, + { + "fieldname": "manufacturer_part_no", + "fieldtype": "Data", + "label": "Manufacturer Part Number", + "read_only": 1 } ], "idx": 1, "istable": 1, - "modified": "2019-06-01 23:25:20.732134", + "modified": "2019-06-02 06:37:48.198745", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item", diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index f694af8481..791fad815a 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -14,6 +14,7 @@ from erpnext import get_company_currency from erpnext.stock.doctype.item.item import get_item_defaults, get_uom_conv_factor from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults from erpnext.setup.doctype.brand.brand import get_brand_defaults +from erpnext.stock.doctype.item_manufacturer.item_manufacturer import get_item_manufacturer_part_no from six import string_types, iteritems @@ -312,6 +313,14 @@ def get_basic_details(args, item): for fieldname in ("item_name", "item_group", "barcodes", "brand", "stock_uom"): out[fieldname] = item.get(fieldname) + if args.get("manufacturer"): + part_no = get_item_manufacturer_part_no(args.get("item_code"), args.get("manufacturer")) + if part_no: + out["manufacturer_part_no"] = part_no + else: + out["manufacturer_part_no"] = None + out["manufacturer"] = None + return out @frappe.whitelist()