From 23a4b09d4328fe1386d24f16a5f6408931527f41 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 17:45:47 +0800 Subject: [PATCH 01/81] Add Material Request schedule_date field, similar to delivery_date in Sales Order --- erpnext/patches.txt | 1 + erpnext/patches/v8_11/__init__.py | 1 + .../set_schedule_date_for_material_request.py | 20 ++++++++++ .../material_request/material_request.js | 40 +++++++++++++++---- .../material_request/material_request.json | 32 ++++++++++++++- .../tests/test_material_request.js | 11 +++++ 6 files changed, 97 insertions(+), 8 deletions(-) create mode 100644 erpnext/patches/v8_11/__init__.py create mode 100644 erpnext/patches/v8_11/set_schedule_date_for_material_request.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index e75c490a36..48447f0e43 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -448,3 +448,4 @@ erpnext.patches.v8_9.remove_employee_from_salary_structure_parent erpnext.patches.v8_9.delete_gst_doctypes_for_outside_india_accounts erpnext.patches.v8_9.set_default_fields_in_variant_settings erpnext.patches.v8_9.update_billing_gstin_for_indian_account +erpnext.patches.v9_0.set_schedule_date_for_material_request \ No newline at end of file diff --git a/erpnext/patches/v8_11/__init__.py b/erpnext/patches/v8_11/__init__.py new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/erpnext/patches/v8_11/__init__.py @@ -0,0 +1 @@ + diff --git a/erpnext/patches/v8_11/set_schedule_date_for_material_request.py b/erpnext/patches/v8_11/set_schedule_date_for_material_request.py new file mode 100644 index 0000000000..bef43bd0d4 --- /dev/null +++ b/erpnext/patches/v8_11/set_schedule_date_for_material_request.py @@ -0,0 +1,20 @@ +# 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_doctype("Material Request") + frappe.reload_doctype("Material Request Item") + + if not frappe.db.has_column("Material Request", "schedule_date"): + return + + #Update only submitted MR + for mr in frappe.get_all("Material Request", filters= [["docstatus", "=", 1]], fields=["name"]): + material_request = frappe.get_doc("Material Request", mr) + if material_request.items: + if not material_request.schedule_date: + material_request.schedule_date = material_request.items[0].schedule_date + material_request.save() \ No newline at end of file diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index 7043fb7ba8..17a3914796 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -17,6 +17,9 @@ frappe.ui.form.on('Material Request', { // add item, if previous view was item erpnext.utils.add_item(frm); + //set schedule_date + set_schedule_date(frm); + // formatter for material request item frm.set_indicator_formatter('item_code', function(doc) { return (doc.qty<=doc.ordered_qty) ? "green" : "orange" }), @@ -38,12 +41,7 @@ frappe.ui.form.on("Material Request Item", { }, item_code: function(frm, doctype, name) { - frm.script_manager.copy_from_first_row('items', frm.selected_doc, - 'schedule_date'); - }, - - schedule_date: function(frm, cdt, cdn) { - erpnext.utils.copy_value_in_all_row(frm.doc, cdt, cdn, "items", "schedule_date"); + set_schedule_date(frm); } }); @@ -227,7 +225,21 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten } } }); - } + }, + + validate: function() { + set_schedule_date(cur_frm); + }, + + items_add: function(doc, cdt, cdn) { + var row = frappe.get_doc(cdt, cdn); + if(doc.schedule_date) { + row.schedule_date = doc.schedule_date; + refresh_field("schedule_date", cdn, "items"); + } + }, + + items_on_form_rendered: set_schedule_date(cur_frm), }); // for backward compatibility: combine new and previous states @@ -246,3 +258,17 @@ cur_frm.cscript['Unstop Material Request'] = function(){ cur_frm.refresh(); }); }; + +function set_schedule_date(frm) { + if(!frm.doc.schedule_date){ + frm.doc.schedule_date = frappe.datetime.add_days(frappe.datetime.now_date(), 5); + } + erpnext.utils.copy_value_in_all_row(frm.doc, frm.doc.doctype, frm.doc.name, "items", "schedule_date"); +} + +cur_frm.cscript.schedule_date = function(doc, cdt, cdn) { + var row = frappe.get_doc(cdt, cdn); + if(row.schedule_date){ + set_schedule_date(cur_frm); + } +} \ No newline at end of file diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json index 87cde0d3e2..9d38248fbd 100644 --- a/erpnext/stock/doctype/material_request/material_request.json +++ b/erpnext/stock/doctype/material_request/material_request.json @@ -132,7 +132,37 @@ "unique": 0 }, { - "allow_bulk_edit": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "schedule_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Required Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, diff --git a/erpnext/stock/doctype/material_request/tests/test_material_request.js b/erpnext/stock/doctype/material_request/tests/test_material_request.js index 22d1088cfe..1ae41f5898 100644 --- a/erpnext/stock/doctype/material_request/tests/test_material_request.js +++ b/erpnext/stock/doctype/material_request/tests/test_material_request.js @@ -11,14 +11,25 @@ QUnit.test("test material request", function(assert) { {'schedule_date': frappe.datetime.add_days(frappe.datetime.nowdate(), 5)}, {'qty': 5}, {'item_code': 'Test Product 1'}, + ], + [ + {'schedule_date': frappe.datetime.add_days(frappe.datetime.nowdate(), 6)}, + {'qty': 2}, + {'item_code': 'Test Product 2'}, ] ]}, ]); }, () => cur_frm.save(), () => { + assert.ok(cur_frm.doc.schedule_date == frappe.datetime.add_days(frappe.datetime.now_date(), 5), "Schedule Date correct"); + // get_item_details assert.ok(cur_frm.doc.items[0].item_name=='Test Product 1', "Item name correct"); + assert.ok(cur_frm.doc.items[0].schedule_date == frappe.datetime.add_days(frappe.datetime.now_date(), 5), "Schedule Date correct"); + + assert.ok(cur_frm.doc.items[1].item_name=='Test Product 2', "Item name correct"); + assert.ok(cur_frm.doc.items[1].schedule_date == frappe.datetime.add_days(frappe.datetime.now_date(), 6), "Schedule Date correct"); }, () => frappe.tests.click_button('Submit'), () => frappe.tests.click_button('Yes'), From 12cb07ce3c1d5d297800ee101a18728101b5d9a5 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 20:52:46 +0800 Subject: [PATCH 02/81] [fix] test records --- .../doctype/material_request/test_records.json | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/erpnext/stock/doctype/material_request/test_records.json b/erpnext/stock/doctype/material_request/test_records.json index 09d1912ed7..f30958a85b 100644 --- a/erpnext/stock/doctype/material_request/test_records.json +++ b/erpnext/stock/doctype/material_request/test_records.json @@ -2,7 +2,7 @@ { "company": "_Test Company", "doctype": "Material Request", - "fiscal_year": "_Test Fiscal Year 2013", + "fiscal_year": "_Test Fiscal Year 2013", "items": [ { "description": "_Test Item Home Desktop 100", @@ -11,7 +11,7 @@ "item_name": "_Test Item Home Desktop 100", "parentfield": "items", "qty": 54.0, - "schedule_date": "2013-02-18", + "schedule_date": "2013-02-26", "uom": "_Test UOM 1", "warehouse": "_Test Warehouse - _TC" }, @@ -22,19 +22,20 @@ "item_name": "_Test Item Home Desktop 200", "parentfield": "items", "qty": 3.0, - "schedule_date": "2013-02-19", + "schedule_date": "2013-02-25", "uom": "_Test UOM 1", "warehouse": "_Test Warehouse - _TC" } ], "material_request_type": "Purchase", "naming_series": "_T-Material Request-", - "transaction_date": "2013-02-18" + "transaction_date": "2013-02-18", + "schedule_date": "2013-02-25" }, { "company": "_Test Company", "doctype": "Material Request", - "fiscal_year": "_Test Fiscal Year 2013", + "fiscal_year": "_Test Fiscal Year 2013", "items": [ { "description": "_Test FG Item", @@ -43,13 +44,14 @@ "item_name": "_Test FG Item", "parentfield": "items", "qty": 5, - "schedule_date": "2013-02-18", + "schedule_date": "2013-02-25", "uom": "_Test UOM 1", "warehouse": "_Test Warehouse - _TC" } ], "material_request_type": "Manufacture", "naming_series": "_T-Material Request-", - "transaction_date": "2013-02-18" + "transaction_date": "2013-02-18", + "schedule_date": "2013-02-25" } ] \ No newline at end of file From f7a8277d122cd75773ccc407e76b015403cbc603 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 01:03:12 +0800 Subject: [PATCH 03/81] Add Purchase Order schedule_date field, similar to delivery_date in Sales Order --- .../doctype/purchase_order/purchase_order.js | 30 ++++++++++++----- .../purchase_order/purchase_order.json | 33 ++++++++++++++++++- .../tests/test_purchase_order.js | 18 +++++++++- .../purchase_order_item.json | 2 +- 4 files changed, 71 insertions(+), 12 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index a51246bcb8..bbec98174f 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -15,6 +15,8 @@ frappe.ui.form.on("Purchase Order", { }, onload: function(frm) { + set_schedule_date(frm); + erpnext.queries.setup_queries(frm, "Warehouse", function() { return erpnext.queries.warehouse(frm.doc); }); @@ -107,12 +109,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( }, validate: function() { - // set default schedule date as today if missing. - (this.frm.doc.items || []).forEach(function(d) { - if(!d.schedule_date) { - d.schedule_date = frappe.datetime.nowdate(); - } - }) + set_schedule_date(cur_frm); }, make_stock_entry: function() { @@ -201,7 +198,10 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( items_add: function(doc, cdt, cdn) { var row = frappe.get_doc(cdt, cdn); - this.frm.script_manager.copy_from_first_row("items", row, ["schedule_date"]); + if(doc.schedule_date) { + row.schedule_date = doc.schedule_date; + refresh_field("schedule_date", cdn, "items"); + } }, unclose_purchase_order: function(){ @@ -225,7 +225,9 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( cur_frm.cscript.calculate_taxes_and_totals(); } }) - } + }, + + items_on_form_rendered: set_schedule_date(cur_frm), }); @@ -268,8 +270,18 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { } } +function set_schedule_date(frm) { + if(!frm.doc.schedule_date){ + frm.doc.schedule_date = frappe.datetime.add_days(frappe.datetime.now_date(), 1); + } + erpnext.utils.copy_value_in_all_row(frm.doc, frm.doc.doctype, frm.doc.name, "items", "schedule_date"); +} + cur_frm.cscript.schedule_date = function(doc, cdt, cdn) { - erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "items", "schedule_date"); + var row = frappe.get_doc(cdt, cdn); + if(row.schedule_date){ + set_schedule_date(cur_frm); + } } frappe.provide("erpnext.buying"); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 919707c08d..c6e33d5386 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -291,7 +291,38 @@ "search_index": 1, "set_only_once": 0, "unique": 0 - }, + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Today", + "fieldname": "schedule_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reqd By Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index e6529e60db..a818992db3 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,12 +13,21 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} + ], + [ + {"item_code": 'Test Product 1'}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, + {"qty": 2}, + {"uom": 'Unit'}, + {"rate": 100}, + {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ] ]}, @@ -30,12 +39,19 @@ QUnit.test("test: purchase order", function(assert) { () => { // Get supplier details assert.ok(cur_frm.doc.supplier_name == 'Test Supplier', "Supplier name correct"); + assert.ok(cur_frm.doc.schedule_date == frappe.datetime.add_days(frappe.datetime.now_date(), 1), "Schedule Date correct"); assert.ok($('div.control-value.like-disabled-input.for-description').text().includes('Contact 3'), "Contact display correct"); assert.ok(cur_frm.doc.contact_email == 'test@supplier.com', "Contact email correct"); // Get item details assert.ok(cur_frm.doc.items[0].item_name == 'Test Product 4', "Item name correct"); assert.ok(cur_frm.doc.items[0].description == 'Test Product 4', "Description correct"); assert.ok(cur_frm.doc.items[0].qty == 5, "Quantity correct"); + assert.ok(cur_frm.doc.items[0].schedule_date == frappe.datetime.add_days(frappe.datetime.now_date(), 2), "Schedule Date correct"); + + assert.ok(cur_frm.doc.items[1].item_name == 'Test Product 1', "Item name correct"); + assert.ok(cur_frm.doc.items[1].description == 'Test Product 1', "Description correct"); + assert.ok(cur_frm.doc.items[1].qty == 2, "Quantity correct"); + assert.ok(cur_frm.doc.items[1].schedule_date == cur_frm.doc.schedule_date, "Schedule Date correct"); // Calculate total assert.ok(cur_frm.doc.total == 500, "Total correct"); // Get terms 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 2dd7b6c0ed..5ba57b6390 100755 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -148,7 +148,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 0, + "in_list_view": 1, "in_standard_filter": 0, "label": "Reqd By Date", "length": 0, From 65c7a6947a974c21645e0200148997e0097ff77a Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 10:54:45 +0800 Subject: [PATCH 04/81] [fix] Codacy errors --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index a818992db3..6605a65170 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -20,7 +20,7 @@ QUnit.test("test: purchase order", function(assert) { {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From 284ceb7abe8c6ce58a1891927b77db7350c5658d Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 11:05:36 +0800 Subject: [PATCH 05/81] Set PO Reqd By Date default in code, to next date --- erpnext/buying/doctype/purchase_order/purchase_order.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index c6e33d5386..3c606a2a5a 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -298,7 +298,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "Today", + "default": "", "fieldname": "schedule_date", "fieldtype": "Date", "hidden": 0, From 71866e06f3950c52b9656e45a18e666bc75b0fd7 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 01:03:12 +0800 Subject: [PATCH 06/81] Add Purchase Order schedule_date field, similar to delivery_date in Sales Order --- erpnext/buying/doctype/purchase_order/purchase_order.json | 2 +- .../doctype/purchase_order/tests/test_purchase_order.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 3c606a2a5a..3a64f202ba 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -324,7 +324,7 @@ "unique": 0 }, { - "allow_bulk_edit": 0, + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 6605a65170..966238cb87 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,14 +13,14 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From 799d69babab4b0501e2d526a9776a3cc8c9d2414 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 10:54:45 +0800 Subject: [PATCH 07/81] [fix] Codacy errors --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 966238cb87..ffc6874de3 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -20,7 +20,7 @@ QUnit.test("test: purchase order", function(assert) { {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From 65cd9f228432a22e54b07f456d5c619f24a487be Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 14:28:42 +0800 Subject: [PATCH 08/81] Add patch to update schedule date of submitted Purchase Orders --- .../set_schedule_date_for_purchase_order.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py diff --git a/erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py b/erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py new file mode 100644 index 0000000000..3c733b1a16 --- /dev/null +++ b/erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py @@ -0,0 +1,20 @@ +# 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_doctype("Purchase Order") + frappe.reload_doctype("Purchase Order Item") + + if not frappe.db.has_column("Purchase Order", "schedule_date"): + return + + #Update only submitted PO + for po in frappe.get_all("Purchase Order", filters= [["docstatus", "=", 1]], fields=["name"]): + purchase_order = frappe.get_doc("Purchase Order", po) + if purchase_order.items: + if not purchase_order.schedule_date: + purchase_order.schedule_date = purchase_order.items[0].schedule_date + purchase_order.save() \ No newline at end of file From 892ec599d47b587ebab6d2d7d8955bae19750021 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 14:54:50 +0800 Subject: [PATCH 09/81] [fix] tests --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index ffc6874de3..6605a65170 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,7 +13,7 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, From 0d91d3f572df0e0b9b51e39842281e3b19ad9952 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 26 Sep 2017 10:56:31 +0800 Subject: [PATCH 10/81] add schedule_date while creating Material Request --- erpnext/demo/user/purchase.py | 1 + .../production_planning_tool.py | 2 +- erpnext/setup/setup_wizard/sample_data.py | 1 + .../doctype/material_request/test_records.json | 14 +++++++------- erpnext/stock/reorder_item.py | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/erpnext/demo/user/purchase.py b/erpnext/demo/user/purchase.py index 960a3169cf..82983f0a71 100644 --- a/erpnext/demo/user/purchase.py +++ b/erpnext/demo/user/purchase.py @@ -103,6 +103,7 @@ def make_material_request(item_code, qty): mr.material_request_type = "Purchase" mr.transaction_date = frappe.flags.current_date + mr.schedule_date = frappe.utils.add_days(mr.transaction_date, 7) mr.append("items", { "doctype": "Material Request Item", diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 815e504447..99cf6b3560 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -516,7 +516,7 @@ class ProductionPlanningTool(Document): "transaction_date": nowdate(), "status": "Draft", "company": self.company, - "requested_by": frappe.session.user + "schedule_date": add_days(nowdate(), cint(item_wrapper.lead_time_days)), }) material_request.update({"material_request_type": item_wrapper.default_material_request_type}) diff --git a/erpnext/setup/setup_wizard/sample_data.py b/erpnext/setup/setup_wizard/sample_data.py index bc26e09677..43911f06c1 100644 --- a/erpnext/setup/setup_wizard/sample_data.py +++ b/erpnext/setup/setup_wizard/sample_data.py @@ -73,6 +73,7 @@ def make_material_request(items): mr = frappe.get_doc({ "doctype": "Material Request", "material_request_type": "Purchase", + "schedule_date": frappe.utils.add_days(frappe.utils.nowdate(), 7), "items": [{ "schedule_date": frappe.utils.add_days(frappe.utils.nowdate(), 7), "item_code": i.name, diff --git a/erpnext/stock/doctype/material_request/test_records.json b/erpnext/stock/doctype/material_request/test_records.json index f30958a85b..1c714969eb 100644 --- a/erpnext/stock/doctype/material_request/test_records.json +++ b/erpnext/stock/doctype/material_request/test_records.json @@ -2,7 +2,7 @@ { "company": "_Test Company", "doctype": "Material Request", - "fiscal_year": "_Test Fiscal Year 2013", + "fiscal_year": "_Test Fiscal Year 2013", "items": [ { "description": "_Test Item Home Desktop 100", @@ -11,7 +11,7 @@ "item_name": "_Test Item Home Desktop 100", "parentfield": "items", "qty": 54.0, - "schedule_date": "2013-02-26", + "schedule_date": "2013-02-18", "uom": "_Test UOM 1", "warehouse": "_Test Warehouse - _TC" }, @@ -22,7 +22,7 @@ "item_name": "_Test Item Home Desktop 200", "parentfield": "items", "qty": 3.0, - "schedule_date": "2013-02-25", + "schedule_date": "2013-02-19", "uom": "_Test UOM 1", "warehouse": "_Test Warehouse - _TC" } @@ -30,12 +30,12 @@ "material_request_type": "Purchase", "naming_series": "_T-Material Request-", "transaction_date": "2013-02-18", - "schedule_date": "2013-02-25" + "schedule_date": "2013-02-19" }, { "company": "_Test Company", "doctype": "Material Request", - "fiscal_year": "_Test Fiscal Year 2013", + "fiscal_year": "_Test Fiscal Year 2013", "items": [ { "description": "_Test FG Item", @@ -44,7 +44,7 @@ "item_name": "_Test FG Item", "parentfield": "items", "qty": 5, - "schedule_date": "2013-02-25", + "schedule_date": "2013-02-19", "uom": "_Test UOM 1", "warehouse": "_Test Warehouse - _TC" } @@ -52,6 +52,6 @@ "material_request_type": "Manufacture", "naming_series": "_T-Material Request-", "transaction_date": "2013-02-18", - "schedule_date": "2013-02-25" + "schedule_date": "2013-02-19" } ] \ No newline at end of file diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py index 01a6a6d547..ade6121700 100644 --- a/erpnext/stock/reorder_item.py +++ b/erpnext/stock/reorder_item.py @@ -121,7 +121,8 @@ def create_material_request(material_requests): mr.update({ "company": company, "transaction_date": nowdate(), - "material_request_type": "Material Transfer" if request_type=="Transfer" else request_type + "material_request_type": "Material Transfer" if request_type=="Transfer" else request_type, + "schedule_date": add_days(nowdate(),cint(item.lead_time_days)) }) for d in items: From bf68611567a14fc9e17b98fb2703eb91b53d5dd4 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 26 Sep 2017 11:03:58 +0800 Subject: [PATCH 11/81] clean code --- .../doctype/purchase_order/purchase_order.js | 30 ++++++------------ .../purchase_order/purchase_order.json | 31 ------------------- .../tests/test_purchase_order.js | 18 +---------- .../purchase_order_item.json | 2 +- .../set_schedule_date_for_purchase_order.py | 20 ------------ 5 files changed, 11 insertions(+), 90 deletions(-) delete mode 100644 erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index bbec98174f..a51246bcb8 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -15,8 +15,6 @@ frappe.ui.form.on("Purchase Order", { }, onload: function(frm) { - set_schedule_date(frm); - erpnext.queries.setup_queries(frm, "Warehouse", function() { return erpnext.queries.warehouse(frm.doc); }); @@ -109,7 +107,12 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( }, validate: function() { - set_schedule_date(cur_frm); + // set default schedule date as today if missing. + (this.frm.doc.items || []).forEach(function(d) { + if(!d.schedule_date) { + d.schedule_date = frappe.datetime.nowdate(); + } + }) }, make_stock_entry: function() { @@ -198,10 +201,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( items_add: function(doc, cdt, cdn) { var row = frappe.get_doc(cdt, cdn); - if(doc.schedule_date) { - row.schedule_date = doc.schedule_date; - refresh_field("schedule_date", cdn, "items"); - } + this.frm.script_manager.copy_from_first_row("items", row, ["schedule_date"]); }, unclose_purchase_order: function(){ @@ -225,9 +225,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( cur_frm.cscript.calculate_taxes_and_totals(); } }) - }, - - items_on_form_rendered: set_schedule_date(cur_frm), + } }); @@ -270,18 +268,8 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { } } -function set_schedule_date(frm) { - if(!frm.doc.schedule_date){ - frm.doc.schedule_date = frappe.datetime.add_days(frappe.datetime.now_date(), 1); - } - erpnext.utils.copy_value_in_all_row(frm.doc, frm.doc.doctype, frm.doc.name, "items", "schedule_date"); -} - cur_frm.cscript.schedule_date = function(doc, cdt, cdn) { - var row = frappe.get_doc(cdt, cdn); - if(row.schedule_date){ - set_schedule_date(cur_frm); - } + erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "items", "schedule_date"); } frappe.provide("erpnext.buying"); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 3a64f202ba..b9a5f81cdb 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -292,37 +292,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "", - "fieldname": "schedule_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Reqd By Date", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 6605a65170..e6529e60db 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,18 +13,9 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, - {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, - {"qty": 5}, - {"uom": 'Unit'}, - {"rate": 100}, - {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} - ], - [ - {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, - {"qty": 2}, + {"qty": 5}, {"uom": 'Unit'}, {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} @@ -39,19 +30,12 @@ QUnit.test("test: purchase order", function(assert) { () => { // Get supplier details assert.ok(cur_frm.doc.supplier_name == 'Test Supplier', "Supplier name correct"); - assert.ok(cur_frm.doc.schedule_date == frappe.datetime.add_days(frappe.datetime.now_date(), 1), "Schedule Date correct"); assert.ok($('div.control-value.like-disabled-input.for-description').text().includes('Contact 3'), "Contact display correct"); assert.ok(cur_frm.doc.contact_email == 'test@supplier.com', "Contact email correct"); // Get item details assert.ok(cur_frm.doc.items[0].item_name == 'Test Product 4', "Item name correct"); assert.ok(cur_frm.doc.items[0].description == 'Test Product 4', "Description correct"); assert.ok(cur_frm.doc.items[0].qty == 5, "Quantity correct"); - assert.ok(cur_frm.doc.items[0].schedule_date == frappe.datetime.add_days(frappe.datetime.now_date(), 2), "Schedule Date correct"); - - assert.ok(cur_frm.doc.items[1].item_name == 'Test Product 1', "Item name correct"); - assert.ok(cur_frm.doc.items[1].description == 'Test Product 1', "Description correct"); - assert.ok(cur_frm.doc.items[1].qty == 2, "Quantity correct"); - assert.ok(cur_frm.doc.items[1].schedule_date == cur_frm.doc.schedule_date, "Schedule Date correct"); // Calculate total assert.ok(cur_frm.doc.total == 500, "Total correct"); // Get terms 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 5ba57b6390..c4d86a3aba 100755 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -148,7 +148,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 1, + "in_list_view": 0, "in_standard_filter": 0, "label": "Reqd By Date", "length": 0, diff --git a/erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py b/erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py deleted file mode 100644 index 3c733b1a16..0000000000 --- a/erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py +++ /dev/null @@ -1,20 +0,0 @@ -# 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_doctype("Purchase Order") - frappe.reload_doctype("Purchase Order Item") - - if not frappe.db.has_column("Purchase Order", "schedule_date"): - return - - #Update only submitted PO - for po in frappe.get_all("Purchase Order", filters= [["docstatus", "=", 1]], fields=["name"]): - purchase_order = frappe.get_doc("Purchase Order", po) - if purchase_order.items: - if not purchase_order.schedule_date: - purchase_order.schedule_date = purchase_order.items[0].schedule_date - purchase_order.save() \ No newline at end of file From 73f1c93cd25e1f6465a67ea41e6755bb367a2e9f Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 26 Sep 2017 11:44:10 +0800 Subject: [PATCH 12/81] fix ppt code --- .../doctype/production_planning_tool/production_planning_tool.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 99cf6b3560..73b73b90d8 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -516,6 +516,7 @@ class ProductionPlanningTool(Document): "transaction_date": nowdate(), "status": "Draft", "company": self.company, + "requested_by": frappe.session.user, "schedule_date": add_days(nowdate(), cint(item_wrapper.lead_time_days)), }) material_request.update({"material_request_type": item_wrapper.default_material_request_type}) From 33670bba47db31b58efda21558e17b647449f742 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 26 Sep 2017 12:17:15 +0800 Subject: [PATCH 13/81] fix reorder_item --- erpnext/stock/reorder_item.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py index ade6121700..8da9f110f0 100644 --- a/erpnext/stock/reorder_item.py +++ b/erpnext/stock/reorder_item.py @@ -122,7 +122,7 @@ def create_material_request(material_requests): "company": company, "transaction_date": nowdate(), "material_request_type": "Material Transfer" if request_type=="Transfer" else request_type, - "schedule_date": add_days(nowdate(),cint(item.lead_time_days)) + "schedule_date": add_days(nowdate(), cint(items[0].lead_time_days)) }) for d in items: From 3ec69604780760c769bce2cbdbf79f4b0e0101e7 Mon Sep 17 00:00:00 2001 From: Sunny Date: Thu, 28 Sep 2017 15:26:20 +0800 Subject: [PATCH 14/81] move Material Request patch to v9 --- erpnext/patches/v8_11/__init__.py | 1 - .../{v8_11 => v9_0}/set_schedule_date_for_material_request.py | 0 2 files changed, 1 deletion(-) delete mode 100644 erpnext/patches/v8_11/__init__.py rename erpnext/patches/{v8_11 => v9_0}/set_schedule_date_for_material_request.py (100%) diff --git a/erpnext/patches/v8_11/__init__.py b/erpnext/patches/v8_11/__init__.py deleted file mode 100644 index 8b13789179..0000000000 --- a/erpnext/patches/v8_11/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/erpnext/patches/v8_11/set_schedule_date_for_material_request.py b/erpnext/patches/v9_0/set_schedule_date_for_material_request.py similarity index 100% rename from erpnext/patches/v8_11/set_schedule_date_for_material_request.py rename to erpnext/patches/v9_0/set_schedule_date_for_material_request.py From 4c58588d25227340c382f458bb9984adc3b840cb Mon Sep 17 00:00:00 2001 From: Helkyd Date: Sun, 1 Oct 2017 20:20:57 +0100 Subject: [PATCH 15/81] Improve Salary Register Check if fieldname is a number to format. Start the Html Salary with hidden fields and check if they not empty and increase the width... This will remove Blank fields from the report. --- .../hr/report/salary_register/salary_register.html | 2 +- .../hr/report/salary_register/salary_register.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/report/salary_register/salary_register.html b/erpnext/hr/report/salary_register/salary_register.html index d7bf6a78bc..6c372b7501 100644 --- a/erpnext/hr/report/salary_register/salary_register.html +++ b/erpnext/hr/report/salary_register/salary_register.html @@ -21,7 +21,7 @@ {% for(var i=1, l=report.columns.length; i {% var fieldname = report.columns[i].field; %} - {% if (i > 10) { %} + {% if (!isNaN(row[fieldname])) { %} {%= format_currency(row[fieldname]) %} {% } else { %} {% if (!is_null(row[fieldname])) { %} diff --git a/erpnext/hr/report/salary_register/salary_register.py b/erpnext/hr/report/salary_register/salary_register.py index 88f6f470b1..8b93182d34 100644 --- a/erpnext/hr/report/salary_register/salary_register.py +++ b/erpnext/hr/report/salary_register/salary_register.py @@ -19,6 +19,12 @@ def execute(filters=None): row = [ss.name, ss.employee, ss.employee_name, ss.branch, ss.department, ss.designation, ss.company, ss.start_date, ss.end_date, ss.leave_withut_pay, ss.payment_days] + if not ss.branch == None:columns[3] = columns[3].replace('-1','120') + if not ss.department == None: columns[4] = columns[4].replace('-1','120') + if not ss.designation == None: columns[5] = columns[5].replace('-1','120') + if not ss.leave_withut_pay == None: columns[9] = columns[9].replace('-1','130') + + for e in earning_types: row.append(ss_earning_map.get(ss.name, {}).get(e)) @@ -34,12 +40,20 @@ def execute(filters=None): return columns, data def get_columns(salary_slips): + """ columns = [ _("Salary Slip ID") + ":Link/Salary Slip:150",_("Employee") + ":Link/Employee:120", _("Employee Name") + "::140", _("Branch") + ":Link/Branch:120", _("Department") + ":Link/Department:120", _("Designation") + ":Link/Designation:120", _("Company") + ":Link/Company:120", _("Start Date") + "::80", _("End Date") + "::80", _("Leave Without Pay") + ":Float:130", _("Payment Days") + ":Float:120" ] + """ + columns = [ + _("Salary Slip ID") + ":Link/Salary Slip:150",_("Employee") + ":Link/Employee:120", _("Employee Name") + "::140", _("Branch") + ":Link/Branch:-1", + _("Department") + ":Link/Department:-1", _("Designation") + ":Link/Designation:-1", + _("Company") + ":Link/Company:120", _("Start Date") + "::80", _("End Date") + "::80", _("Leave Without Pay") + ":Float:-1", + _("Payment Days") + ":Float:120" + ] salary_components = {_("Earning"): [], _("Deduction"): []} From bb03ec103b736ffd12148520d884609ca1be2ca9 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 01:03:12 +0800 Subject: [PATCH 16/81] Add Purchase Order schedule_date field, similar to delivery_date in Sales Order --- .../doctype/purchase_order/purchase_order.js | 42 ++++++++++++++----- .../purchase_order/purchase_order.json | 33 ++++++++++++++- .../tests/test_purchase_order.js | 18 +++++++- .../purchase_order_item.json | 2 +- 4 files changed, 82 insertions(+), 13 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 8134e7e701..2e5c74094e 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -1,4 +1,3 @@ - // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt @@ -16,6 +15,8 @@ frappe.ui.form.on("Purchase Order", { }, onload: function(frm) { + set_schedule_date(frm); + erpnext.queries.setup_queries(frm, "Warehouse", function() { return erpnext.queries.warehouse(frm.doc); }); @@ -120,12 +121,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( }, validate: function() { - // set default schedule date as today if missing. - (this.frm.doc.items || []).forEach(function(d) { - if(!d.schedule_date) { - d.schedule_date = frappe.datetime.nowdate(); - } - }) + set_schedule_date(cur_frm); }, make_stock_entry: function() { @@ -214,7 +210,10 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( items_add: function(doc, cdt, cdn) { var row = frappe.get_doc(cdt, cdn); - this.frm.script_manager.copy_from_first_row("items", row, ["schedule_date"]); + if(doc.schedule_date) { + row.schedule_date = doc.schedule_date; + refresh_field("schedule_date", cdn, "items"); + } }, unclose_purchase_order: function(){ @@ -227,7 +226,20 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( delivered_by_supplier: function(){ cur_frm.cscript.update_status('Deliver', 'Delivered') - } + }, + + get_last_purchase_rate: function() { + frappe.call({ + "method": "get_last_purchase_rate", + "doc": cur_frm.doc, + callback: function(r, rt) { + cur_frm.dirty(); + cur_frm.cscript.calculate_taxes_and_totals(); + } + }) + }, + + items_on_form_rendered: set_schedule_date(cur_frm), }); @@ -270,8 +282,18 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { } } +function set_schedule_date(frm) { + if(!frm.doc.schedule_date){ + frm.doc.schedule_date = frappe.datetime.add_days(frappe.datetime.now_date(), 1); + } + erpnext.utils.copy_value_in_all_row(frm.doc, frm.doc.doctype, frm.doc.name, "items", "schedule_date"); +} + cur_frm.cscript.schedule_date = function(doc, cdt, cdn) { - erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "items", "schedule_date"); + var row = frappe.get_doc(cdt, cdn); + if(row.schedule_date){ + set_schedule_date(cur_frm); + } } frappe.provide("erpnext.buying"); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 07a80b87bd..43b4a55dbd 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -291,7 +291,38 @@ "search_index": 1, "set_only_once": 0, "unique": 0 - }, + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Today", + "fieldname": "schedule_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reqd By Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index e6529e60db..a818992db3 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,12 +13,21 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} + ], + [ + {"item_code": 'Test Product 1'}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, + {"qty": 2}, + {"uom": 'Unit'}, + {"rate": 100}, + {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ] ]}, @@ -30,12 +39,19 @@ QUnit.test("test: purchase order", function(assert) { () => { // Get supplier details assert.ok(cur_frm.doc.supplier_name == 'Test Supplier', "Supplier name correct"); + assert.ok(cur_frm.doc.schedule_date == frappe.datetime.add_days(frappe.datetime.now_date(), 1), "Schedule Date correct"); assert.ok($('div.control-value.like-disabled-input.for-description').text().includes('Contact 3'), "Contact display correct"); assert.ok(cur_frm.doc.contact_email == 'test@supplier.com', "Contact email correct"); // Get item details assert.ok(cur_frm.doc.items[0].item_name == 'Test Product 4', "Item name correct"); assert.ok(cur_frm.doc.items[0].description == 'Test Product 4', "Description correct"); assert.ok(cur_frm.doc.items[0].qty == 5, "Quantity correct"); + assert.ok(cur_frm.doc.items[0].schedule_date == frappe.datetime.add_days(frappe.datetime.now_date(), 2), "Schedule Date correct"); + + assert.ok(cur_frm.doc.items[1].item_name == 'Test Product 1', "Item name correct"); + assert.ok(cur_frm.doc.items[1].description == 'Test Product 1', "Description correct"); + assert.ok(cur_frm.doc.items[1].qty == 2, "Quantity correct"); + assert.ok(cur_frm.doc.items[1].schedule_date == cur_frm.doc.schedule_date, "Schedule Date correct"); // Calculate total assert.ok(cur_frm.doc.total == 500, "Total correct"); // Get terms 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 1ddce628a2..45a6c7296a 100755 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json @@ -148,7 +148,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 0, + "in_list_view": 1, "in_standard_filter": 0, "label": "Reqd By Date", "length": 0, From 9d497a984bd282e11be0d4061a072a126485657c Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 10:54:45 +0800 Subject: [PATCH 17/81] [fix] Codacy errors --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index a818992db3..6605a65170 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -20,7 +20,7 @@ QUnit.test("test: purchase order", function(assert) { {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From 9da25f568d1a3db829a6a3c92e83ff0131b66951 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 11:05:36 +0800 Subject: [PATCH 18/81] Set PO Reqd By Date default in code, to next date --- erpnext/buying/doctype/purchase_order/purchase_order.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 43b4a55dbd..83bd323733 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -298,7 +298,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "Today", + "default": "", "fieldname": "schedule_date", "fieldtype": "Date", "hidden": 0, From 2315a79b5f02fa7d7a7e69809f656d60277b939a Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 01:03:12 +0800 Subject: [PATCH 19/81] Add Purchase Order schedule_date field, similar to delivery_date in Sales Order --- erpnext/buying/doctype/purchase_order/purchase_order.json | 2 +- .../doctype/purchase_order/tests/test_purchase_order.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 83bd323733..2abd5c3fcb 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -324,7 +324,7 @@ "unique": 0 }, { - "allow_bulk_edit": 0, + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 6605a65170..966238cb87 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,14 +13,14 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From c429a6e688e060109ea5b49a3ef90273cdeac49d Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 10:54:45 +0800 Subject: [PATCH 20/81] [fix] Codacy errors --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 966238cb87..ffc6874de3 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -20,7 +20,7 @@ QUnit.test("test: purchase order", function(assert) { {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From 9626ed79fa8834c7f2e91ca22b657137ce1c0f78 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 14:28:42 +0800 Subject: [PATCH 21/81] Add patch to update schedule date of submitted Purchase Orders --- erpnext/patches/v8_11/__init__.py | 0 .../set_schedule_date_for_purchase_order.py | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 erpnext/patches/v8_11/__init__.py create mode 100644 erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py diff --git a/erpnext/patches/v8_11/__init__.py b/erpnext/patches/v8_11/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py b/erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py new file mode 100644 index 0000000000..3c733b1a16 --- /dev/null +++ b/erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py @@ -0,0 +1,20 @@ +# 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_doctype("Purchase Order") + frappe.reload_doctype("Purchase Order Item") + + if not frappe.db.has_column("Purchase Order", "schedule_date"): + return + + #Update only submitted PO + for po in frappe.get_all("Purchase Order", filters= [["docstatus", "=", 1]], fields=["name"]): + purchase_order = frappe.get_doc("Purchase Order", po) + if purchase_order.items: + if not purchase_order.schedule_date: + purchase_order.schedule_date = purchase_order.items[0].schedule_date + purchase_order.save() \ No newline at end of file From e3ed8b7cb32f3bc3807505e2a945eb6308225ef8 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 14:54:50 +0800 Subject: [PATCH 22/81] [fix] tests --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index ffc6874de3..6605a65170 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,7 +13,7 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, From f29969a5cc674d7302ff549b6d1cdfb1c74d9121 Mon Sep 17 00:00:00 2001 From: schilgod Date: Mon, 25 Sep 2017 21:21:56 +0800 Subject: [PATCH 23/81] update test records --- erpnext/buying/doctype/purchase_order/test_records.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/test_records.json b/erpnext/buying/doctype/purchase_order/test_records.json index 2c2e792176..74b8f1b429 100644 --- a/erpnext/buying/doctype/purchase_order/test_records.json +++ b/erpnext/buying/doctype/purchase_order/test_records.json @@ -30,7 +30,8 @@ ], "supplier": "_Test Supplier", "supplier_name": "_Test Supplier", - "transaction_date": "2013-02-12" + "transaction_date": "2013-02-12", + "schedule_date": "2013-02-13" }, { "advance_paid": 0.0, @@ -63,6 +64,7 @@ ], "supplier": "_Test Supplier", "supplier_name": "_Test Supplier", - "transaction_date": "2013-02-12" + "transaction_date": "2013-02-12", + "schedule_date": "2013-02-13" } ] From 69e88ffa39881e0f9741860fe475575a6284ddd9 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 01:03:12 +0800 Subject: [PATCH 24/81] Add Purchase Order schedule_date field, similar to delivery_date in Sales Order --- erpnext/buying/doctype/purchase_order/purchase_order.json | 2 +- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 2abd5c3fcb..dedac4241b 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -298,7 +298,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "", + "default": "Today", "fieldname": "schedule_date", "fieldtype": "Date", "hidden": 0, diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 6605a65170..a818992db3 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -20,7 +20,7 @@ QUnit.test("test: purchase order", function(assert) { {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From 0f73f90fa2b7b6fbbb70faf827f4155f2f34ecca Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 10:54:45 +0800 Subject: [PATCH 25/81] [fix] Codacy errors --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index a818992db3..6605a65170 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -20,7 +20,7 @@ QUnit.test("test: purchase order", function(assert) { {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From 962cef470a6fcba7f52bf35f39303bb60bb073f4 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 11:05:36 +0800 Subject: [PATCH 26/81] Set PO Reqd By Date default in code, to next date --- erpnext/buying/doctype/purchase_order/purchase_order.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index dedac4241b..2abd5c3fcb 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -298,7 +298,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "Today", + "default": "", "fieldname": "schedule_date", "fieldtype": "Date", "hidden": 0, From 122981d465378a455f7b72e5a66bf20ddc4068c2 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 01:03:12 +0800 Subject: [PATCH 27/81] Add Purchase Order schedule_date field, similar to delivery_date in Sales Order --- .../doctype/purchase_order/tests/test_purchase_order.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 6605a65170..966238cb87 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,14 +13,14 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From bd121486a8d726510bbe30597f8b51aa519357b6 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 10:54:45 +0800 Subject: [PATCH 28/81] [fix] Codacy errors --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 966238cb87..ffc6874de3 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -20,7 +20,7 @@ QUnit.test("test: purchase order", function(assert) { {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From f07e53b7a8cf9cc6d49312d5e2a287e6fd624a44 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 14:54:50 +0800 Subject: [PATCH 29/81] [fix] tests --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index ffc6874de3..6605a65170 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,7 +13,7 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, From 3a22fd15353c036006c84f1f1bc52f3e68866eb3 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 26 Sep 2017 12:21:41 +0800 Subject: [PATCH 30/81] Add schedule_date when creating Purchase Order --- erpnext/buying/doctype/purchase_order/test_purchase_order.py | 1 + erpnext/demo/user/purchase.py | 1 + 2 files changed, 2 insertions(+) diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index 17786aa443..500fc37966 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -149,6 +149,7 @@ def create_purchase_order(**args): if args.transaction_date: po.transaction_date = args.transaction_date + po.schedule_date = add_days(nowdate(), 1) po.company = args.company or "_Test Company" po.supplier = args.customer or "_Test Supplier" po.is_subcontracted = args.is_subcontracted or "No" diff --git a/erpnext/demo/user/purchase.py b/erpnext/demo/user/purchase.py index 960a3169cf..6129bf9f51 100644 --- a/erpnext/demo/user/purchase.py +++ b/erpnext/demo/user/purchase.py @@ -128,6 +128,7 @@ def make_subcontract(): po = frappe.new_doc("Purchase Order") po.is_subcontracted = "Yes" po.supplier = get_random("Supplier") + po.schedule_date = frappe.utils.add_days(frappe.flags.current_date, 7) item_code = get_random("Item", {"is_sub_contracted_item": 1}) From f2e2e23b6b293f3de24333bb90d6394e07a6ea64 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 26 Sep 2017 13:35:04 +0800 Subject: [PATCH 31/81] [fix] tests --- .../tests/test_purchase_order_with_taxes_and_charges.js | 1 + erpnext/stock/doctype/material_request/test_material_request.py | 1 + 2 files changed, 2 insertions(+) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js index 9d87af2342..27129fb3b8 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_taxes_and_charges.js @@ -11,6 +11,7 @@ QUnit.test("test: purchase order with taxes and charges", function(assert) { {is_subcontracted: 'No'}, {buying_price_list: 'Test-Buying-USD'}, {currency: 'USD'}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {items: [ [ {"item_code": 'Test Product 4'}, diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py index 1531f4096e..709b8c720c 100644 --- a/erpnext/stock/doctype/material_request/test_material_request.py +++ b/erpnext/stock/doctype/material_request/test_material_request.py @@ -206,6 +206,7 @@ class TestMaterialRequest(unittest.TestCase): po_doc = make_purchase_order(mr.name) po_doc.supplier = "_Test Supplier" po_doc.transaction_date = "2013-07-07" + po_doc.schedule_date = "2013-07-09" po_doc.get("items")[0].qty = 27.0 po_doc.get("items")[1].qty = 1.5 po_doc.get("items")[0].schedule_date = "2013-07-09" From 869b878286cf26937124d8640103a54572bd744d Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 26 Sep 2017 14:42:49 +0800 Subject: [PATCH 32/81] set schedule_Date when creating po --- erpnext/buying/doctype/purchase_order/purchase_order.json | 2 +- erpnext/buying/doctype/purchase_order/test_purchase_order.py | 1 + .../buying/doctype/supplier_quotation/supplier_quotation.py | 3 ++- erpnext/selling/doctype/sales_order/sales_order.py | 3 ++- erpnext/stock/doctype/material_request/material_request.py | 4 +++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 2abd5c3fcb..3afbb33d76 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -3458,7 +3458,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-09-22 16:11:49.856808", + "modified": "2017-09-26 14:19:04.102534", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index 500fc37966..175fb931bc 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -118,6 +118,7 @@ class TestPurchaseOrder(unittest.TestCase): "company": "_Test Company", "supplier" : "_Test Supplier", "is_subcontracted" : "No", + "schedule_Date": add_days(nowdate(), 1), "currency" : frappe.db.get_value("Company", "_Test Company", "default_currency"), "conversion_factor" : 1, "items" : get_same_items(), diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py index b3d92be4b6..055ac0bab6 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe from frappe import _ -from frappe.utils import flt +from frappe.utils import flt, nowdate, add_days from frappe.model.mapper import get_mapped_doc from erpnext.controllers.buying_controller import BuyingController @@ -104,6 +104,7 @@ def get_list_context(context=None): def make_purchase_order(source_name, target_doc=None): def set_missing_values(source, target): target.ignore_pricing_rule = 1 + target.schedule_Date = add_days(nowdate(), 1) target.run_method("set_missing_values") target.run_method("get_schedule_dates") target.run_method("calculate_taxes_and_totals") diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 8720482549..219462f9c9 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe import json import frappe.utils -from frappe.utils import cstr, flt, getdate, comma_and, cint +from frappe.utils import cstr, flt, getdate, comma_and, cint, nowdate, add_days from frappe import _ from frappe.model.utils import get_fetch_values from frappe.model.mapper import get_mapped_doc @@ -658,6 +658,7 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc= target.apply_discount_on = "" target.additional_discount_percentage = 0.0 target.discount_amount = 0.0 + target.schedule_date = add_days(nowdate(), 1) default_price_list = frappe.get_value("Supplier", for_supplier, "default_price_list") if default_price_list: diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 65263a0694..3d0a086308 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -7,7 +7,7 @@ from __future__ import unicode_literals import frappe -from frappe.utils import cstr, flt, getdate, new_line_sep +from frappe.utils import cstr, flt, getdate, new_line_sep, nowdate, add_days from frappe import msgprint, _ from frappe.model.mapper import get_mapped_doc from erpnext.stock.stock_balance import update_bin_qty, get_indented_qty @@ -228,6 +228,7 @@ def update_item(obj, target, source_parent): @frappe.whitelist() def make_purchase_order(source_name, target_doc=None): def postprocess(source, target_doc): + target_doc.schedule_Date = add_days(nowdate(), 1) set_missing_values(source, target_doc) doclist = get_mapped_doc("Material Request", source_name, { @@ -287,6 +288,7 @@ def make_purchase_order_based_on_supplier(source_name, target_doc=None): def postprocess(source, target_doc): target_doc.supplier = source_name + target_doc.schedule_Date = add_days(nowdate(), 1) target_doc.set("items", [d for d in target_doc.get("items") if d.get("item_code") in supplier_items and d.get("qty") > 0]) From 47eac28f0a1d030c8deea085e004e2d00e12452e Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 01:03:12 +0800 Subject: [PATCH 33/81] Add Purchase Order schedule_date field, similar to delivery_date in Sales Order --- erpnext/buying/doctype/purchase_order/purchase_order.json | 2 +- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 3afbb33d76..067640360d 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -3458,7 +3458,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-09-26 14:19:04.102534", + "modified": "2017-09-26 14:19:04.102534", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 6605a65170..a818992db3 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -20,7 +20,7 @@ QUnit.test("test: purchase order", function(assert) { {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From 34a8fb410063475c011171ea894a0b11e2ab7288 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 10:54:45 +0800 Subject: [PATCH 34/81] [fix] Codacy errors --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index a818992db3..6605a65170 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -20,7 +20,7 @@ QUnit.test("test: purchase order", function(assert) { {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From c2befc59d19e68dbf9f81ea28d5d125342dee193 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 01:03:12 +0800 Subject: [PATCH 35/81] Add Purchase Order schedule_date field, similar to delivery_date in Sales Order --- .../doctype/purchase_order/tests/test_purchase_order.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 6605a65170..966238cb87 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,14 +13,14 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From 9ded8a7290068e064dc96f19fb6e0cfcb23db98e Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 10:54:45 +0800 Subject: [PATCH 36/81] [fix] Codacy errors --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 966238cb87..ffc6874de3 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -20,7 +20,7 @@ QUnit.test("test: purchase order", function(assert) { {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From 73f4eef40ff493b8635b9a31891ede6015ef1159 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 14:54:50 +0800 Subject: [PATCH 37/81] [fix] tests --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index ffc6874de3..6605a65170 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,7 +13,7 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, From 0f2b21f88bf32256e7b022f24df389da596eab4b Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 01:03:12 +0800 Subject: [PATCH 38/81] Add Purchase Order schedule_date field, similar to delivery_date in Sales Order --- .../doctype/purchase_order/tests/test_purchase_order.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 6605a65170..966238cb87 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,14 +13,14 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From a456901e9fa210ac2f5352da379f096725fd42dc Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 10:54:45 +0800 Subject: [PATCH 39/81] [fix] Codacy errors --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index 966238cb87..ffc6874de3 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -20,7 +20,7 @@ QUnit.test("test: purchase order", function(assert) { {"rate": 100}, {"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))} ], - [ + [ {"item_code": 'Test Product 1'}, {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, From b387b3cca0a665784a848929971c4533958bf502 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 25 Sep 2017 14:54:50 +0800 Subject: [PATCH 40/81] [fix] tests --- .../buying/doctype/purchase_order/tests/test_purchase_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js index ffc6874de3..6605a65170 100644 --- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js @@ -13,7 +13,7 @@ QUnit.test("test: purchase order", function(assert) { {items: [ [ {"item_code": 'Test Product 4'}, - {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)}, + {"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 2)}, {"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)}, {"qty": 5}, {"uom": 'Unit'}, From c6f25ba996e941f9e6e165904fab63ab2a53c5ef Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 26 Sep 2017 17:03:37 +0800 Subject: [PATCH 41/81] correct field name --- erpnext/buying/doctype/purchase_order/test_purchase_order.py | 2 +- .../buying/doctype/supplier_quotation/supplier_quotation.py | 2 +- erpnext/stock/doctype/material_request/material_request.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py index 175fb931bc..2af55825d4 100644 --- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py @@ -118,7 +118,7 @@ class TestPurchaseOrder(unittest.TestCase): "company": "_Test Company", "supplier" : "_Test Supplier", "is_subcontracted" : "No", - "schedule_Date": add_days(nowdate(), 1), + "schedule_date": add_days(nowdate(), 1), "currency" : frappe.db.get_value("Company", "_Test Company", "default_currency"), "conversion_factor" : 1, "items" : get_same_items(), diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py index 055ac0bab6..e93622338f 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py @@ -104,7 +104,7 @@ def get_list_context(context=None): def make_purchase_order(source_name, target_doc=None): def set_missing_values(source, target): target.ignore_pricing_rule = 1 - target.schedule_Date = add_days(nowdate(), 1) + target.schedule_date = add_days(nowdate(), 1) target.run_method("set_missing_values") target.run_method("get_schedule_dates") target.run_method("calculate_taxes_and_totals") diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 3d0a086308..5719378c2b 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -228,7 +228,7 @@ def update_item(obj, target, source_parent): @frappe.whitelist() def make_purchase_order(source_name, target_doc=None): def postprocess(source, target_doc): - target_doc.schedule_Date = add_days(nowdate(), 1) + target_doc.schedule_date = add_days(nowdate(), 1) set_missing_values(source, target_doc) doclist = get_mapped_doc("Material Request", source_name, { @@ -288,7 +288,7 @@ def make_purchase_order_based_on_supplier(source_name, target_doc=None): def postprocess(source, target_doc): target_doc.supplier = source_name - target_doc.schedule_Date = add_days(nowdate(), 1) + target_doc.schedule_date = add_days(nowdate(), 1) target_doc.set("items", [d for d in target_doc.get("items") if d.get("item_code") in supplier_items and d.get("qty") > 0]) From 42c74a63655ba9d2a027dca6ed780b146e8ee7e2 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 26 Sep 2017 17:47:23 +0800 Subject: [PATCH 42/81] set schedule_date when creating po --- erpnext/stock/doctype/material_request/material_request.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 5719378c2b..4792fca2b4 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -288,7 +288,6 @@ def make_purchase_order_based_on_supplier(source_name, target_doc=None): def postprocess(source, target_doc): target_doc.supplier = source_name - target_doc.schedule_date = add_days(nowdate(), 1) target_doc.set("items", [d for d in target_doc.get("items") if d.get("item_code") in supplier_items and d.get("qty") > 0]) From 38647ed832384273717491753bc08dd6a2bbcdcd Mon Sep 17 00:00:00 2001 From: Sunny Date: Thu, 28 Sep 2017 15:03:05 +0800 Subject: [PATCH 43/81] move Purchase Order patch to v9 --- erpnext/patches.txt | 1 + erpnext/patches/v8_11/__init__.py | 0 .../{v8_11 => v9_0}/set_schedule_date_for_purchase_order.py | 0 erpnext/stock/doctype/material_request/material_request.py | 2 +- 4 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 erpnext/patches/v8_11/__init__.py rename erpnext/patches/{v8_11 => v9_0}/set_schedule_date_for_purchase_order.py (100%) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index e75c490a36..f14980447c 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -448,3 +448,4 @@ erpnext.patches.v8_9.remove_employee_from_salary_structure_parent erpnext.patches.v8_9.delete_gst_doctypes_for_outside_india_accounts erpnext.patches.v8_9.set_default_fields_in_variant_settings erpnext.patches.v8_9.update_billing_gstin_for_indian_account +erpnext.patches.v9_0.set_schedule_date_for_purchase_order \ No newline at end of file diff --git a/erpnext/patches/v8_11/__init__.py b/erpnext/patches/v8_11/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py b/erpnext/patches/v9_0/set_schedule_date_for_purchase_order.py similarity index 100% rename from erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py rename to erpnext/patches/v9_0/set_schedule_date_for_purchase_order.py diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 4792fca2b4..f8985128b6 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -288,7 +288,7 @@ def make_purchase_order_based_on_supplier(source_name, target_doc=None): def postprocess(source, target_doc): target_doc.supplier = source_name - + target_doc.schedule_date = add_days(nowdate(), 1) target_doc.set("items", [d for d in target_doc.get("items") if d.get("item_code") in supplier_items and d.get("qty") > 0]) From c4e52e5f95c0c2247ebcf998a30132454e5cd73f Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 2 Oct 2017 20:57:08 +0530 Subject: [PATCH 44/81] [Fix] Old invoice payment amount showing in the payment modal while making payment --- .../page/point_of_sale/point_of_sale.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index f9045b5454..5eb822621e 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -99,6 +99,17 @@ erpnext.pos.PointOfSale = class PointOfSale { if (value == 'Pay') { if (!this.payment) { this.make_payment_modal(); + } else { + const mop_field = this.payment.default_mop; + let amount = 0.0; + this.frm.doc.payments.map(p => { + if (p.mode_of_payment == mop_field) { + amount = p.amount; + return; + } + }); + + this.payment.dialog.set_value(mop_field, flt(amount)); } this.payment.open_modal(); } @@ -437,6 +448,12 @@ class POSCart { this.$taxes_and_totals.html(this.get_taxes_and_totals()); this.numpad && this.numpad.reset_value(); this.customer_field.set_value(""); + + this.wrapper.find('.grand-total-value').text( + format_currency(this.frm.doc.grand_total, this.frm.currency)); + + const customer = this.frm.doc.customer || this.pos_profile.customer; + this.customer_field.set_value(customer); } get_grand_total() { @@ -1179,6 +1196,10 @@ class Payment { const me = this; let fields = this.frm.doc.payments.map(p => { + if (p.default) { + this.default_mop = p.mode_of_payment; + } + return { fieldtype: 'Currency', label: __(p.mode_of_payment), From 445e8a2e571c3d03186f3a9780d3bf7ef5c9d21f Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 3 Oct 2017 17:28:50 +0530 Subject: [PATCH 45/81] [Fix] Subscription end date, cancel issue, added from and to date --- .../doctype/subscription/subscription.json | 261 +++++++++++------- .../doctype/subscription/subscription.py | 55 +++- erpnext/patches.txt | 3 +- .../v9_0/fix_subscription_next_date.py | 27 ++ 4 files changed, 242 insertions(+), 104 deletions(-) create mode 100644 erpnext/patches/v9_0/fix_subscription_next_date.py diff --git a/erpnext/accounts/doctype/subscription/subscription.json b/erpnext/accounts/doctype/subscription/subscription.json index 85779533ea..fe41b42d9a 100644 --- a/erpnext/accounts/doctype/subscription/subscription.json +++ b/erpnext/accounts/doctype/subscription/subscription.json @@ -135,66 +135,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "disabled", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Disabled", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "submit_on_creation", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Submit on Creation", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -286,12 +226,12 @@ }, { "allow_bulk_edit": 0, - "allow_on_submit": 1, + "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "next_schedule_date", - "fieldtype": "Date", + "fieldname": "submit_on_creation", + "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -299,14 +239,44 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Next Schedule Date", + "label": "Submit on Creation", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "disabled", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Disabled", "length": 0, "no_copy": 1, "permlevel": 0, "precision": "", - "print_hide": 1, + "print_hide": 0, "print_hide_if_no_value": 0, - "read_only": 1, + "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, @@ -320,7 +290,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "frequency_detail", + "fieldname": "section_break_10", "fieldtype": "Section Break", "hidden": 0, "ignore_user_permissions": 0, @@ -329,7 +299,95 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "from_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "From Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "to_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "To Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_13", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -375,35 +433,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_12", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 1, @@ -435,6 +464,36 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "next_schedule_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Next Schedule Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -690,7 +749,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-09-14 12:09:38.471458", + "modified": "2017-10-03 17:20:26.919630", "modified_by": "Administrator", "module": "Accounts", "name": "Subscription", @@ -700,7 +759,7 @@ { "amend": 0, "apply_user_permissions": 0, - "cancel": 0, + "cancel": 1, "create": 1, "delete": 1, "email": 1, @@ -720,7 +779,7 @@ { "amend": 0, "apply_user_permissions": 0, - "cancel": 0, + "cancel": 1, "create": 1, "delete": 1, "email": 1, @@ -740,7 +799,7 @@ { "amend": 0, "apply_user_permissions": 0, - "cancel": 0, + "cancel": 1, "create": 1, "delete": 1, "email": 1, diff --git a/erpnext/accounts/doctype/subscription/subscription.py b/erpnext/accounts/doctype/subscription/subscription.py index c9df7d461e..352a0aa87c 100644 --- a/erpnext/accounts/doctype/subscription/subscription.py +++ b/erpnext/accounts/doctype/subscription/subscription.py @@ -9,7 +9,7 @@ from frappe import _ from frappe.desk.form import assign_to from dateutil.relativedelta import relativedelta from frappe.utils.user import get_system_managers -from frappe.utils import cstr, getdate, split_emails, add_days, today +from frappe.utils import cstr, getdate, split_emails, add_days, today, get_last_day, get_first_day from frappe.model.document import Document month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12} @@ -24,12 +24,23 @@ class Subscription(Document): self.set_next_schedule_date() def on_submit(self): - self.update_subscription_id() + # self.update_subscription_id() + self.update_subscription_data() def on_update_after_submit(self): + self.update_subscription_data() self.validate_dates() self.set_next_schedule_date() + def before_cancel(self): + self.unlink_subscription_id() + + def unlink_subscription_id(self): + doc = frappe.get_doc(self.reference_doctype, self.reference_document) + if doc.meta.get_field('subscription'): + doc.subscription = None + doc.db_update() + def validate_dates(self): if self.end_date and getdate(self.start_date) > getdate(self.end_date): frappe.throw(_("End date must be greater than start date")) @@ -64,6 +75,21 @@ class Subscription(Document): self.next_schedule_date = get_next_schedule_date(self.start_date, self.frequency, self.repeat_on_day) + def update_subscription_data(self): + update_doc = False + doc = frappe.get_doc(self.reference_doctype, self.reference_document) + if frappe.get_meta(self.reference_doctype).get_field("from_date"): + doc.from_date = self.from_date + doc.to_date = self.to_date + update_doc = True + + if not doc.subscription: + doc.subscription = self.name + update_doc = True + + if update_doc: + doc.db_update() + def update_subscription_id(self): doc = frappe.get_doc(self.reference_doctype, self.reference_document) if not doc.meta.get_field('subscription'): @@ -112,6 +138,9 @@ def get_subscription_entries(date): def create_documents(data, schedule_date): try: doc = make_new_document(data, schedule_date) + if doc.from_date: + update_subscription_period(data, doc) + if data.notify_by_email and data.recipients: print_format = data.print_format or "Standard" send_notification(doc, print_format, data.recipients) @@ -126,6 +155,13 @@ def create_documents(data, schedule_date): if data.reference_document and not frappe.flags.in_test: notify_error_to_user(data) +def update_subscription_period(data, doc): + from_date = doc.from_date + to_date = doc.to_date + + frappe.db.set_value('Subscription', data.name, 'from_date', from_date) + frappe.db.set_value('Subscription', data.name, 'to_date', to_date) + def disabled_subscription(data): subscription = frappe.get_doc('Subscription', data.name) subscription.db_set('disabled', 1) @@ -160,9 +196,24 @@ def update_doc(new_document, reference_doc, args, schedule_date): if new_document.meta.get_field('set_posting_time'): new_document.set('set_posting_time', 1) + mcount = month_map.get(args.frequency) + if new_document.meta.get_field('subscription'): new_document.set('subscription', args.name) + if args.from_date and args.to_date: + from_date = get_next_date(args.from_date, mcount) + + if (cstr(get_first_day(args.from_date)) == cstr(args.from_date)) and \ + (cstr(get_last_day(args.to_date)) == cstr(args.to_date)): + to_date = get_last_day(get_next_date(args.to_date, mcount)) + else: + to_date = get_next_date(args.to_date, mcount) + + if new_document.meta.get_field('from_date'): + new_document.set('from_date', from_date) + new_document.set('to_date', to_date) + new_document.run_method("on_recurring", reference_doc=reference_doc, subscription_doc=args) for data in new_document.meta.fields: if data.fieldtype == 'Date' and data.reqd: diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 95adfd8f9c..e6db17352d 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -445,4 +445,5 @@ erpnext.patches.v8_9.set_print_zero_amount_taxes erpnext.patches.v8_9.set_default_customer_group erpnext.patches.v8_9.remove_employee_from_salary_structure_parent erpnext.patches.v8_9.delete_gst_doctypes_for_outside_india_accounts -erpnext.patches.v8_9.update_billing_gstin_for_indian_account \ No newline at end of file +erpnext.patches.v8_9.update_billing_gstin_for_indian_account +erpnext.patches.v9_0.fix_subscription_next_date \ No newline at end of file diff --git a/erpnext/patches/v9_0/fix_subscription_next_date.py b/erpnext/patches/v9_0/fix_subscription_next_date.py new file mode 100644 index 0000000000..a36e60ccaa --- /dev/null +++ b/erpnext/patches/v9_0/fix_subscription_next_date.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_doctype('Subscription') + + doctypes = ('Purchase Order', 'Sales Order', 'Purchase Invoice', 'Sales Invoice') + for data in frappe.get_all('Subscription', fields = ["name", "reference_doctype", "reference_document"], + filters = {'reference_doctype': ('in', doctypes)}): + doc = frappe.get_doc('Subscription', data.name) + fields = ['transaction_date'] + if doc.reference_doctype in ['Sales Invoice', 'Purchase Invoice']: + fields = ['posting_date'] + + fields.extend(['from_date', 'to_date']) + reference_data = frappe.db.get_value(data.reference_doctype, + data.reference_document, fields, as_dict=1) + + if reference_data: + doc.start_date = reference_data.get('posting_date') or reference_data.get('transaction_date') + doc.from_date = reference_data.get('from_date') + doc.to_date = reference_data.get('to_date') + doc.set_next_schedule_date() + doc.db_update() \ No newline at end of file From e3a468ed1b3123b9a11675f87b2a23fa4751def6 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 3 Oct 2017 18:30:31 +0600 Subject: [PATCH 46/81] bumped to version 9.0.7 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 405274a144..edbd9a25be 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from erpnext.hooks import regional_overrides -__version__ = '9.0.6' +__version__ = '9.0.7' def get_default_company(user=None): '''Get default company for user''' From d17bea0a31419336a48a3eeccd60cc381f54c1ab Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Wed, 4 Oct 2017 14:30:12 +0530 Subject: [PATCH 47/81] [hotfix] check minimum actual start time and actual end time before updating PO Operations (#11041) * [hotfix] check minimum actual start time and actual end time before updating PO Operations * Update production_order.py --- .../doctype/production_order/production_order.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index f04fddfae3..f4d37760d3 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -370,8 +370,13 @@ class ProductionOrder(Document): self.actual_start_date = None self.actual_end_date = None if self.get("operations"): - self.actual_start_date = min([d.actual_start_time for d in self.get("operations") if d.actual_start_time]) - self.actual_end_date = max([d.actual_end_time for d in self.get("operations") if d.actual_end_time]) + actual_start_dates = [d.actual_start_time for d in self.get("operations") if d.actual_start_time] + if actual_start_dates: + self.actual_start_date = min(actual_start_dates) + + actual_end_dates = [d.actual_end_time for d in self.get("operations") if d.actual_end_time] + if actual_end_dates: + self.actual_end_date = max(actual_end_dates) def delete_timesheet(self): for timesheet in frappe.get_all("Timesheet", ["name"], {"production_order": self.name}): @@ -621,4 +626,4 @@ def stop_unstop(production_order, status): frappe.msgprint(_("Production Order has been {0}").format(status)) pro_order.notify_update() - return pro_order.status \ No newline at end of file + return pro_order.status From 5049edb494b55bbf3ff63e600d049b2645d9255a Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 4 Oct 2017 14:33:12 +0530 Subject: [PATCH 48/81] [Fix] Discount and serial no search issue (#11040) --- .../page/point_of_sale/point_of_sale.js | 34 ++++++++++++++----- .../page/point_of_sale/point_of_sale.py | 19 ++++++++--- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index 5eb822621e..1b0b9eb392 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -763,28 +763,41 @@ class POSCart { // }); this.wrapper.find('.additional_discount_percentage').on('change', (e) => { + const discount_percentage = flt(e.target.value, + precision("additional_discount_percentage")); + frappe.model.set_value(this.frm.doctype, this.frm.docname, - 'additional_discount_percentage', e.target.value) + 'additional_discount_percentage', discount_percentage) .then(() => { let discount_wrapper = this.wrapper.find('.discount_amount'); - discount_wrapper.val(this.frm.doc.discount_amount); + discount_wrapper.val(flt(this.frm.doc.discount_amount, + precision('discount_amount'))); discount_wrapper.trigger('change'); }); }); this.wrapper.find('.discount_amount').on('change', (e) => { + const discount_amount = flt(e.target.value, precision('discount_amount')); frappe.model.set_value(this.frm.doctype, this.frm.docname, - 'discount_amount', flt(e.target.value)); + 'discount_amount', discount_amount); this.frm.trigger('discount_amount') .then(() => { - let discount_wrapper = this.wrapper.find('.additional_discount_percentage'); - discount_wrapper.val(this.frm.doc.additional_discount_percentage); + this.update_discount_fields(); this.update_taxes_and_totals(); this.update_grand_total(); }); }); } + update_discount_fields() { + let discount_wrapper = this.wrapper.find('.additional_discount_percentage'); + let discount_amt_wrapper = this.wrapper.find('.discount_amount'); + discount_wrapper.val(flt(this.frm.doc.additional_discount_percentage, + precision('additional_discount_percentage'))); + discount_amt_wrapper.val(flt(this.frm.doc.discount_amount, + precision('discount_amount'))); + } + set_selected_item($item) { this.selected_item = $item; this.$cart_items.find('.list-item').removeClass('current-item qty disc rate'); @@ -848,7 +861,7 @@ class POSItems { this.search_field = frappe.ui.form.make_control({ df: { fieldtype: 'Data', - label: 'Search Item (Ctrl + I)', + label: 'Search Item ( Ctrl + i )', placeholder: 'Search by item code, serial number, batch no or barcode' }, parent: this.wrapper.find('.search-field'), @@ -945,16 +958,21 @@ class POSItems { if(serial_no) { this.events.update_cart(items[0].item_code, 'serial_no', serial_no); - this.search_field.set_value(''); + this.reset_search_field(); } if(batch_no) { this.events.update_cart(items[0].item_code, 'batch_no', batch_no); - this.search_field.set_value(''); + this.reset_search_field(); } }); } + reset_search_field() { + this.search_field.set_value(''); + this.search_field.$input.trigger("input"); + } + bind_events() { var me = this; this.wrapper.on('click', '.pos-item-wrapper', function() { diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py index d74f1f06e3..5694ad9af2 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.py +++ b/erpnext/selling/page/point_of_sale/point_of_sale.py @@ -24,6 +24,8 @@ def get_items(start, page_length, price_list, item_group, search_value=""): if batch_no_data: batch_no, item_code = batch_no_data + item_code, condition = get_conditions(item_code, serial_no, batch_no) + lft, rgt = frappe.db.get_value('Item Group', item_group, ['lft', 'rgt']) # locate function is used to sort by closest match from the beginning of the value res = frappe.db.sql("""select i.name as item_code, i.item_name, i.image as item_image, @@ -36,11 +38,11 @@ def get_items(start, page_length, price_list, item_group, search_value=""): where i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1 and i.item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt}) - and (i.item_code like %(item_code)s - or i.item_name like %(item_code)s or i.barcode like %(item_code)s) - limit {start}, {page_length}""".format(start=start, page_length=page_length, lft=lft, rgt=rgt), + and {condition} + limit {start}, {page_length}""".format(start=start, + page_length=page_length, lft=lft, rgt=rgt, condition=condition), { - 'item_code': '%%%s%%'%(frappe.db.escape(item_code)), + 'item_code': item_code, 'price_list': price_list } , as_dict=1) @@ -60,6 +62,15 @@ def get_items(start, page_length, price_list, item_group, search_value=""): return res +def get_conditions(item_code, serial_no, batch_no): + if serial_no or batch_no: + return frappe.db.escape(item_code), "i.item_code = %(item_code)s" + + condition = """(i.item_code like %(item_code)s + or i.item_name like %(item_code)s or i.barcode like %(item_code)s)""" + + return '%%%s%%'%(frappe.db.escape(item_code)), condition + @frappe.whitelist() def submit_invoice(doc): if isinstance(doc, basestring): From eaec4695f780eeb831c542c28b2430553a56b2d4 Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Wed, 4 Oct 2017 14:34:45 +0530 Subject: [PATCH 49/81] [hotfix] filter doctype if the doctype has subscription field (#11038) --- .../doctype/subscription/subscription.js | 6 ++++++ .../doctype/subscription/subscription.py | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/subscription/subscription.js b/erpnext/accounts/doctype/subscription/subscription.js index 9c5b264bc0..15927d5961 100644 --- a/erpnext/accounts/doctype/subscription/subscription.js +++ b/erpnext/accounts/doctype/subscription/subscription.js @@ -3,6 +3,12 @@ frappe.ui.form.on('Subscription', { setup: function(frm) { + frm.fields_dict['reference_doctype'].get_query = function(doc) { + return { + query: "erpnext.accounts.doctype.subscription.subscription.subscription_doctype_query" + }; + }; + frm.fields_dict['reference_document'].get_query = function() { return { filters: { diff --git a/erpnext/accounts/doctype/subscription/subscription.py b/erpnext/accounts/doctype/subscription/subscription.py index 352a0aa87c..0e14e84b9d 100644 --- a/erpnext/accounts/doctype/subscription/subscription.py +++ b/erpnext/accounts/doctype/subscription/subscription.py @@ -276,4 +276,20 @@ def stop_resume_subscription(subscription, status): doc.update_status(status) doc.save() - return doc.status \ No newline at end of file + return doc.status + +def subscription_doctype_query(doctype, txt, searchfield, start, page_len, filters): + return frappe.db.sql("""select parent from `tabDocField` + where fieldname = 'subscription' + and parent like %(txt)s + order by + if(locate(%(_txt)s, parent), locate(%(_txt)s, parent), 99999), + parent + limit %(start)s, %(page_len)s""".format(**{ + 'key': searchfield, + }), { + 'txt': "%%%s%%" % txt, + '_txt': txt.replace("%", ""), + 'start': start, + 'page_len': page_len + }) \ No newline at end of file From 4d68e03a97c84e82bc4d6dbd2cb2d09b4c8cb93a Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Wed, 4 Oct 2017 14:35:21 +0530 Subject: [PATCH 50/81] [Fix] Job Opening Web Form breadcrumb (#11029) --- erpnext/hr/doctype/job_opening/job_opening.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/job_opening/job_opening.py b/erpnext/hr/doctype/job_opening/job_opening.py index 3d935f55e6..60c911a016 100644 --- a/erpnext/hr/doctype/job_opening/job_opening.py +++ b/erpnext/hr/doctype/job_opening/job_opening.py @@ -21,7 +21,7 @@ class JobOpening(WebsiteGenerator): self.route = frappe.scrub(self.job_title).replace('_', '-') def get_context(self, context): - context.parents = [{'name': 'jobs', 'title': _('All Jobs') }] + context.parents = [{'route': 'jobs', 'title': _('All Jobs') }] def get_list_context(context): context.title = _("Jobs") From c83e793ce81967bdcad777f9a2a1b05105e327f5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Oct 2017 15:22:31 +0600 Subject: [PATCH 51/81] bumped to version 9.0.8 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index edbd9a25be..ef1e4ed921 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from erpnext.hooks import regional_overrides -__version__ = '9.0.7' +__version__ = '9.0.8' def get_default_company(user=None): '''Get default company for user''' From d3e21fff66d29e845c27910eeb2a183e851d0b27 Mon Sep 17 00:00:00 2001 From: KanchanChauhan Date: Wed, 4 Oct 2017 15:20:34 +0530 Subject: [PATCH 52/81] [Minor] Employee name as standard filter (#11043) --- erpnext/hr/doctype/employee/employee.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/employee/employee.json b/erpnext/hr/doctype/employee/employee.json index 87f05377cd..227302c16c 100644 --- a/erpnext/hr/doctype/employee/employee.json +++ b/erpnext/hr/doctype/employee/employee.json @@ -149,7 +149,7 @@ "in_filter": 0, "in_global_search": 1, "in_list_view": 1, - "in_standard_filter": 0, + "in_standard_filter": 1, "label": "Full Name", "length": 0, "no_copy": 0, @@ -431,7 +431,7 @@ "no_copy": 0, "oldfieldname": "gender", "oldfieldtype": "Select", - "options": "Gender", + "options": "Gender", "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, @@ -2432,7 +2432,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-06-13 14:29:13.694009", + "modified": "2017-10-04 11:42:02.495731", "modified_by": "Administrator", "module": "HR", "name": "Employee", From 7e5a9f5c0ef178e2b622b49002bdb666e314a9b6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Oct 2017 15:51:34 +0530 Subject: [PATCH 53/81] Update new bom rate while replacing BOM (#11045) --- .../doctype/bom_update_tool/bom_update_tool.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py index 91b5070dbd..e3c61ed516 100644 --- a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py +++ b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py @@ -30,12 +30,13 @@ class BOMUpdateTool(Document): frappe.throw(_("The selected BOMs are not for the same item")) def update_new_bom(self): - current_bom_unitcost = frappe.db.sql("""select total_cost/quantity - from `tabBOM` where name = %s""", self.current_bom) - current_bom_unitcost = current_bom_unitcost and flt(current_bom_unitcost[0][0]) or 0 + new_bom_unitcost = frappe.db.sql("""select total_cost/quantity + from `tabBOM` where name = %s""", self.new_bom) + new_bom_unitcost = flt(new_bom_unitcost[0][0]) if new_bom_unitcost else 0 + frappe.db.sql("""update `tabBOM Item` set bom_no=%s, rate=%s, amount=stock_qty*%s where bom_no = %s and docstatus < 2""", - (self.new_bom, current_bom_unitcost, current_bom_unitcost, self.current_bom)) + (self.new_bom, new_bom_unitcost, new_bom_unitcost, self.current_bom)) def get_parent_boms(self): return [d[0] for d in frappe.db.sql("""select distinct parent From 3d0d4b2157218bf2fe4aeeaf3430fec9c1b25d5f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Oct 2017 15:51:55 +0530 Subject: [PATCH 54/81] update subscription period only if relevant date field exists (#11046) --- erpnext/accounts/doctype/subscription/subscription.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/subscription/subscription.py b/erpnext/accounts/doctype/subscription/subscription.py index 8745ac6ed4..b40169a36c 100644 --- a/erpnext/accounts/doctype/subscription/subscription.py +++ b/erpnext/accounts/doctype/subscription/subscription.py @@ -142,7 +142,7 @@ def get_subscription_entries(date): def create_documents(data, schedule_date): try: doc = make_new_document(data, schedule_date) - if doc.from_date: + if getattr(doc, "from_date", None): update_subscription_period(data, doc) if data.notify_by_email and data.recipients: @@ -154,7 +154,7 @@ def create_documents(data, schedule_date): frappe.db.rollback() frappe.db.begin() frappe.log_error(frappe.get_traceback()) - disabled_subscription(data) + disable_subscription(data) frappe.db.commit() if data.reference_document and not frappe.flags.in_test: notify_error_to_user(data) @@ -166,7 +166,7 @@ def update_subscription_period(data, doc): frappe.db.set_value('Subscription', data.name, 'from_date', from_date) frappe.db.set_value('Subscription', data.name, 'to_date', to_date) -def disabled_subscription(data): +def disable_subscription(data): subscription = frappe.get_doc('Subscription', data.name) subscription.db_set('disabled', 1) From 32456b0f14bfe05435fcdca20bf5114a155309a3 Mon Sep 17 00:00:00 2001 From: Doridel Cahanap Date: Wed, 4 Oct 2017 18:24:44 +0800 Subject: [PATCH 55/81] [minor edits] BOM Stock Report (#11012) * HTML for BOM Stock Report to show filters in PDF * Added BOM Stock Report in Manufacturing Config under Report --- erpnext/config/manufacturing.py | 6 +++++ .../bom_stock_report/bom_stock_report.html | 27 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 erpnext/manufacturing/report/bom_stock_report/bom_stock_report.html diff --git a/erpnext/config/manufacturing.py b/erpnext/config/manufacturing.py index 11711ad004..086d61b847 100644 --- a/erpnext/config/manufacturing.py +++ b/erpnext/config/manufacturing.py @@ -123,6 +123,12 @@ def get_data(): "is_query_report": True, "name": "BOM Search", "doctype": "BOM" + }, + { + "type": "report", + "is_query_report": True, + "name": "BOM Stock Report", + "doctype": "BOM" } ] }, diff --git a/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.html b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.html new file mode 100644 index 0000000000..119a4fc629 --- /dev/null +++ b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.html @@ -0,0 +1,27 @@ +

{%= __("BOM Stock Report") %}

+
{%= filters.bom %}
+
{%= filters.warehouse %}
+
+ + + + + + + + + + + + + {% for(var i=0, l=data.length; i + + + + + + + {% } %} + +
{%= __("Item") %}{%= __("Description") %}{%= __("Required Qty") %}{%= __("In Stock Qty") %}{%= __("Enough Parts to Build") %}
{%= data[i][ __("Item")] %}{%= data[i][ __("Description")] %} {%= data[i][ __("Required Qty")] %} {%= data[i][ __("In Stock Qty")] %} {%= data[i][ __("Enough Parts to Build")] %}
\ No newline at end of file From 1b67d71139dfaa06bde9cdac39a0b9ad9a9b5a49 Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Wed, 4 Oct 2017 15:55:56 +0530 Subject: [PATCH 56/81] [minor] add the Lead in email account -> append_to field (#10983) --- erpnext/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 6d411cd1d7..a6dbd20671 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -47,7 +47,7 @@ treeviews = ['Account', 'Cost Center', 'Warehouse', 'Item Group', 'Customer Grou update_website_context = "erpnext.shopping_cart.utils.update_website_context" my_account_context = "erpnext.shopping_cart.utils.update_my_account_context" -email_append_to = ["Job Applicant", "Opportunity", "Issue"] +email_append_to = ["Job Applicant", "Lead", "Opportunity", "Issue"] calendars = ["Task", "Production Order", "Leave Application", "Sales Order", "Holiday List"] From 61287e3c53618f3d1620a69f2e576a43b653a6ae Mon Sep 17 00:00:00 2001 From: Javier Wong Date: Wed, 4 Oct 2017 18:31:34 +0800 Subject: [PATCH 57/81] [fix] Change Sample Item Error Message to Zero Valuation Rate (#10935) Change Sample Item Error Message to Zero Valuation Rate --- erpnext/stock/stock_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 7c6b34bd90..180ccbb3e2 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -461,6 +461,6 @@ def get_valuation_rate(item_code, warehouse, voucher_type, voucher_no, if not allow_zero_rate and not valuation_rate \ and cint(erpnext.is_perpetual_inventory_enabled(company)): frappe.local.message_log = [] - frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries for {1} {2}. If the item is transacting as a sample item in the {1}, please mention that in the {1} Item table. Otherwise, please create an incoming stock transaction for the item or mention valuation rate in the Item record, and then try submiting/cancelling this entry").format(item_code, voucher_type, voucher_no)) + frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries for {1} {2}. If the item is transacting as a zero valuation rate item in the {1}, please mention that in the {1} Item table. Otherwise, please create an incoming stock transaction for the item or mention valuation rate in the Item record, and then try submiting/cancelling this entry").format(item_code, voucher_type, voucher_no)) return valuation_rate From 65dfd099471ce660a76b3674677ff04461107853 Mon Sep 17 00:00:00 2001 From: tundebabzy Date: Wed, 4 Oct 2017 13:21:44 +0100 Subject: [PATCH 58/81] fix wrong variable name (#11050) --- erpnext/hr/doctype/process_payroll/process_payroll.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/process_payroll/process_payroll.py b/erpnext/hr/doctype/process_payroll/process_payroll.py index 55c0cce59f..0e329a7c19 100644 --- a/erpnext/hr/doctype/process_payroll/process_payroll.py +++ b/erpnext/hr/doctype/process_payroll/process_payroll.py @@ -284,7 +284,7 @@ class ProcessPayroll(Document): }) # Deductions - for acc, amt in deductions.items(): + for acc, amount in deductions.items(): payable_amount -= flt(amount, precision) accounts.append({ "account": acc, From 1e2c554e61dc750c17d18f89073bf5b219f8af61 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 4 Oct 2017 17:52:49 +0530 Subject: [PATCH 59/81] [Fix] Stock entry multi uom batch validation issue (#11049) --- erpnext/stock/doctype/batch/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 043dc73d37..c58a98d7c8 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -103,7 +103,7 @@ def split_batch(batch_no, item_code, warehouse, qty, new_batch_id = None): def set_batch_nos(doc, warehouse_field, throw = False): '''Automatically select `batch_no` for outgoing items in item table''' for d in doc.items: - qty = d.get('stock_qty') or d.get('qty') or 0 + qty = d.get('stock_qty') or d.get('transfer_qty') or d.get('qty') or 0 has_batch_no = frappe.db.get_value('Item', d.item_code, 'has_batch_no') warehouse = d.get(warehouse_field, None) if has_batch_no and warehouse and qty > 0: From 54c725dcd19d4fa947202f485a37c2bc59abc0f8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Oct 2017 18:35:19 +0600 Subject: [PATCH 60/81] bumped to version 9.0.9 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ef1e4ed921..1a7ddd2374 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from erpnext.hooks import regional_overrides -__version__ = '9.0.8' +__version__ = '9.0.9' def get_default_company(user=None): '''Get default company for user''' From b290e3a4e7b9dc897be24226540d55b4bafb7ac3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Oct 2017 18:51:34 +0600 Subject: [PATCH 61/81] bumped to version 9.1.0 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 1a7ddd2374..55628cc676 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from erpnext.hooks import regional_overrides -__version__ = '9.0.9' +__version__ = '9.1.0' def get_default_company(user=None): '''Get default company for user''' From fd345f8e9066e4158e54b8e1796192cc6ce10fcc Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 5 Oct 2017 11:17:30 +0530 Subject: [PATCH 62/81] Hub (#10934) * [WIP]Hub * [listing] Show items, users and item_groups * Show filters * [start] cart, api for rfq and opp * rfq working * [wip] keys * wip quotes * [hub] register/unregister * [hub] rename password to access_token, remove passed company field * [hub] publishing cases, api call wrapper * [hub] add and remove fields working * [hub] fix flags, update on client save working * [hub] new hub page, client item CUD at hub working * listing, standard rate, local site hack * item listing, item page, search, back to home * [hub] implement hub company * [hub] company filter * [hub] basic rfq-ing, item page cleanup * categories wip * [hub] use get_doc_before_save() * [hub] send opportunity message to hub, api to make locally * [hub] enqueueing in hub api request wrapper * cleanup * [hub] refactor shopping cart's product.py to reuse * sync dynamic item fields daily * Scheduler heartbeat check * [wip] hub categories * [hub] wip enqueued callbacks * [hub] outgoing messages, fixing callback loop * [hub] bug: callback save after primary save * [hub] pricing, stock, currency * [hub] replace send_hub_request with make_and_enqueue * add hub.less, refactor code * Remove template html files, add styling for hub item cards * fix paging * add breadcrumb * Add sidebar * [hub] add company page, change country * [hub] order_by filters * [hub] make hub category a tree * [hub] enqueue batched item enqueueing * [hub] requested products page * [minor] * update hub url * [fix] url * [fix] more reform * fix recursion * [hub] data migration plans as jsons * Hub register, create data connector, sync with run * [add] user registration by session user * Removed hub_message * Remove sync code from hub_settings * Remove hub methods from item.py * Update Hub Sync plan * Hub unregister * Update Hub connector on reregister * Dont delete Hub Connector on unregister * Enable hub on success response * Add new hub whitelisted methods * [hub] list working * Hub register from hub page * [hub] Add hub logo in desk icon, link to page * [hub] hide page head on empty state * [hub] make rfq * [hub] push opportunity doc, poll for opportunity docs * add fields to item mapping * update hub mappings * Make RFQ * [hub] item, home routing * Make rfq and send opportunity refactor * [hub][fix] remote lead data * images passed as base64 * set default company on register * Revert "images passed as base64" This reverts commit 0b033a5fb7072b2d39a1b87a47dc41e7af707bb4. * Add sync to hub page * Prompt for publish items to hub * add post process to hub document to lead * Rename Hub document to Hub message, create opportunity in post process --- erpnext/config/desktop.py | 11 +- erpnext/config/hub_node.py | 24 + erpnext/hooks.py | 2 + erpnext/hub/__init__.py | 0 erpnext/hub_node/__init__.py | 281 +++++- erpnext/hub_node/api.py | 29 + .../data_migration_mapping/__init__.py | 0 .../company_to_hub_company.json | 45 + .../hub_message_to_lead/__init__.py | 29 + .../hub_message_to_lead.json | 31 + .../item_to_hub_item/item_to_hub_item.json | 54 + .../hub_sync/hub_sync.json | 26 + .../hub_node/doctype/hub_category/__init__.py | 0 .../doctype/hub_category/hub_category.js | 8 + .../doctype/hub_category/hub_category.json | 275 ++++++ .../doctype/hub_category/hub_category.py | 11 + .../doctype/hub_category/hub_category_tree.js | 4 + .../doctype/hub_category/test_hub_category.js | 23 + .../doctype/hub_category/test_hub_category.py | 10 + .../doctype/hub_settings/hub_settings.js | 98 +- .../doctype/hub_settings/hub_settings.json | 629 +++++++----- .../doctype/hub_settings/hub_settings.py | 165 ++-- .../doctype/hub_settings/test_hub_settings.js | 23 + .../doctype/hub_settings/test_hub_settings.py | 10 + erpnext/hub_node/page/hub/hub.js | 922 ++++++++++++++++-- erpnext/hub_node/page/hub/hub_body.html | 20 - erpnext/hub_node/page/hub/hub_list.html | 16 - .../hub_node/page/hub/register_in_hub.html | 19 - erpnext/public/css/hub.css | 104 ++ erpnext/public/images/hub_logo.svg | 76 ++ erpnext/public/less/erpnext.less | 2 +- erpnext/public/less/hub.less | 140 +++ erpnext/setup/doctype/company/company.json | 888 ++++++++--------- erpnext/shopping_cart/product_info.py | 45 + erpnext/stock/doctype/item/item.js | 6 +- erpnext/stock/doctype/item/item.json | 219 +++++ erpnext/stock/doctype/item/item.py | 8 +- erpnext/stock/doctype/item/test_item.js | 23 + erpnext/templates/includes/product_page.js | 2 +- .../{shopping_cart => utilities}/product.py | 75 +- 40 files changed, 3359 insertions(+), 994 deletions(-) create mode 100644 erpnext/config/hub_node.py create mode 100644 erpnext/hub/__init__.py create mode 100644 erpnext/hub_node/api.py create mode 100644 erpnext/hub_node/data_migration_mapping/__init__.py create mode 100644 erpnext/hub_node/data_migration_mapping/company_to_hub_company/company_to_hub_company.json create mode 100644 erpnext/hub_node/data_migration_mapping/hub_message_to_lead/__init__.py create mode 100644 erpnext/hub_node/data_migration_mapping/hub_message_to_lead/hub_message_to_lead.json create mode 100644 erpnext/hub_node/data_migration_mapping/item_to_hub_item/item_to_hub_item.json create mode 100644 erpnext/hub_node/data_migration_plan/hub_sync/hub_sync.json create mode 100644 erpnext/hub_node/doctype/hub_category/__init__.py create mode 100644 erpnext/hub_node/doctype/hub_category/hub_category.js create mode 100644 erpnext/hub_node/doctype/hub_category/hub_category.json create mode 100644 erpnext/hub_node/doctype/hub_category/hub_category.py create mode 100644 erpnext/hub_node/doctype/hub_category/hub_category_tree.js create mode 100644 erpnext/hub_node/doctype/hub_category/test_hub_category.js create mode 100644 erpnext/hub_node/doctype/hub_category/test_hub_category.py create mode 100644 erpnext/hub_node/doctype/hub_settings/test_hub_settings.js create mode 100644 erpnext/hub_node/doctype/hub_settings/test_hub_settings.py delete mode 100644 erpnext/hub_node/page/hub/hub_body.html delete mode 100644 erpnext/hub_node/page/hub/hub_list.html delete mode 100644 erpnext/hub_node/page/hub/register_in_hub.html create mode 100644 erpnext/public/css/hub.css create mode 100644 erpnext/public/images/hub_logo.svg create mode 100644 erpnext/public/less/hub.less create mode 100644 erpnext/shopping_cart/product_info.py create mode 100644 erpnext/stock/doctype/item/test_item.js rename erpnext/{shopping_cart => utilities}/product.py (50%) diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py index 8fb66b1b70..65485912e2 100644 --- a/erpnext/config/desktop.py +++ b/erpnext/config/desktop.py @@ -127,7 +127,6 @@ def get_data(): { "module_name": "POS", "color": "#589494", - "icon": "fa fa-th", "icon": "octicon octicon-credit-card", "type": "page", "link": "pos", @@ -267,7 +266,15 @@ def get_data(): "color": "#FF888B", "icon": "octicon octicon-plus", "type": "module", - "label": _("Healthcare") + "label": _("Healthcare"), + }, + { + "module_name": "Hub", + "color": "#009248", + "icon": "/assets/erpnext/images/hub_logo.svg", + "type": "page", + "link": "hub", + "label": _("Hub") }, { "module_name": "Data Import Tool", diff --git a/erpnext/config/hub_node.py b/erpnext/config/hub_node.py new file mode 100644 index 0000000000..c9d5b97bf0 --- /dev/null +++ b/erpnext/config/hub_node.py @@ -0,0 +1,24 @@ +from __future__ import unicode_literals +from frappe import _ + +def get_data(): + return [ + { + "label": _("Setup"), + "items": [ + { + "type": "doctype", + "name": "Hub Settings" + }, + ] + }, + { + "label": _("Hub"), + "items": [ + { + "type": "page", + "name": "hub" + }, + ] + }, + ] \ No newline at end of file diff --git a/erpnext/hooks.py b/erpnext/hooks.py index a6dbd20671..4e22757711 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -209,6 +209,8 @@ scheduler_events = { "erpnext.buying.doctype.supplier_scorecard.supplier_scorecard.refresh_scorecards", "erpnext.setup.doctype.company.company.cache_companies_monthly_sales_history", "erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool.update_latest_price_in_all_boms", + "erpnext.hub_node.doctype.hub_settings.hub_settings.sync_item_fields_at_hub", + "erpnext.hub_node.update_local_hub_categories" ] } diff --git a/erpnext/hub/__init__.py b/erpnext/hub/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/hub_node/__init__.py b/erpnext/hub_node/__init__.py index 1c9729955c..1756b764a9 100644 --- a/erpnext/hub_node/__init__.py +++ b/erpnext/hub_node/__init__.py @@ -2,16 +2,275 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe, requests +import frappe, requests, json +from frappe.utils import now, nowdate, cint +from frappe.utils.nestedset import get_root_of +from frappe.contacts.doctype.contact.contact import get_default_contact @frappe.whitelist() -def get_items(text, start, limit): - hub = frappe.get_single("Hub Settings") - response = requests.get(hub.hub_url + "/api/method/hub.hub.api.get_items", params={ - "access_token": hub.access_token, - "text": text, - "start": start, - "limit": limit - }) - response.raise_for_status() - return response.json().get("message") +def enable_hub(): + hub_settings = frappe.get_doc('Hub Settings') + hub_settings.register() + frappe.db.commit() + return hub_settings + +@frappe.whitelist() +def get_items(start=0, page_length=20): + connection = get_connection() + response = connection.connection.get_list('Hub Item', limit_start=start, limit_page_length=page_length) + return response + +@frappe.whitelist() +def get_categories(): + connection = get_connection() + response = connection.get_list('Hub Category') + return response.list + +@frappe.whitelist() +def get_item_details(hub_sync_id): + connection = get_connection() + return connection.connection.get_doc('Hub Item', hub_sync_id) + +@frappe.whitelist() +def get_company_details(hub_sync_id): + connection = get_connection() + return connection.connection.get_doc('Hub Company', hub_sync_id) + +def get_connection(): + hub_connector = frappe.get_doc( + 'Data Migration Connector', 'Hub Connector') + hub_connection = hub_connector.get_connection() + return hub_connection + +def make_opportunity(buyer_name, email_id): + buyer_name = "HUB-" + buyer_name + + if not frappe.db.exists('Lead', {'email_id': email_id}): + lead = frappe.new_doc("Lead") + lead.lead_name = buyer_name + lead.email_id = email_id + lead.save(ignore_permissions=True) + + o = frappe.new_doc("Opportunity") + o.enquiry_from = "Lead" + o.lead = frappe.get_all("Lead", filters={"email_id": email_id}, fields = ["name"])[0]["name"] + o.save(ignore_permissions=True) + +# @frappe.whitelist() +# def get_items(text='', by_item_codes=0, start=0, limit=20, order_by='', category=None, company_name=None, country=None): +# item_codes = [] +# if cint(by_item_codes): +# item_codes = [d["item_code"] for d in frappe.get_all("Item", fields=["item_code"], filters={"is_hub_item": "1"}, +# limit_start = start, limit_page_length = limit)] +# if not item_codes: +# return [] + +# args = { +# "text": text, +# "item_codes": item_codes, +# "category": category, +# "company_name": company_name, +# "country": country, +# "order_by": order_by, +# "start": start, +# "limit": limit +# } +# return hub_request('get_items', data=json.dumps(args)) + +# @frappe.whitelist() +# def get_all_companies(): +# return hub_request('get_all_companies') + +# @frappe.whitelist() +# def get_item_details(item_code): +# args = { +# "item_code": item_code, +# } +# return hub_request('get_item_details', data=json.dumps(args)) + +# @frappe.whitelist() +# def get_company_details(company_id): +# args = { +# "company_id": company_id, +# } +# return hub_request('get_company_details', data=json.dumps(args)) + +# @frappe.whitelist() +# def get_categories(): +# # update_local_hub_categories() +# return hub_request('get_categories') + +# def update_local_hub_categories(): +# categories = get_categories() +# categories_to_remove = [] +# categories_to_add = [] +# old_categories = frappe.db.sql_list("select category_name from from `tabHub Category`") +# new_categories = [d.category_name for d in categories] +# for old_category in old_categories: +# if old_category not in new_categories: +# categories_to_remove.append(old_category) + +# for new_category in new_categories: +# if new_category not in old_categories: +# categories_to_add.append(new_category) + +# for d in categories_to_remove: +# docname = frappe.get_list('Hub Category', filters = {"category_name": d})[0]["name"] +# frappe.delete_doc("Hub Category", docname) + +# for d in categories_to_add: +# doc = frappe.new_doc("Hub Category") +# doc.category_name = d +# doc.save() + + +# @frappe.whitelist() +# def get_items_seen_states(items): +# items = json.loads(items) +# for d in items: +# local_item_code = "HUB-" + d["item_code"] +# if frappe.db.exists("Item", {"item_code": local_item_code}): +# d["seen"] = 1 +# else: +# d["seen"] = 0 +# return items + +# @frappe.whitelist() +# def get_local_hub_item_codes(): +# item_codes = [] +# for d in frappe.get_all("Item", fields=["item_code"], filters={"is_hub_item": 1}): +# item_codes.append(d["item_code"][4:]) +# return item_codes + +# @frappe.whitelist() +# def hub_item_request_action(item): +# item = json.loads(item) +# rfq = make_rfq(item) +# # , send click count and say requested +# send_opportunity_details(supplier_name, supplier_email) +# make_opportunities() +# return rfq + +# def send_opportunity_details(supplier_name, supplier_email): +# connection = get_connection() +# params = { +# "buyer_name": supplier_name, +# "email_id": supplier_email +# } +# args = frappe._dict(dict( +# doctype="Hub Document", +# type="Opportunity", +# document_data=json.dumps(params), +# user=supplier_email +# )) +# response = connection.insert("Hub Document", args) + +@frappe.whitelist() +def make_rfq_and_send_opportunity(item, supplier): + supplier = make_supplier(supplier) + contact = make_contact(supplier) + item = make_item(item) + rfq = make_rfq(item, supplier, contact) + status = send_opportunity(contact) + + return { + 'rfq': rfq, + 'hub_document_created': status + } + +def make_supplier(supplier): + # make supplier if not already exists + supplier = frappe._dict(json.loads(supplier)) + + if not frappe.db.exists('Supplier', {'supplier_name': supplier.supplier_name}): + supplier_doc = frappe.get_doc({ + 'doctype': 'Supplier', + 'supplier_name': supplier.supplier_name, + 'supplier_type': supplier.supplier_type, + 'supplier_email': supplier.supplier_email + }).insert() + else: + supplier_doc = frappe.get_doc('Supplier', supplier.supplier_name) + + return supplier_doc + +def make_contact(supplier): + contact_name = get_default_contact('Supplier', supplier.supplier_name) + # make contact if not already exists + if not contact_name: + contact = frappe.get_doc({ + 'doctype': 'Contact', + 'first_name': supplier.supplier_name, + 'email_id': supplier.supplier_email, + 'is_primary_contact': 1, + 'links': [ + {'link_doctype': 'Supplier', 'link_name': supplier.supplier_name} + ] + }).insert() + else: + contact = frappe.get_doc('Contact', contact_name) + + return contact + +def make_item(item): + # make item if not already exists + item = frappe._dict(json.loads(item)) + + if not frappe.db.exists('Item', {'item_code': item.item_code}): + item_doc = frappe.get_doc({ + 'doctype': 'Item', + 'item_code': item.item_code, + 'item_group': item.item_group, + 'is_hub_item': 1 + }).insert() + else: + item_doc = frappe.get_doc('Item', item.item_code) + + return item_doc + +def make_rfq(item, supplier, contact): + # make rfq + rfq = frappe.get_doc({ + 'doctype': 'Request for Quotation', + 'transaction_date': nowdate(), + 'status': 'Draft', + 'company': frappe.db.get_single_value('Hub Settings', 'company'), + 'message_for_supplier': 'Please supply the specified items at the best possible rates', + 'suppliers': [ + { 'supplier': supplier.name, 'contact': contact.name } + ], + 'items': [ + { + 'item_code': item.item_code, + 'qty': 1, + 'schedule_date': nowdate(), + 'warehouse': item.default_warehouse or get_root_of("Warehouse"), + 'description': item.description, + 'uom': item.stock_uom + } + ] + }).insert() + + rfq.save() + rfq.submit() + return rfq + +def send_opportunity(contact): + # Make Hub Message on Hub with lead data + doc = { + 'doctype': 'Lead', + 'lead_name': frappe.db.get_single_value('Hub Settings', 'company'), + 'email_id': frappe.db.get_single_value('Hub Settings', 'user') + } + + args = frappe._dict(dict( + doctype='Hub Message', + reference_doctype='Lead', + data=json.dumps(doc), + user=contact.email_id + )) + + connection = get_connection() + response = connection.insert('Hub Message', args) + + return response.ok diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py new file mode 100644 index 0000000000..b32efd9799 --- /dev/null +++ b/erpnext/hub_node/api.py @@ -0,0 +1,29 @@ +# Copyright (c) 2015, Web Notes Technologies Pvt. Ltd. and Contributors and contributors +# For license information, please see license.txt + + +import frappe, json +from frappe.utils import now, nowdate +from erpnext.hub_node.doctype.hub_settings.hub_settings import get_hub_settings + +# API wrapper +@frappe.whitelist(allow_guest=True) +def call_method(access_token, method, message): + try: + args = json.loads(message) + if args: + return globals()[method](access_token, args) + else: + return globals()[method](access_token) + except: + print("Client Exception") + print(frappe.get_traceback()) + +def disable_and_suspend_hub_user(access_token): + hub_settings = get_hub_settings() + hub_settings.publish = 0 + hub_settings.publish_pricing = 0 + hub_settings.publish_availability = 0 + hub_settings.suspended = 1 + hub_settings.enabled = 0 + hub_settings.save(ignore_permissions=True) diff --git a/erpnext/hub_node/data_migration_mapping/__init__.py b/erpnext/hub_node/data_migration_mapping/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/hub_node/data_migration_mapping/company_to_hub_company/company_to_hub_company.json b/erpnext/hub_node/data_migration_mapping/company_to_hub_company/company_to_hub_company.json new file mode 100644 index 0000000000..dac8fe691b --- /dev/null +++ b/erpnext/hub_node/data_migration_mapping/company_to_hub_company/company_to_hub_company.json @@ -0,0 +1,45 @@ +{ + "condition": "{'name': ('=', frappe.db.get_single_value('Hub Settings', 'company'))}", + "creation": "2017-09-07 11:38:43.169065", + "docstatus": 0, + "doctype": "Data Migration Mapping", + "fields": [ + { + "is_child_table": 0, + "local_fieldname": "name", + "remote_fieldname": "company_name" + }, + { + "is_child_table": 0, + "local_fieldname": "country", + "remote_fieldname": "country" + }, + { + "is_child_table": 0, + "local_fieldname": "\"city\"", + "remote_fieldname": "seller_city" + }, + { + "is_child_table": 0, + "local_fieldname": "eval:frappe.local.site", + "remote_fieldname": "site_name" + }, + { + "is_child_table": 0, + "local_fieldname": "eval:frappe.session.user", + "remote_fieldname": "user" + } + ], + "idx": 2, + "local_doctype": "Company", + "mapping_name": "Company to Hub Company", + "mapping_type": "Push", + "migration_id_field": "hub_sync_id", + "modified": "2017-09-22 15:32:12.459172", + "modified_by": "Administrator", + "name": "Company to Hub Company", + "owner": "Administrator", + "page_length": 10, + "remote_objectname": "Hub Company", + "remote_primary_key": "name" +} \ No newline at end of file diff --git a/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/__init__.py b/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/__init__.py new file mode 100644 index 0000000000..79769ee5f8 --- /dev/null +++ b/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/__init__.py @@ -0,0 +1,29 @@ +import frappe, json + +def pre_process(doc): + return json.loads(doc['data']) + +def post_process(remote_doc=None, local_doc=None, **kwargs): + if not local_doc: + return + + hub_message = remote_doc + # update hub message on hub + hub_connector = frappe.get_doc('Data Migration Connector', 'Hub Connector') + connection = hub_connector.get_connection() + connection.update('Hub Message', dict( + status='Synced' + ), hub_message['name']) + + # make opportunity after lead is created + lead = local_doc + opportunity = frappe.get_doc({ + 'doctype': 'Opportunity', + 'naming_series': 'OPTY-', + 'enquiry_type': 'Sales', + 'enquiry_from': 'Lead', + 'status': 'Open', + 'lead': lead.name, + 'company': lead.company, + 'transaction_date': frappe.utils.today() + }).insert() diff --git a/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/hub_message_to_lead.json b/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/hub_message_to_lead.json new file mode 100644 index 0000000000..a0194adc79 --- /dev/null +++ b/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/hub_message_to_lead.json @@ -0,0 +1,31 @@ +{ + "condition": "{'reference_doctype': 'Lead', 'user': frappe.db.get_single_value('Hub Settings', 'user'), 'status': 'Pending'}", + "creation": "2017-09-20 15:06:40.279930", + "docstatus": 0, + "doctype": "Data Migration Mapping", + "fields": [ + { + "is_child_table": 0, + "local_fieldname": "email_id", + "remote_fieldname": "email_id" + }, + { + "is_child_table": 0, + "local_fieldname": "lead_name", + "remote_fieldname": "lead_name" + } + ], + "idx": 0, + "local_doctype": "Lead", + "local_primary_key": "email_id", + "mapping_name": "Hub Message to Lead", + "mapping_type": "Pull", + "migration_id_field": "hub_sync_id", + "modified": "2017-09-28 13:21:41.575155", + "modified_by": "faris@erpnext.com", + "name": "Hub Message to Lead", + "owner": "frappetest@gmail.com", + "page_length": 10, + "remote_objectname": "Hub Message", + "remote_primary_key": "name" +} \ No newline at end of file diff --git a/erpnext/hub_node/data_migration_mapping/item_to_hub_item/item_to_hub_item.json b/erpnext/hub_node/data_migration_mapping/item_to_hub_item/item_to_hub_item.json new file mode 100644 index 0000000000..ef909180fe --- /dev/null +++ b/erpnext/hub_node/data_migration_mapping/item_to_hub_item/item_to_hub_item.json @@ -0,0 +1,54 @@ +{ + "creation": "2017-09-07 13:27:52.726350", + "docstatus": 0, + "doctype": "Data Migration Mapping", + "fields": [ + { + "is_child_table": 0, + "local_fieldname": "item_code", + "remote_fieldname": "item_code" + }, + { + "is_child_table": 0, + "local_fieldname": "item_name", + "remote_fieldname": "item_name" + }, + { + "is_child_table": 0, + "local_fieldname": "eval:frappe.db.get_default(\"company\")", + "remote_fieldname": "company_name" + }, + { + "is_child_table": 0, + "local_fieldname": "image", + "remote_fieldname": "image" + }, + { + "is_child_table": 0, + "local_fieldname": "item_group", + "remote_fieldname": "item_group" + }, + { + "is_child_table": 0, + "local_fieldname": "eval:frappe.session.user", + "remote_fieldname": "seller" + }, + { + "is_child_table": 0, + "local_fieldname": "eval:frappe.db.get_default(\"country\")", + "remote_fieldname": "country" + } + ], + "idx": 1, + "local_doctype": "Item", + "mapping_name": "Item to Hub Item", + "mapping_type": "Push", + "migration_id_field": "hub_sync_id", + "modified": "2017-09-22 15:32:12.674169", + "modified_by": "Administrator", + "name": "Item to Hub Item", + "owner": "Administrator", + "page_length": 10, + "remote_objectname": "Hub Item", + "remote_primary_key": "item_code" +} \ No newline at end of file diff --git a/erpnext/hub_node/data_migration_plan/hub_sync/hub_sync.json b/erpnext/hub_node/data_migration_plan/hub_sync/hub_sync.json new file mode 100644 index 0000000000..9edbac94f2 --- /dev/null +++ b/erpnext/hub_node/data_migration_plan/hub_sync/hub_sync.json @@ -0,0 +1,26 @@ +{ + "creation": "2017-09-07 11:39:38.445902", + "docstatus": 0, + "doctype": "Data Migration Plan", + "idx": 1, + "mappings": [ + { + "enabled": 1, + "mapping": "Company to Hub Company" + }, + { + "enabled": 1, + "mapping": "Item to Hub Item" + }, + { + "enabled": 1, + "mapping": "Hub Message to Lead" + } + ], + "modified": "2017-09-28 15:37:17.616828", + "modified_by": "faris@erpnext.com", + "module": "Hub Node", + "name": "Hub Sync", + "owner": "Administrator", + "plan_name": "Hub Sync" +} \ No newline at end of file diff --git a/erpnext/hub_node/doctype/hub_category/__init__.py b/erpnext/hub_node/doctype/hub_category/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/hub_node/doctype/hub_category/hub_category.js b/erpnext/hub_node/doctype/hub_category/hub_category.js new file mode 100644 index 0000000000..9f54166e14 --- /dev/null +++ b/erpnext/hub_node/doctype/hub_category/hub_category.js @@ -0,0 +1,8 @@ +// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Hub Category', { + refresh: function(frm) { + + } +}); diff --git a/erpnext/hub_node/doctype/hub_category/hub_category.json b/erpnext/hub_node/doctype/hub_category/hub_category.json new file mode 100644 index 0000000000..4f8d66ace0 --- /dev/null +++ b/erpnext/hub_node/doctype/hub_category/hub_category.json @@ -0,0 +1,275 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:hub_category_name", + "beta": 0, + "creation": "2017-08-22 11:31:10.410322", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "hub_category_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Category Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "parent_hub_category", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Parent Category", + "length": 0, + "no_copy": 0, + "options": "Hub Category", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_group", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Group", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lft", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Left", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "rgt", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Right", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "old_parent", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Old Parent", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2017-09-03 22:04:22.958831", + "modified_by": "Administrator", + "module": "Hub Node", + "name": "Hub Category", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "hub_category_name", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/hub_node/doctype/hub_category/hub_category.py b/erpnext/hub_node/doctype/hub_category/hub_category.py new file mode 100644 index 0000000000..5d19082324 --- /dev/null +++ b/erpnext/hub_node/doctype/hub_category/hub_category.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils.nestedset import NestedSet +from frappe.model.document import Document + +class HubCategory(NestedSet): + pass diff --git a/erpnext/hub_node/doctype/hub_category/hub_category_tree.js b/erpnext/hub_node/doctype/hub_category/hub_category_tree.js new file mode 100644 index 0000000000..d0309e3d98 --- /dev/null +++ b/erpnext/hub_node/doctype/hub_category/hub_category_tree.js @@ -0,0 +1,4 @@ +frappe.treeview_settings["Hub Category"] = { + title: __("Hub Category"), + breadcrumb: "Hub" +} \ No newline at end of file diff --git a/erpnext/hub_node/doctype/hub_category/test_hub_category.js b/erpnext/hub_node/doctype/hub_category/test_hub_category.js new file mode 100644 index 0000000000..73c06d5a92 --- /dev/null +++ b/erpnext/hub_node/doctype/hub_category/test_hub_category.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Hub Category", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Hub Category + () => frappe.tests.make('Hub Category', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/erpnext/hub_node/doctype/hub_category/test_hub_category.py b/erpnext/hub_node/doctype/hub_category/test_hub_category.py new file mode 100644 index 0000000000..7df20889a7 --- /dev/null +++ b/erpnext/hub_node/doctype/hub_category/test_hub_category.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestHubCategory(unittest.TestCase): + pass diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.js b/erpnext/hub_node/doctype/hub_settings/hub_settings.js index 95b6d62fd3..ce0f8bc352 100644 --- a/erpnext/hub_node/doctype/hub_settings/hub_settings.js +++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.js @@ -1,17 +1,87 @@ -frappe.ui.form.on("Hub Settings", "onload", function(frm) { - if(!frm.doc.seller_country) { - frm.set_value("seller_country", frappe.defaults.get_default("Country")); - } - if(!frm.doc.seller_name) { - frm.set_value("seller_name", frappe.defaults.get_default("Company")); - } -}); +frappe.ui.form.on("Hub Settings", { + refresh: function(frm) { + frm.add_custom_button(__('Logs'), + () => frappe.set_route('List', 'Data Migration Run', { + data_migration_plan: 'Hub Sync' + })); -frappe.ui.form.on("Hub Settings", "refresh", function(frm) { - // make mandatory if published - frm.toggle_reqd(["seller_name", "seller_email", "seller_country"], frm.doc.publish); -}); + frm.trigger("enabled"); + if (frm.doc.enabled) { + frm.add_custom_button(__('View Hub'), + () => frappe.set_route('hub')); + frm.add_custom_button(__('Sync'), + () => frm.call('sync')); + } + }, + onload: function(frm) { + if(!frm.doc.country) { + frm.set_value("country", frappe.defaults.get_default("Country")); + } + if(!frm.doc.company) { + frm.set_value("company", frappe.defaults.get_default("Company")); + } + }, + onload_post_render: function(frm) { + if(frm.get_field("unregister_from_hub").$input) + frm.get_field("unregister_from_hub").$input.addClass("btn-danger"); + }, + on_update: function(frm) { + }, + enabled: function(frm) { + if(!frm.doc.enabled) { + frm.trigger("set_enable_hub_primary_button"); + } else { + frm.page.set_primary_action(__("Save Settings"), () => { + frm.save(); + }); + } + }, -frappe.ui.form.on("Hub Settings", "publish", function(frm) { - frm.trigger("refresh"); + hub_user_email: function(frm) { + if(frm.doc.hub_user_email){ + frm.set_value("hub_user_name", frappe.user.full_name(frm.doc.hub_user_email)); + } + }, + + set_enable_hub_primary_button: (frm) => { + frm.page.set_primary_action(__("Enable Hub"), () => { + if(frappe.session.user === "Administrator") { + frappe.msgprint("Please login as another user.") + } else { + frappe.verify_password(() => { + this.frm.call({ + doc: this.frm.doc, + method: "register", + args: {}, + freeze: true, + callback: function(r) {}, + onerror: function() { + frappe.msgprint(__("Wrong Password")); + frm.set_value("enabled", 0); + } + }); + } ); + } + }); + }, + + // update_hub: (frm) => { + // this.frm.call({ + // doc: this.frm.doc, + // method: "update_hub", + // args: {}, + // freeze: true, + // callback: function(r) { }, + // onerror: function() { } + // }); + // }, + + unregister_from_hub: (frm) => { + frappe.verify_password(() => { + var d = frappe.confirm(__('Are you sure you want to unregister?'), () => { + frm.call('unregister'); + }, () => {}, __('Confirm Action')); + d.get_primary_btn().addClass("btn-danger"); + }); + }, }); diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.json b/erpnext/hub_node/doctype/hub_settings/hub_settings.json index 30cb81614c..b96d6b3643 100644 --- a/erpnext/hub_node/doctype/hub_settings/hub_settings.json +++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.json @@ -1,29 +1,41 @@ { "allow_copy": 0, + "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, + "beta": 1, "creation": "2015-02-18 00:59:34.560476", "custom": 0, + "description": "", "docstatus": 0, "doctype": "DocType", - "document_type": "System", + "document_type": "", + "editable_grid": 0, "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "publish", + "columns": 0, + "fieldname": "enabled", "fieldtype": "Check", - "hidden": 0, + "hidden": 1, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, - "label": "Publish Items to Hub", + "in_standard_filter": 0, + "label": "Enabled", + "length": 0, "no_copy": 0, "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -31,43 +43,29 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "depends_on": "publish", - "fieldname": "section_break_2", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "publish_pricing", + "columns": 0, + "fieldname": "suspended", "fieldtype": "Check", - "hidden": 0, + "hidden": 1, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, - "label": "Publish Pricing", + "in_standard_filter": 0, + "label": "Suspended", + "length": 0, "no_copy": 0, "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -75,132 +73,124 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "publish_availability", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Publish Availability", - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "column_break_5", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "sync_now", - "fieldtype": "Button", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Sync Now", - "no_copy": 0, - "options": "sync", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "depends_on": "publish", - "fieldname": "section_break_6", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "seller_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Seller Name", - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "seller_country", + "columns": 0, + "fieldname": "user", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, - "label": "Seller Country", + "in_standard_filter": 0, + "label": "User", + "length": 0, + "no_copy": 0, + "options": "User", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "eval:(!doc.enabled)", + "columns": 0, + "depends_on": "", + "fieldname": "seller_profile_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company and Seller Profile", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Country", + "length": 0, "no_copy": 0, "options": "Country", "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -208,131 +198,29 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "seller_email", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Seller Email", - "no_copy": 0, - "options": "Email", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "column_break_10", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "seller_city", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Seller City", - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "seller_website", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Seller Website", - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "depends_on": "publish", - "fieldname": "section_break_13", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, + "columns": 0, "fieldname": "seller_description", "fieldtype": "Text Editor", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, - "label": "Seller Description", + "in_standard_filter": 0, + "label": "Description", + "length": 0, "no_copy": 0, "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -340,21 +228,30 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "name_token", - "fieldtype": "Data", - "hidden": 1, + "columns": 0, + "depends_on": "enabled", + "fieldname": "publish_section", + "fieldtype": "Section Break", + "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, - "label": "Name Token", + "in_standard_filter": 0, + "label": "Publish", + "length": 0, "no_copy": 0, "permlevel": 0, "precision": "", "print_hide": 0, - "read_only": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -362,21 +259,216 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "access_token", - "fieldtype": "Data", - "hidden": 1, + "columns": 0, + "fieldname": "publish", + "fieldtype": "Check", + "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, - "label": "Access Token", + "in_standard_filter": 0, + "label": "Publish Items to Hub", + "length": 0, "no_copy": 0, "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "publish", + "fieldname": "publish_pricing", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Publish Pricing", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:(doc.publish && doc.publish_pricing)", + "fieldname": "selling_price_list", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Selling Price List", + "length": 0, + "no_copy": 0, + "options": "Price List", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "publish", + "fieldname": "publish_availability", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Publish Availability", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "publish", + "fieldname": "last_sync_datetime", + "fieldtype": "Datetime", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Last Sync On", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": "", + "columns": 0, + "depends_on": "enabled", + "fieldname": "unregister_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Unregister", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "unregister_from_hub", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Unregister from Hub", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -384,15 +476,18 @@ "unique": 0 } ], + "has_web_view": 0, "hide_heading": 0, "hide_toolbar": 0, + "idx": 0, + "image_view": 0, "in_create": 0, - "in_dialog": 0, "is_submittable": 0, "issingle": 1, "istable": 0, - "modified": "2015-02-18 08:14:46.140473", - "modified_by": "Administrator", + "max_attachments": 0, + "modified": "2017-09-21 12:13:50.841646", + "modified_by": "manas@erpnext.com", "module": "Hub Node", "name": "Hub Settings", "name_case": "", @@ -419,8 +514,12 @@ "write": 1 } ], + "quick_entry": 0, "read_only": 0, "read_only_onload": 0, + "show_name_in_global_search": 0, "sort_field": "modified", - "sort_order": "DESC" + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.py b/erpnext/hub_node/doctype/hub_settings/hub_settings.py index 35f1f67114..7e54b654e3 100644 --- a/erpnext/hub_node/doctype/hub_settings/hub_settings.py +++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.py @@ -3,94 +3,103 @@ from __future__ import unicode_literals import frappe, requests, json -from frappe.model.document import Document -from frappe.utils import cint, expand_relative_urls -from frappe import _ +from frappe.model.document import Document +from frappe.utils import add_years, now, get_datetime, get_datetime_str +from frappe import _ +from erpnext.utilities.product import get_price, get_qty_in_stock +from six import string_types + +hub_url = "http://erpnext.hub:8000" +# hub_url = "https://hub.erpnext.org" +# hub_url = "http://192.168.29.145:3000" + +class HubSetupError(frappe.ValidationError): pass class HubSettings(Document): - hub_url = "http://localhost:8001" - def validate(self): - if cint(self.publish): - if not self.name_token: - self.register() - else: - self.update_seller_details() - self.publish_selling_items() - else: - if self.name_token: - self.unpublish() - def publish_selling_items(self): - """Set `publish_in_hub`=1 for all Sales Items""" - for item in frappe.get_all("Item", fields=["name"], - filters={ "publish_in_hub": "0"}): - frappe.db.set_value("Item", item.name, "publish_in_hub", 1) + def validate(self): + if self.publish_pricing and not self.selling_price_list: + frappe.throw(_("Please select a Price List to publish pricing")) + + def get_hub_url(self): + return hub_url + + def sync(self): + """Create and execute Data Migration Run for Hub Sync plan""" + frappe.has_permission('Hub Settings', throw=True) + + doc = frappe.get_doc({ + 'doctype': 'Data Migration Run', + 'data_migration_plan': 'Hub Sync', + 'data_migration_connector': 'Hub Connector' + }).insert() + + doc.run() def register(self): - """Register at hub.erpnext.com, save `name_token` and `access_token`""" - response = requests.post(self.hub_url + "/api/method/hub.hub.api.register", data=self.get_args()) - response.raise_for_status() - response = response.json() - self.name_token = response.get("message").get("name") - self.access_token = response.get("message").get("access_token") - - def unpublish(self): - """Unpublish from hub.erpnext.com""" - response = requests.post(self.hub_url + "/api/method/hub.hub.api.unpublish", data={ - "access_token": self.access_token - }) - response.raise_for_status() - - def update_seller_details(self): - """Update details at hub.erpnext.com""" - args = self.get_args() - args["published"] = 1 - response = requests.post(self.hub_url + "/api/method/hub.hub.api.update_seller", data={ - "access_token": self.access_token, - "args": json.dumps(args) - }) - response.raise_for_status() - - def get_args(self): - return { - "seller_name": self.seller_name, - "seller_country": self.seller_country, - "seller_city": self.seller_city, - "seller_email": self.seller_email, - "seller_website": self.seller_website, - "seller_description": self.seller_description + """ Create a User on hub.erpnext.org and return username/password """ + data = { + 'email': frappe.session.user } + post_url = hub_url + '/api/method/hub.hub.api.register' - def sync(self, verbose=True): - """Sync items with hub.erpnext.com""" - if not self.publish: - if verbose: - frappe.msgprint(_("Publish to sync items")) + response = requests.post(post_url, data=data) + response.raise_for_status() + message = response.json().get('message') + + if message and message.get('password'): + self.user = frappe.session.user + self.create_hub_connector(message) + self.company = frappe.defaults.get_user_default('company') + self.enabled = 1 + self.save() + + def unregister(self): + """ Disable the User on hub.erpnext.org""" + + hub_connector = frappe.get_doc( + 'Data Migration Connector', 'Hub Connector') + + connection = hub_connector.get_connection() + response = connection.update('User', frappe._dict({'enabled': 0}), hub_connector.username) + + if response.ok: + self.enabled = 0 + self.save() + + def create_hub_connector(self, message): + if frappe.db.exists('Data Migration Connector', 'Hub Connector'): + hub_connector = frappe.get_doc('Data Migration Connector', 'Hub Connector') + hub_connector.username = message['email'] + hub_connector.password = message['password'] + hub_connector.save() return - items = frappe.db.get_all("Item", - fields=["name", "item_name", "description", "image", "item_group"], - filters={"publish_in_hub": 1, "synced_with_hub": 0}) + frappe.get_doc({ + 'doctype': 'Data Migration Connector', + 'connector_type': 'Frappe', + 'connector_name': 'Hub Connector', + 'hostname': hub_url, + 'username': message['email'], + 'password': message['password'] + }).insert() - for item in items: - item.item_code = item.name - if item.image: - item.image = expand_relative_urls(item.image) +def reset_hub_publishing_settings(last_sync_datetime = ""): + doc = frappe.get_doc("Hub Settings", "Hub Settings") + doc.reset_publishing_settings(last_sync_datetime) + doc.in_callback = 1 + doc.save() - item_list = frappe.db.sql_list("select name from tabItem where publish_in_hub=1") +def reset_hub_settings(last_sync_datetime = ""): + doc = frappe.get_doc("Hub Settings", "Hub Settings") + doc.reset_publishing_settings(last_sync_datetime) + doc.reset_enable() + doc.in_callback = 1 + doc.save() + frappe.msgprint(_("Successfully unregistered.")) - if items: - response = requests.post(self.hub_url + "/api/method/hub.hub.api.sync", data={ - "access_token": self.access_token, - "items": json.dumps(items), - "item_list": json.dumps(item_list) - }) - response.raise_for_status() - for item in items: - frappe.db.set_value("Item", item.name, "synced_with_hub", 1) - if verbose: - frappe.msgprint(_("{0} Items synced".format(len(items)))) - else: - if verbose: - frappe.msgprint(_("Items already synced")) +@frappe.whitelist() +def sync(): + hub_settings = frappe.get_doc('Hub Settings') + hub_settings.sync() \ No newline at end of file diff --git a/erpnext/hub_node/doctype/hub_settings/test_hub_settings.js b/erpnext/hub_node/doctype/hub_settings/test_hub_settings.js new file mode 100644 index 0000000000..546ce1504c --- /dev/null +++ b/erpnext/hub_node/doctype/hub_settings/test_hub_settings.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Hub Settings", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially('Hub Settings', [ + // insert a new Hub Settings + () => frappe.tests.make([ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/erpnext/hub_node/doctype/hub_settings/test_hub_settings.py b/erpnext/hub_node/doctype/hub_settings/test_hub_settings.py new file mode 100644 index 0000000000..1299adc17e --- /dev/null +++ b/erpnext/hub_node/doctype/hub_settings/test_hub_settings.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +class TestHubSettings(unittest.TestCase): + pass diff --git a/erpnext/hub_node/page/hub/hub.js b/erpnext/hub_node/page/hub/hub.js index ad09b9d12a..7f34a5ac38 100644 --- a/erpnext/hub_node/page/hub/hub.js +++ b/erpnext/hub_node/page/hub/hub.js @@ -1,90 +1,870 @@ +/* globals Hub, HubList */ + +frappe.provide('erpnext.hub'); + frappe.pages['hub'].on_page_load = function(wrapper) { - var page = frappe.ui.make_app_page({ + const page = frappe.ui.make_app_page({ parent: wrapper, title: 'Hub', - single_column: true + single_col: false }); - frappe.hub = new frappe.Hub({page:page}); + erpnext.hub.Hub = new Hub({ page }); -} +}; -frappe.pages['hub'].on_page_show = function() { - frappe.hub.refresh(); -} - -frappe.Hub = Class.extend({ - init: function(args) { - $.extend(this, args); - this.render(); - }, - refresh: function() { - if(this.hub && this.hub.publish && !this.hub_list) { - this.setup_list(); +frappe.pages['hub'].on_page_show = function(wrapper) { + const current_route = frappe.get_route(); + if(current_route[1] === "Products") { + const item_code = current_route[2]; + if(item_code) { + erpnext.hub.Hub.go_to_item_page(item_code); } - }, - render: function() { - this.page.main.empty(); - var me = this; - frappe.model.with_doc("Hub Settings", "Hub Settings", function() { - me.hub = locals["Hub Settings"]["Hub Settings"]; - if(!me.hub.publish) { - $(frappe.render_template("register_in_hub", {})).appendTo(me.page.main); + } + + if(current_route[1] === "Company") { + const company_name = current_route[2]; + if(company_name) { + erpnext.hub.Hub.go_to_company_page(company_name); + } + } +} + +window.Hub = class Hub { + constructor({ page }) { + this.page = page; + frappe.require('/assets/erpnext/css/hub.css', () => { + this.setup(); + }); + } + + setup() { + this.setup_header(); + this.company_cache = {}; + this.item_cache = {}; + this.filters = {}; + this.order_by = ''; + + this.$hub_main_section = + $(`
`).appendTo(this.page.body); + this.bind_events(); + this.refresh(); + } + + refresh() { + this.$hub_main_section.empty(); + this.page.page_form.hide(); + + const $layout_main = this.page.wrapper.find('.layout-main'); + const $page_head = this.page.wrapper.find('.page-head'); + + frappe.model.with_doc('Hub Settings', 'Hub Settings', () => { + this.hub_settings = frappe.get_doc('Hub Settings'); + + if(this.hub_settings.enabled == 0) { + let $empty_state = this.page.get_empty_state( + __("Register for Hub"), + __(`Let other ERPNext users discover your products + and automate workflow with Supplier from within ERPNext.`), + __("Register") + ); + + $page_head.hide(); + $layout_main + .find('.layout-side-section, .layout-main-section-wrapper') + .hide(); + $layout_main.append($empty_state); + + $empty_state.find('.btn-primary').on('click', () => { + this.register_for_hub(); + }); } else { - me.setup_list(); + $page_head.show(); + $layout_main.find('.page-card-container').remove(); + $layout_main.find('.layout-side-section, .layout-main-section-wrapper').show(); + this.setup_live_state(); } }); - }, - setup_list: function() { - var me = this; - $(frappe.render_template("hub_body", {})).appendTo(this.page.main); - this.hub_list = this.page.main.find(".hub-list"); - this.search = this.page.main.find("input").on("keypress", function(e) { - if(e.which===13) { - me.reset(); - } + } + + register_for_hub() { + frappe.verify_password(() => { + frappe.call({ + method: 'erpnext.hub_node.enable_hub', + callback: (r) => { + if(r.message.enabled == 1) { + Object.assign(this.hub_settings, r.message); + this.refresh(); + this.prompt_for_item_sync(); + } + } + }); }); - this.loading = this.page.main.find(".loading"); - this.done = this.page.main.find(".done"); - this.more = this.page.main.find(".more") - this.more.find(".btn").on("click", function() { me.next_page() }); - this.reset(); - }, - reset: function() { - this.hub_list.empty(); - this.start = 0; - this.page_length = 20; - this.next_page(); - }, - next_page: function() { - var me = this; - this.loading.toggleClass("hide", false); + } + + prompt_for_item_sync() { frappe.call({ - method: "erpnext.hub_node.get_items", + method: 'frappe.client.get_list', args: { - text: this.get_text(), - start: this.start, - limit: this.page_length + doctype: 'Data Migration Run', + filters: { + 'data_migration_plan': 'Hub Sync' + }, + limit_page_length: 1 }, callback: function(r) { - me.loading.toggleClass("hide", true); - if(!r.message) - r.message = []; - me.start += r.message.length; - $(frappe.render_template("hub_list", {items: r.message})).appendTo(me.hub_list); - if(r.message.length && r.message.length===me.page_length) { - // more - me.more.removeClass("hide"); - me.done.addClass("hide"); - } else { - // done - me.more.addClass("hide"); - me.done.removeClass("hide"); + if (!r) { + frappe.confirm(__('Do you want to publish your Items to Hub ?'), () => { + this.sync_items_to_hub(); + }); } } + }) + } + + setup_header() { + this.page.page_title = this.page.wrapper.find('.page-title'); + this.tag_line = $(` +
+ + ${__('Product listing and discovery for ERPNext users')} + +
`) + .appendTo(this.page.page_title); + + this.bind_title(); + } + + setup_live_state() { + if(!this.$search) { + this.setup_filters(); + } + this.page.page_form.show(); + this.setup_menu(); + this.setup_sidebar(); + this.render_body(); + this.setup_lists(); + } + + setup_filters() { + + // frappe.call({ + // method: 'erpnext.hub_node.get_categories' + // }).then((r) => { + // if (r.message) { + // const categories = r.message; + // console.log("categories", categories); + // categories + // .map(c => c.hub_category_name) + // .map(c => this.sidebar.add_item({ + // label: c, + // on_click: () => { + // this.home_item_list && + // this.home_item_list.refresh({ + // text: '', + // start: 0, + // limit: 20, + // category: c && c !== 'All Categories' ? c : undefined + // }); + // } + // }, __('Hub Category'))); + + + // } + // }); + + // this.category_select = this.page.add_select(__('Category'), + // [ + // {label: __('Sort by Price ...'), value: '' }, + // {label: __('High to Low'), value: 'price desc' }, + // {label: __('Low to High'), value: 'price' }, + // ] + // ); + + this.price_sort_select = this.page.add_select(__('Sort by Price'), + [ + {label: __('Sort by Price ...'), value: '' }, + {label: __('High to Low'), value: 'price desc' }, + {label: __('Low to High'), value: 'price' }, + ] + ); + + this.criteria_select = this.page.add_select(__('Sort by Criteria'), + [ + {label: __('Most Popular'), value: 'request_count' }, + {label: __('Newest'), value: 'creation' }, + ] + ); + + this.price_sort_select.on('change', () => { + this.refresh_item_only_page(); }); - }, - get_text: function() { - return this.search.val(); - }, -}) + + this.criteria_select.on('change', () => { + this.refresh_item_only_page(); + }); + + this.$search = this.page.add_data(__('Search')); + this.setup_search(); + } + + bind_events() { + const me = this; + this.$hub_main_section + .on('click', '.company-link a', function(e) { + e.preventDefault(); + const company_name = $(this).attr('data-company-name'); + me.get_company_details(company_name); + }) + .on('click', '.breadcrumb li', function(e) { + e.preventDefault(); + const $li = $(this); + if ($li.attr('data-route') === 'Home') { + me.go_to_home_page(); + } + }); + } + + update_filters() { + let price_sort = $(this.price_sort_select).val() || ''; + let criteria = $(this.criteria_select).val() || ''; + + let order_by_params = []; + let query_string = ''; + if(criteria) { + order_by_params.push(criteria); + // query_string += 'sort_by=' + criteria + } + if(price_sort) order_by_params.push(price_sort); + this.order_by = order_by_params.join(","); + // return query_string; + } + + reset_filters() { + this.order_by = ''; + $(this.category_select).val(''); + $(this.price_sort_select).val(''); + $(this.criteria_select).val('Most Popular'); + } + + refresh_item_only_page() { + this.reset_search(); + this.update_filters(); + this.go_to_items_only_page( + ['hub', 'Products'], + '', 'product-list' + ); + } + + bind_title() { + this.page.page_title.find('.title-text').on('click', () => { + this.go_to_home_page(); + }); + } + + render_body() { + this.$home_page = $(` +
+ +
+
+
+
+ `).appendTo(this.$hub_main_section); + + this.$banner = this.$hub_main_section.find('.banner'); + this.$listing_body = this.$hub_main_section.find('.listing-body'); + this.$main_list_section = this.$hub_main_section.find('.main-list-section'); + this.$side_list_section = this.$hub_main_section.find('.side-list-section'); + } + + setup_lists() { + this.home_item_list = new HubList({ + parent: this.$main_list_section, + title: 'New', + page_length: 20, + list_css_class: 'home-product-list', + method: 'erpnext.hub_node.get_items', + // order_by: 'request_count', + filters: {text: '', country: this.country}, // filters at the time of creation + on_item_click: (item_code) => { + frappe.set_route('hub', 'Products', item_code); + } + }); + + this.home_item_list.setup(); + } + + setup_search() { + this.$search.on('keypress', (e) => { + if(e.which === 13) { + var search_term = ($(this.$search).val() || '').toLowerCase(); + this.go_to_items_only_page( + ['hub', 'search', search_term], + 'Search results for \'' + search_term + '\'', + 'search-product-list', + {text: search_term} + ); + } + }); + } + + go_to_items_only_page(route, title, class_name, filters = {text: ''}, by_item_codes=0) { + frappe.set_route(route); + this.$hub_main_section.empty(); + this.filtered_item_list = new HubList({ + parent: this.$hub_main_section, + title: title, + page_length: 20, + list_css_class: class_name, + method: 'erpnext.hub_node.get_items', + order_by: this.order_by, + filters: filters, + by_item_codes: by_item_codes + }); + this.filtered_item_list.on_item_click = (item_code) => { + frappe.set_route('hub', 'Products', item_code); + } + this.filtered_item_list.setup(); + } + + go_to_item_page(item_code) { + if(this.item_cache) { + let item = this.item_cache[item_code]; + if(item) { + this.render_item_page(item); + return; + } + } else { + this.item_cache = {}; + } + frappe.call({ + args:{ + hub_sync_id: item_code + }, + method: "erpnext.hub_node.get_item_details", + callback: (r) => { + let item = r.message; + this.item_cache[item_code] = item; + this.render_item_page(item); + } + }); + } + + render_item_page(item) { + this.$hub_main_section.empty(); + + + let $item_page = + $(this.get_item_page(item)) + .appendTo(this.$hub_main_section); + + let $company_items = $item_page.find('.company-items'); + + let company_item_list = new HubList({ + parent: $company_items, + title: 'More by ' + item.company_name, + page_length: 5, + list_css_class: 'company-item-list', + method: 'erpnext.hub_node.get_items', + // order_by: 'request_count', + filters: {text: '', company_name: item.company_name, country: this.country}, + paginated: 0, + img_size: 150 + }); + + company_item_list.on_item_click = (item_code) => { + frappe.set_route('hub', 'Products', item_code); + } + company_item_list.setup(); + + $item_page.find('.rfq-btn') + .click((e) => { + const $btn = $(e.target); + + this.show_rfq_modal(item) + .then(values => { + item.item_code = values.item_code; + delete values.item_code; + + const supplier = values; + return [item, supplier]; + }) + .then(([item, supplier]) => { + return this.make_rfq(item, supplier, $btn); + }) + .then(r => { + console.log(r); + if (r.message && r.message.rfq) { + $btn.addClass('disabled').html(` ${__('Quote Requested')}`); + } else { + throw r; + } + }) + .catch((e) => { + console.log(e); //eslint-disable-line + }); + }); + } + + show_rfq_modal(item) { + return new Promise(res => { + let fields = [ + { label: __('Item Code'), fieldtype: 'Data', fieldname: 'item_code', default: item.item_code }, + { fieldtype: 'Column Break' }, + { label: __('Item Group'), fieldtype: 'Link', fieldname: 'item_group', default: item.item_group }, + { label: __('Supplier Details'), fieldtype: 'Section Break' }, + { label: __('Supplier Name'), fieldtype: 'Data', fieldname: 'supplier_name', default: item.company_name }, + { label: __('Supplier Email'), fieldtype: 'Data', fieldname: 'supplier_email', default: item.seller }, + { fieldtype: 'Column Break' }, + { label: __('Supplier Type'), fieldname: 'supplier_type', + fieldtype: 'Link', options: 'Supplier Type' } + ]; + fields = fields.map(f => { f.reqd = 1; return f; }); + + const d = new frappe.ui.Dialog({ + title: __('Request for Quotation'), + fields: fields, + primary_action_label: __('Send'), + primary_action: (values) => { + res(values); + d.hide(); + } + }); + + d.show(); + }); + } + + get_company_details(company_id) { + // get from cache if exists + let company_details = this.company_cache[company_id]; + if(this.company_cache[company_id]) { + this.go_to_company_page(company_details); + return; + } + frappe.call({ + method: 'erpnext.hub_node.get_company_details', + args: {company_id: company_id} + }).then((r) => { + if (r.message) { + const company_details = r.message.company_details; + this.company_cache[company_id] = company_details; + this.go_to_company_page(company_details) + } + }); + } + + go_to_company_page(company_details) { + frappe.set_route('hub', 'Company', company_details.company_name); + this.$hub_main_section.empty(); + + let $company_page = + $(this.get_company_page(company_details)) + .appendTo(this.$hub_main_section); + + let $company_items = $company_page.find('.company-items'); + + let company_item_list = new HubList({ + parent: $company_items, + title: 'More by ' + company_details.company_name, + page_length: 5, + list_css_class: 'company-item-list', + method: 'erpnext.hub_node.get_items', + // order_by: 'request_count', + filters: {text: '', company: company_details.company_name, country: this.country}, + paginated: 0, + img_size: 150 + }); + + company_item_list.on_item_click = (item_code) => { + frappe.set_route('hub', 'Products', item_code); + } + company_item_list.setup(); + } + + get_item_page(item) { + return ` +
+
+
+ ${ this.home_item_list.get_item_image(item) } +
+
+ +
+

${ item.item_name }

+
+
+ ${ item.company_name } +
+
+ Products +
+
+ ${ item.description ? item.description : "" } +
+
+ ${ item.formatted_price ? item.formatted_price : '' } +
+ +
+ +
+
+
+ +
+
+ `; + } + + get_company_page(company_details) { + return ` +
+
+
+ +
+

${ company_details.company_name }

+
+
+ ${ company_details.seller_city } +
+
+ ${ company_details.seller_description } +
+
+ +
+
+
+ +
+
+ `; + } + + get_breadcrumb(name, type) { + return ` + + `; + } + + go_to_home_page() { + frappe.set_route('hub'); + this.reset_filters(); + this.refresh(); + } + + setup_menu() { + this.page.add_menu_item(__('Hub Settings'), + () => frappe.set_route('Form', 'Hub Settings')); + + this.page.add_menu_item(__('Refresh'), () => this.refresh()); + + this.page.add_menu_item(__('Sync'), () => this.sync_items_to_hub()); + } + + sync_items_to_hub() { + frappe.call('erpnext.hub_node.doctype.hub_settings.hub_settings.sync') + } + + setup_sidebar() { + var me = this; + this.sidebar = new HubSidebar({ + wrapper: this.page.wrapper.find('.layout-side-section') + }); + + this.add_account_to_sidebar(); + + } + + add_account_to_sidebar() { + this.sidebar.add_item({ + label: this.hub_settings.company, + on_click: () => frappe.set_route('Form', 'Company', this.hub_settings.company) + }, __("Account")); + + this.sidebar.add_item({ + label: __("Requested Products"), + on_click: () => this.go_to_seen_items() + }, __("Account")); + } + + get_search_term() { + return this.$search.val(); + } + + reset_search() { + this.$search.val(''); + } + + make_rfq(item, supplier, btn) { + console.log(supplier); + return new Promise((resolve, reject) => { + frappe.call({ + method: 'erpnext.hub_node.make_rfq_and_send_opportunity', + args: { item, supplier }, + callback: resolve, + btn, + }).fail(reject); + }); + } + + go_to_seen_items() { + this.go_to_items_only_page( + ['hub', 'Requested Products'], + __('Requested Products'), + 'requested-product-list', + {}, 1 + ); + } +} + +class HubList { + constructor({ + parent = null, + title = 'Products', + page_length = 20, + list_css_class = '', + method = 'erpnext.hub_node.get_items', + filters = {text: ''}, + order_by = '', + by_item_codes = 0, + paginated = 1, + on_item_click = null, + img_size = 200 + }) { + this.parent = parent; + this.title = title; + this.page_length = page_length; + this.list_css_class = list_css_class; + this.method = method; + this.filters = filters; + this.order_by = order_by; + this.by_item_codes = by_item_codes; + this.paginated = paginated; + + this.on_item_click = on_item_click; + this.img_size = img_size; + } + + // to be called on demand + setup() { + this.container = $(` +
+
+

${this.title}

+
+
+
+
+

${__('Loading...')}

+
+
+

${__('No more results')}

+
+
+
+
+
+
`) + .appendTo(this.parent); + + this.$item_list_title = this.container.find('.item-list-header h3'); + this.$list = this.container.find('.item-list'); + this.$loading = this.container.find('.loading').hide(); + this.$more = this.container.find('.more').hide(); + this.$done = this.container.find('.done'); + + this.$more.on('click', () => { + this.next_page(); + }); + + this.next_page(); + } + + refresh(filters = this.filters) { + this.reset(); + this.set_filters(filters); + this.next_page(); + } + + reset() { + this.$list.empty(); + } + + set_filters(filters) { + this.filters = filters; + } + + next_page() { + this.$item_list_title.html(this.title); + const start = this.$list.find('.hub-item-wrapper').length; + this.$loading.show(); + + // build args + let args = { + start: start, + // query one extra + limit: this.page_length + 1 + }; + Object.assign(args, this.filters); + console.log("filters: ", args); + args.order_by = this.order_by; + args.by_item_codes = this.by_item_codes; + + frappe.call({ + method: this.method, + args: args, + callback: (r) => { + let items = r.message; + console.log("items: ", items); + this.render_items(items); + } + }); + } + + render_items(items) { + if(items) { + let done = 0; + console.log("items length", items.length); + if(items.length && items.length > this.page_length) { + // remove the extra queried + items.pop(); + } else { + done = 1; + } + items.forEach((item) => { + this.make_item_card(item).appendTo(this.$list); + }); + console.log(done); + this.update_list_state(done); + } else { + this.$item_list_title.html('No results found'); + } + } + + update_list_state(done=0) { + this.$loading.hide(); + if(done) { + this.$done.removeClass('hide'); + this.$more.hide(); + } else { + this.$more.show(); + this.$done.addClass('hide'); + } + } + + make_item_card(item) { + let $item_card = $(` + + `); + + $item_card.find(".item-link").click((e) => { + e.preventDefault(); + this.on_item_click && this.on_item_click(item.name); + }); + + return $item_card; + } + + get_item_image(item, size=this.img_size) { + const _size = size + 'px'; + const item_image = item.image ? + `` : + `
${item.item_name[0]}
`; + + return ` +
+ ${item_image} +
`; + } +} + +class HubSidebar { + constructor({ wrapper }) { + this.wrapper = wrapper; + this.make_dom(); + } + + make_dom() { + this.wrapper.html(` + + `); + + this.$sidebar = this.wrapper.find('.hub-sidebar'); + } + + add_item(item, section) { + let $section; + if(!section && this.wrapper.find('.sidebar-menu').length === 0) { + // if no section, add section with no heading + $section = this.get_section(); + } else { + $section = this.get_section(section); + } + + const $li_item = $(` +
  • ${item.label}
  • + `).click( + () => item.on_click && item.on_click() + ); + + $section.append($li_item); + } + + get_section(section_heading="") { + let $section = $(this.wrapper.find( + `[data-section-heading="${section_heading}"]`)); + if($section.length) { + return $section; + } + + const $section_heading = section_heading ? + `
  • ${section_heading}
  • ` : ''; + + $section = $(` + + `); + + this.$sidebar.append($section); + return $section; + } +} \ No newline at end of file diff --git a/erpnext/hub_node/page/hub/hub_body.html b/erpnext/hub_node/page/hub/hub_body.html deleted file mode 100644 index e415f7e689..0000000000 --- a/erpnext/hub_node/page/hub/hub_body.html +++ /dev/null @@ -1,20 +0,0 @@ -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -

    {%= __("Loading...") %}

    -
    -
    -
    -
    -
    -

    {%= __("No more results.") %}

    -
    - diff --git a/erpnext/hub_node/page/hub/hub_list.html b/erpnext/hub_node/page/hub/hub_list.html deleted file mode 100644 index 036ef2bf2a..0000000000 --- a/erpnext/hub_node/page/hub/hub_list.html +++ /dev/null @@ -1,16 +0,0 @@ -{% for(var i=0, l=items.length; i < l; i++) { %} -
    -
    -
    -
    {%= items[i].item_name %}
    -
    -
    -
    {%= items[i].seller_name %}
    -
    -
    -
    {%= items[i].seller_country %}
    -
    -
    -

    {%= items[i].description %}

    -
    -{% } %} diff --git a/erpnext/hub_node/page/hub/register_in_hub.html b/erpnext/hub_node/page/hub/register_in_hub.html deleted file mode 100644 index 96b1fb3d05..0000000000 --- a/erpnext/hub_node/page/hub/register_in_hub.html +++ /dev/null @@ -1,19 +0,0 @@ -
    -

    {%= __("Register For ERPNext Hub") %}

    -
    -
    -
    -
      -
    • Free listing of your products
    • -
    • Let other ERPNext users discover your products
    • -
    • Discover products quickly
    • -
    • Automate workflow with Supplier from within ERPNext (later)
    • -
    -
    -
    -
    - -
    diff --git a/erpnext/public/css/hub.css b/erpnext/public/css/hub.css new file mode 100644 index 0000000000..559c203979 --- /dev/null +++ b/erpnext/public/css/hub.css @@ -0,0 +1,104 @@ +/* hub */ +div[data-page-route="hub"] .page-head { + height: 80px; +} +div[data-page-route="hub"] .page-head .title-text { + cursor: pointer; +} +div[data-page-route="hub"] .page-content { + margin-top: 80px; +} +div[data-page-route="hub"] .page-title h1 { + margin-bottom: 0px; +} +div[data-page-route="hub"] .account-details { + margin-top: 20px; +} +div[data-page-route="hub"] [data-original-title="Search"] { + float: right; + width: 220px; +} +div[data-page-route="hub"] .hub-main-section { + padding: 30px; +} +div[data-page-route="hub"] .listing-body { + margin: 0; +} +div[data-page-route="hub"] .main-list-section { + padding: 0; +} +div[data-page-route="hub"] .side-list-section { + padding: 0; +} +div[data-page-route="hub"] .item-list-header h3 { + font-weight: normal; +} +div[data-page-route="hub"] .hub-item-page h2 { + margin-top: 10px; +} +div[data-page-route="hub"] .hub-item-page .item-header { + display: flex; +} +div[data-page-route="hub"] .hub-item-page .item-page-image { + flex: 1; +} +div[data-page-route="hub"] .hub-item-page .title-content { + flex: 3; +} +div[data-page-route="hub"] .hub-item-page .title-content .description { + margin: 30px 0px; +} +div[data-page-route="hub"] .hub-item-page .title-content .actions { + margin-top: 30px; +} +div[data-page-route="hub"] .hub-item-page .title-content .actions .rfq-btn.disabled { + background-color: #b1bdca; + color: #fff; + border-color: #b1bdca; +} +div[data-page-route="hub"] .hub-item-page .company-items { + margin-top: 40px; +} +div[data-page-route="hub"] .company-header { + display: flex; +} +div[data-page-route="hub"] .item-list { + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} +div[data-page-route="hub"] .hub-item-wrapper { + margin-bottom: 20px; +} +div[data-page-route="hub"] .img-wrapper { + border: 1px solid #d1d8dd; + border-radius: 3px; + padding: 12px; + overflow: hidden; + text-align: center; + white-space: nowrap; +} +div[data-page-route="hub"] .img-wrapper img { + max-width: 100%; + max-height: 100%; + display: inline-block; + vertical-align: middle; +} +div[data-page-route="hub"] .img-wrapper .helper { + height: 100%; + display: inline-block; + vertical-align: middle; +} +div[data-page-route="hub"] .img-wrapper .standard-image { + font-size: 72px; + border: none; + background-color: #fafbfc; +} +div[data-page-route="hub"] .hub-item-title { + width: 100%; +} +div[data-page-route="hub"] .breadcrumb { + padding-left: 0; + padding-top: 0; + margin-bottom: 10px; +} diff --git a/erpnext/public/images/hub_logo.svg b/erpnext/public/images/hub_logo.svg new file mode 100644 index 0000000000..2363090600 --- /dev/null +++ b/erpnext/public/images/hub_logo.svg @@ -0,0 +1,76 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/erpnext/public/less/erpnext.less b/erpnext/public/less/erpnext.less index d0c4841cc4..262b0c308c 100644 --- a/erpnext/public/less/erpnext.less +++ b/erpnext/public/less/erpnext.less @@ -438,4 +438,4 @@ body[data-route="pos"] { .list-item_content { padding-right: 45px; } -} \ No newline at end of file +} diff --git a/erpnext/public/less/hub.less b/erpnext/public/less/hub.less new file mode 100644 index 0000000000..1cae692d7d --- /dev/null +++ b/erpnext/public/less/hub.less @@ -0,0 +1,140 @@ +@import "../../../../frappe/frappe/public/less/variables.less"; + +/* hub */ +div[data-page-route="hub"] { + .page-head { + height: 80px; + + .title-text { + cursor: pointer; + } + } + + .page-content { + margin-top: 80px; + } + + .page-title h1 { + margin-bottom: 0px; + } + + .account-details { + margin-top: 20px; + } + + [data-original-title="Search"] { + float: right; + width: 220px; + } + + .hub-main-section { + padding: 30px; + } + + .listing-body { + margin: 0; + } + + .main-list-section { + padding: 0; + // border-right: 1px solid #d1d8dd; + } + + .side-list-section { + padding: 0; + } + + .item-list-header h3 { + font-weight: normal; + } + + .hub-item-page { + + h2 { + margin-top: 10px; + } + + .item-header { + display: flex; + } + + .item-page-image { + flex: 1; + } + + .title-content { + flex: 3; + + .description { + margin: 30px 0px; + } + + .actions { + margin-top: 30px; + + .rfq-btn.disabled { + background-color: #b1bdca; + color: #fff; + border-color: #b1bdca; + } + } + } + + .company-items { + margin-top: 40px; + } + } + + .company-header { + display: flex; + } + + .item-list { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + } + + .hub-item-wrapper { + margin-bottom: 20px; + } + + .img-wrapper { + border: 1px solid @border-color; + border-radius: 3px; + padding: 12px; + overflow: hidden; + text-align: center; + white-space: nowrap; + + img { + max-width: 100%; + max-height: 100%; + display: inline-block; + vertical-align: middle; + } + + .helper { + height: 100%; + display: inline-block; + vertical-align: middle; + } + + .standard-image { + font-size: 72px; + border: none; + background-color: @light-bg; + } + } + + .hub-item-title { + width: 100%; + } + + .breadcrumb { + padding-left: 0; + padding-top: 0; + margin-bottom: 10px; + } + +} \ No newline at end of file diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json index ec83705a43..f1b10a9891 100644 --- a/erpnext/setup/doctype/company/company.json +++ b/erpnext/setup/doctype/company/company.json @@ -194,461 +194,461 @@ "search_index": 0, "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "sales_settings", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Sales", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_settings", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "sales_monthly_history", - "fieldtype": "Small Text", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Sales Monthly History", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_monthly_history", + "fieldtype": "Small Text", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Monthly History", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "monthly_sales_target", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Monthly Sales Target", - "length": 0, - "no_copy": 0, - "options": "default_currency", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "monthly_sales_target", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Monthly Sales Target", + "length": 0, + "no_copy": 0, + "options": "default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_goals", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_goals", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "total_monthly_sales", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Total Monthly Sales", - "length": 0, - "no_copy": 1, - "options": "default_currency", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "total_monthly_sales", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total Monthly Sales", + "length": 0, + "no_copy": 1, + "options": "default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "charts_section", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Values", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "charts_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Values", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "default_letter_head", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Letter Head", - "length": 0, - "no_copy": 0, - "options": "Letter Head", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "default_letter_head", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Letter Head", + "length": 0, + "no_copy": 0, + "options": "Letter Head", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "default_holiday_list", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Holiday List", - "length": 0, - "no_copy": 0, - "options": "Holiday List", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "default_holiday_list", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Holiday List", + "length": 0, + "no_copy": 0, + "options": "Holiday List", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "default_terms", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Terms", - "length": 0, - "no_copy": 0, - "options": "Terms and Conditions", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "default_terms", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Terms", + "length": 0, + "no_copy": 0, + "options": "Terms and Conditions", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "default_currency", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Currency", - "length": 0, - "no_copy": 0, - "options": "Currency", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "default_currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_10", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_10", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "country", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Country", - "length": 0, - "no_copy": 0, - "options": "Country", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "country", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Country", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "create_chart_of_accounts_based_on", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Create Chart Of Accounts Based On", - "length": 0, - "no_copy": 0, - "options": "\nStandard Template\nExisting Company", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "create_chart_of_accounts_based_on", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Create Chart Of Accounts Based On", + "length": 0, + "no_copy": 0, + "options": "\nStandard Template\nExisting Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Standard Template\"", - "fieldname": "chart_of_accounts", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Chart Of Accounts Template", - "length": 0, - "no_copy": 1, - "options": "", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Standard Template\"", + "fieldname": "chart_of_accounts", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Chart Of Accounts Template", + "length": 0, + "no_copy": 1, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Existing Company\"", - "fieldname": "existing_company", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Existing Company ", - "length": 0, - "no_copy": 1, - "options": "Company", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Existing Company\"", + "fieldname": "existing_company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Existing Company ", + "length": 0, + "no_copy": 1, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 }, { @@ -1978,24 +1978,24 @@ "set_only_once": 0, "unique": 0 } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "fa fa-building", - "idx": 1, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "menu_index": 0, - "modified": "2017-08-31 11:48:56.278568", - "modified_by": "Administrator", - "module": "Setup", - "name": "Company", - "owner": "Administrator", + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "fa fa-building", + "idx": 1, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2017-09-06 15:08:44.360880", + "modified_by": "mohan@annapurna.com", + "module": "Setup", + "name": "Company", + "owner": "Administrator", "permissions": [ { "amend": 0, diff --git a/erpnext/shopping_cart/product_info.py b/erpnext/shopping_cart/product_info.py new file mode 100644 index 0000000000..8015c4818f --- /dev/null +++ b/erpnext/shopping_cart/product_info.py @@ -0,0 +1,45 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals + +import frappe +from erpnext.shopping_cart.cart import _get_cart_quotation +from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings \ + import is_cart_enabled, get_shopping_cart_settings, show_quantity_in_website +from erpnext.utilities.product import get_price, get_qty_in_stock + +@frappe.whitelist(allow_guest=True) +def get_product_info_for_website(item_code): + """get product price / stock info for website""" + if not is_cart_enabled(): + return {} + + cart_quotation = _get_cart_quotation() + cart_settings = get_shopping_cart_settings() + + price = get_price( + item_code, + cart_quotation.selling_price_list, + cart_settings.default_customer_group, + cart_settings.company + ) + + stock_status = get_qty_in_stock(item_code, "website_warehouse") + + product_info = { + "price": price, + "stock_qty": stock_status.stock_qty, + "in_stock": stock_status.in_stock, + "qty": 0, + "uom": frappe.db.get_value("Item", item_code, "stock_uom"), + "show_stock_qty": show_quantity_in_website() + } + + if product_info["price"]: + if frappe.session.user != "Guest": + item = cart_quotation.get({"item_code": item_code}) + if item: + product_info["qty"] = item[0].qty + + return product_info \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 03b93c0cb2..40b80c7c49 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -63,7 +63,7 @@ frappe.ui.form.on("Item", { frm.page.set_inner_btn_group_as_primary(__("Make")); } if (frm.doc.variant_of) { - frm.set_intro(__('This Item is a Variant of {0} (Template).', + frm.set_intro(__('This Item is a Variant of {0} (Template).', [`${frm.doc.variant_of}`]), true); } @@ -127,7 +127,7 @@ frappe.ui.form.on("Item", { if(!frm.doc.description) frm.set_value("description", frm.doc.item_code); }, - + is_stock_item: function(frm) { if(!frm.doc.is_stock_item) { frm.set_value("has_batch_no", 0); @@ -135,7 +135,7 @@ frappe.ui.form.on("Item", { frm.set_value("has_serial_no", 0); } }, - + copy_from_item_group: function(frm) { return frm.call({ doc: frm.doc, diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 525321c5a9..7b46b0a7cd 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -234,6 +234,68 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_hub_item", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Hub Item", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "is_hub_item", + "fieldname": "hub_category", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Hub Category", + "length": 0, + "no_copy": 0, + "options": "Hub Category", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -3191,6 +3253,163 @@ "search_index": 0, "set_only_once": 0, "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:(!doc.is_hub_item)", + "fieldname": "hub_publishing_sb", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Hub Publishing Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "description": "Publish Item to hub.erpnext.com", + "fieldname": "publish_in_hub", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Publish in Hub", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "hub_category_to_publish", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Hub Category to Publish", + "length": 0, + "no_copy": 0, + "options": "Hub Category", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Publish \"In Stock\" or \"Not in Stock\" on Hub based on stock available in this warehouse.", + "fieldname": "hub_warehouse", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Hub Warehouse", + "length": 0, + "no_copy": 0, + "options": "Warehouse", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "fieldname": "synced_with_hub", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Synced With Hub", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 } ], "has_web_view": 0, diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index a810665997..3f71db89af 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -52,7 +52,8 @@ class Item(WebsiteGenerator): if not self.description: self.description = self.item_name - self.publish_in_hub = 1 + if self.is_sales_item and not self.is_hub_item: + self.publish_in_hub = 1 def after_insert(self): '''set opening stock and item price''' @@ -63,6 +64,10 @@ class Item(WebsiteGenerator): self.set_opening_stock() def validate(self): + self.before_update = None + if frappe.db.exists('Item', self.name): + self.before_update = frappe.get_doc('Item', self.name) + super(Item, self).validate() if not self.item_name: @@ -815,4 +820,3 @@ def check_stock_uom_with_bin(item, stock_uom): if not matched: frappe.throw(_("Default Unit of Measure for Item {0} cannot be changed directly because you have already made some transaction(s) with another UOM. You will need to create a new Item to use a different Default UOM.").format(item)) - diff --git a/erpnext/stock/doctype/item/test_item.js b/erpnext/stock/doctype/item/test_item.js new file mode 100644 index 0000000000..af44278a59 --- /dev/null +++ b/erpnext/stock/doctype/item/test_item.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Item", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Item + () => frappe.tests.make('Item', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/erpnext/templates/includes/product_page.js b/erpnext/templates/includes/product_page.js index b2d5ad952b..93dadaa589 100644 --- a/erpnext/templates/includes/product_page.js +++ b/erpnext/templates/includes/product_page.js @@ -7,7 +7,7 @@ frappe.ready(function() { frappe.call({ type: "POST", - method: "erpnext.shopping_cart.product.get_product_info", + method: "erpnext.shopping_cart.product_info.get_product_info_for_website", args: { item_code: get_item_code() }, diff --git a/erpnext/shopping_cart/product.py b/erpnext/utilities/product.py similarity index 50% rename from erpnext/shopping_cart/product.py rename to erpnext/utilities/product.py index 0d6eccd62b..1ad8b6e5ee 100644 --- a/erpnext/shopping_cart/product.py +++ b/erpnext/utilities/product.py @@ -5,51 +5,15 @@ from __future__ import unicode_literals import frappe from frappe.utils import cint, fmt_money, flt -from erpnext.shopping_cart.cart import _get_cart_quotation -from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings \ - import is_cart_enabled, get_shopping_cart_settings, show_quantity_in_website from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_for_item -@frappe.whitelist(allow_guest=True) -def get_product_info(item_code): - """get product price / stock info""" - if not is_cart_enabled(): - return {} - - qty = 0 - cart_quotation = _get_cart_quotation() - template_item_code = frappe.db.get_value("Item", item_code, "variant_of") - stock_status = get_qty_in_stock(item_code, template_item_code) - in_stock = stock_status.in_stock - stock_qty = stock_status.stock_qty - price = get_price(item_code, template_item_code, cart_quotation.selling_price_list) - - if price: - price["formatted_price"] = fmt_money(price["price_list_rate"], currency=price["currency"]) - - price["currency"] = not cint(frappe.db.get_default("hide_currency_symbol")) \ - and (frappe.db.get_value("Currency", price.currency, "symbol") or price.currency) \ - or "" - - if frappe.session.user != "Guest": - item = cart_quotation.get({"item_code": item_code}) - if item: - qty = item[0].qty - - return { - "price": price, - "stock_qty": stock_qty, - "in_stock": in_stock, - "uom": frappe.db.get_value("Item", item_code, "stock_uom"), - "qty": qty, - "show_stock_qty": show_quantity_in_website() - } - -def get_qty_in_stock(item_code, template_item_code): +def get_qty_in_stock(item_code, item_warehouse_field): in_stock, stock_qty = 0, '' - warehouse = frappe.db.get_value("Item", item_code, "website_warehouse") + template_item_code = frappe.db.get_value("Item", item_code, "variant_of") + + warehouse = frappe.db.get_value("Item", item_code, item_warehouse_field) if not warehouse and template_item_code and template_item_code != item_code: - warehouse = frappe.db.get_value("Item", template_item_code, "website_warehouse") + warehouse = frappe.db.get_value("Item", template_item_code, item_warehouse_field) if warehouse: stock_qty = frappe.db.sql("""select actual_qty from tabBin where @@ -59,10 +23,10 @@ def get_qty_in_stock(item_code, template_item_code): return frappe._dict({"in_stock": in_stock, "stock_qty": stock_qty}) -def get_price(item_code, template_item_code, price_list, qty=1): - if price_list: - cart_settings = get_shopping_cart_settings() +def get_price(item_code, price_list, customer_group, company, qty=1): + template_item_code = frappe.db.get_value("Item", item_code, "variant_of") + if price_list: price = frappe.get_all("Item Price", fields=["price_list_rate", "currency"], filters={"price_list": price_list, "item_code": item_code}) @@ -76,8 +40,8 @@ def get_price(item_code, template_item_code, price_list, qty=1): "qty": qty, "transaction_type": "selling", "price_list": price_list, - "customer_group": cart_settings.default_customer_group, - "company": cart_settings.company, + "customer_group": customer_group, + "company": company, "conversion_rate": 1, "for_shopping_cart": True })) @@ -89,4 +53,21 @@ def get_price(item_code, template_item_code, price_list, qty=1): if pricing_rule.pricing_rule_for == "Price": price[0].price_list_rate = pricing_rule.price_list_rate - return price[0] + price_obj = price[0] + if price_obj: + price_obj["formatted_price"] = fmt_money(price_obj["price_list_rate"], currency=price_obj["currency"]) + + price_obj["currency_symbol"] = not cint(frappe.db.get_default("hide_currency_symbol")) \ + and (frappe.db.get_value("Currency", price_obj.currency, "symbol") or price_obj.currency) \ + or "" + + if not price_obj["price_list_rate"]: + price_obj["price_list_rate"] = 0 + + if not price_obj["currency"]: + price_obj["currency"] = "" + + if not price_obj["formatted_price"]: + price_obj["formatted_price"] = "" + + return price_obj From e87a076f1d2da5f0691e10f7b7da84a6f41bad13 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 5 Oct 2017 12:20:20 +0530 Subject: [PATCH 63/81] Update link in the pos for offline and online mode from pos settings (#11061) --- .../accounts/doctype/pos_settings/pos_settings.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pos_settings/pos_settings.py b/erpnext/accounts/doctype/pos_settings/pos_settings.py index 736d36eea9..13a50042fb 100644 --- a/erpnext/accounts/doctype/pos_settings/pos_settings.py +++ b/erpnext/accounts/doctype/pos_settings/pos_settings.py @@ -3,7 +3,17 @@ # For license information, please see license.txt from __future__ import unicode_literals +import frappe from frappe.model.document import Document class POSSettings(Document): - pass \ No newline at end of file + def validate(self): + self.set_link_for_pos() + + def set_link_for_pos(self): + link = 'pos' if self.use_pos_in_offline_mode else 'point-of-sale' + desktop_icon = frappe.db.get_value('Desktop Icon', + {'standard': 1, 'module_name': 'POS'}, 'name') + + if desktop_icon: + frappe.db.set_value('Desktop Icon', desktop_icon, 'link', link) \ No newline at end of file From 7d4fd35aa3604e2195adb0a1079184f151e57884 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Oct 2017 12:20:33 +0530 Subject: [PATCH 64/81] Add POS Settings link in Accounts module (#11060) --- erpnext/config/accounts.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py index 7c0f540154..cdce13ba35 100644 --- a/erpnext/config/accounts.py +++ b/erpnext/config/accounts.py @@ -315,11 +315,16 @@ def get_data(): "name": "Payment Gateway Account", "description": _("Setup Gateway accounts.") }, + { + "type": "doctype", + "name": "POS Settings", + "description": _("Setup mode of POS (Online / Offline)") + }, { "type": "doctype", "name": "POS Profile", "label": _("Point-of-Sale Profile"), - "description": _("Rules to calculate shipping amount for a sale") + "description": _("Setup default values for POS Invoices") }, { "type": "doctype", From 729aa2025a06bc45a38b91e23a9a9e35214b58a3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Oct 2017 12:21:36 +0530 Subject: [PATCH 65/81] Show commission section for pos as well (#11059) --- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index be01184882..28a5d01aa8 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -339,7 +339,7 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_ // ------------ cur_frm.cscript.hide_fields = function(doc) { var parent_fields = ['project', 'due_date', 'is_opening', 'source', 'total_advance', 'get_advances', - 'advances', 'sales_partner', 'commission_rate', 'total_commission', 'advances', 'from_date', 'to_date']; + 'advances', 'advances', 'from_date', 'to_date']; if(cint(doc.is_pos) == 1) { hide_field(parent_fields); From d6d99e0d59077e12ceaf201cf5482aca9beafa0d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Oct 2017 12:39:42 +0530 Subject: [PATCH 66/81] Removed duplicate field related to hub from Item --- erpnext/stock/doctype/item/item.json | 95 ---------------------------- 1 file changed, 95 deletions(-) diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 7b46b0a7cd..dc057a65ff 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -264,38 +264,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "is_hub_item", - "fieldname": "hub_category", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Hub Category", - "length": 0, - "no_copy": 0, - "options": "Hub Category", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -2193,69 +2161,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "0", - "description": "Publish Item to hub.erpnext.com", - "fieldname": "publish_in_hub", - "fieldtype": "Check", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Publish in Hub", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "0", - "fieldname": "synced_with_hub", - "fieldtype": "Check", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Synced With Hub", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, From 26507d786729e6575a7c6203550a4c1efe901cb4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Oct 2017 13:10:32 +0530 Subject: [PATCH 67/81] Removed deprecated hub functions --- erpnext/hooks.py | 4 +--- erpnext/hub_node/doctype/hub_settings/hub_settings.py | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 4e22757711..4206ed2811 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -208,9 +208,7 @@ scheduler_events = { "erpnext.stock.doctype.serial_no.serial_no.update_maintenance_status", "erpnext.buying.doctype.supplier_scorecard.supplier_scorecard.refresh_scorecards", "erpnext.setup.doctype.company.company.cache_companies_monthly_sales_history", - "erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool.update_latest_price_in_all_boms", - "erpnext.hub_node.doctype.hub_settings.hub_settings.sync_item_fields_at_hub", - "erpnext.hub_node.update_local_hub_categories" + "erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool.update_latest_price_in_all_boms" ] } diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.py b/erpnext/hub_node/doctype/hub_settings/hub_settings.py index 7e54b654e3..50069cea80 100644 --- a/erpnext/hub_node/doctype/hub_settings/hub_settings.py +++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.py @@ -10,8 +10,8 @@ from frappe import _ from erpnext.utilities.product import get_price, get_qty_in_stock from six import string_types -hub_url = "http://erpnext.hub:8000" -# hub_url = "https://hub.erpnext.org" +# hub_url = "http://erpnext.hub:8000" +hub_url = "https://hub.erpnext.org" # hub_url = "http://192.168.29.145:3000" class HubSetupError(frappe.ValidationError): pass From f7a856b913d2eeb1b9ddd9f84dad7a26be17cde1 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 5 Oct 2017 13:31:29 +0530 Subject: [PATCH 68/81] [Fix] Rate not fetched in the POS, User trying to add an item in the cart before loading of frm --- erpnext/selling/page/point_of_sale/point_of_sale.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index 1b0b9eb392..726e80f28d 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -49,11 +49,12 @@ erpnext.pos.PointOfSale = class PointOfSale { this.set_online_status(); }, () => this.setup_pos_profile(), + () => this.make_new_invoice(), () => { + frappe.timeout(1); this.make_items(); this.bind_events(); }, - () => this.make_new_invoice(), () => this.page.set_title(__('Point of Sale')) ]); } From 8c3d19e2ab6b52dba70764750cd49f2e14399a1a Mon Sep 17 00:00:00 2001 From: mbauskar Date: Thu, 5 Oct 2017 14:06:49 +0600 Subject: [PATCH 69/81] bumped to version 9.1.1 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 55628cc676..259c0f0549 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from erpnext.hooks import regional_overrides -__version__ = '9.1.0' +__version__ = '9.1.1' def get_default_company(user=None): '''Get default company for user''' From 25db832be122089e4c3898a45a73b03594c97ba9 Mon Sep 17 00:00:00 2001 From: Doridel Cahanap Date: Thu, 5 Oct 2017 16:50:43 +0800 Subject: [PATCH 70/81] [minor] Add "Attendance" in grid view for Training Event Employee (#11063) --- .../training_event_employee/training_event_employee.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/training_event_employee/training_event_employee.json b/erpnext/hr/doctype/training_event_employee/training_event_employee.json index a8a72b1a70..76adcb0ed2 100644 --- a/erpnext/hr/doctype/training_event_employee/training_event_employee.json +++ b/erpnext/hr/doctype/training_event_employee/training_event_employee.json @@ -147,7 +147,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 0, + "in_list_view": 1, "in_standard_filter": 0, "label": "Attendance", "length": 0, @@ -176,7 +176,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-08-11 03:36:22.738253", + "modified": "2017-10-05 08:49:41.869998", "modified_by": "Administrator", "module": "HR", "name": "Training Event Employee", From 0518001bdc45a10f5d757d484c54501e25e5b585 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Thu, 5 Oct 2017 14:31:31 +0530 Subject: [PATCH 71/81] Changes in Student Admission (#11019) * configurable student admission * validate dob and admission date from student admission * add in hooks and fix codacy --- erpnext/hooks.py | 3 +- .../student_admission/student_admission.json | 353 ++++++------------ .../student_admission/student_admission.py | 35 +- .../templates/student_admission.html | 74 ++++ .../templates/student_admission_row.html | 36 ++ .../student_admission_program/__init__.py | 0 .../student_admission_program.json | 222 +++++++++++ .../student_admission_program.py | 9 + .../student_applicant/student_applicant.py | 33 +- 9 files changed, 516 insertions(+), 249 deletions(-) create mode 100644 erpnext/schools/doctype/student_admission/templates/student_admission.html create mode 100644 erpnext/schools/doctype/student_admission/templates/student_admission_row.html create mode 100644 erpnext/schools/doctype/student_admission_program/__init__.py create mode 100644 erpnext/schools/doctype/student_admission_program/student_admission_program.json create mode 100644 erpnext/schools/doctype/student_admission_program/student_admission_program.py diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 4206ed2811..bf6f5aac86 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -133,7 +133,8 @@ standard_portal_menu_items = [ {"title": _("Prescription"), "route": "/prescription", "reference_doctype": "Consultation", "role":"Patient"}, {"title": _("Patient Appointment"), "route": "/patient-appointments", "reference_doctype": "Patient Appointment", "role":"Patient"}, {"title": _("Fees"), "route": "/fees", "reference_doctype": "Fees", "role":"Student"}, - {"title": _("Newsletter"), "route": "/newsletters", "reference_doctype": "Newsletter"} + {"title": _("Newsletter"), "route": "/newsletters", "reference_doctype": "Newsletter"}, + {"title": _("Admission"), "route": "/admissions", "reference_doctype": "Student Admission"} ] default_roles = [ diff --git a/erpnext/schools/doctype/student_admission/student_admission.json b/erpnext/schools/doctype/student_admission/student_admission.json index 4801e51163..c35d5be393 100644 --- a/erpnext/schools/doctype/student_admission/student_admission.json +++ b/erpnext/schools/doctype/student_admission/student_admission.json @@ -1,6 +1,6 @@ { "allow_copy": 0, - "allow_guest_to_view": 0, + "allow_guest_to_view": 1, "allow_import": 0, "allow_rename": 1, "autoname": "", @@ -12,97 +12,6 @@ "document_type": "Document", "editable_grid": 1, "fields": [ - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "academic_year", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Academic Year", - "length": 0, - "no_copy": 0, - "options": "Academic Year", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "admission_start_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Admission Start Date", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "admission_end_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Admission End Date", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -139,7 +48,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "naming_series_for_student_applicant", + "depends_on": "", + "fieldname": "route", "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, @@ -148,9 +58,9 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Naming Series (for Student Applicant)", + "label": "Route", "length": 0, - "no_copy": 0, + "no_copy": 1, "permlevel": 0, "precision": "", "print_hide": 0, @@ -161,7 +71,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "unique": 0 + "unique": 1 }, { "allow_bulk_edit": 0, @@ -169,8 +79,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "publish", - "fieldtype": "Check", + "fieldname": "application_form_route", + "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -178,7 +88,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Publish on website", + "label": "Application Form Route", "length": 0, "no_copy": 0, "permlevel": 0, @@ -188,7 +98,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -228,112 +138,19 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "program", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Program", - "length": 0, - "no_copy": 0, - "options": "Program", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "application_fee", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Application Fee", - "length": 0, - "no_copy": 0, - "options": "currency", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "currency", + "fieldname": "academic_year", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Currency", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Academic Year", "length": 0, - "no_copy": 0, - "options": "Currency", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "route", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Route", - "length": 0, - "no_copy": 0, + "no_copy": 1, + "options": "Academic Year", "permlevel": 0, "precision": "", "print_hide": 0, @@ -344,7 +161,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "unique": 1 + "unique": 0 }, { "allow_bulk_edit": 0, @@ -352,8 +169,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "application_form_route", - "fieldtype": "Data", + "fieldname": "admission_start_date", + "fieldtype": "Date", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -361,7 +178,67 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Application Form Route", + "label": "Admission Start Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "admission_end_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Admission End Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "published", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Publish on website", "length": 0, "no_copy": 0, "permlevel": 0, @@ -391,6 +268,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Eligibility and Details", "length": 0, "no_copy": 0, "permlevel": 0, @@ -405,6 +283,37 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "program_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Eligibility and Details", + "length": 0, + "no_copy": 0, + "options": "Student Admission Program", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -434,49 +343,20 @@ "search_index": 0, "set_only_once": 0, "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "eligibility", - "fieldtype": "Text Editor", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Eligibility", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 } ], - "has_web_view": 0, + "has_web_view": 1, "hide_heading": 0, "hide_toolbar": 0, "idx": 0, "image_view": 0, "in_create": 0, + "is_published_field": "published", "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-06-30 08:21:50.722286", + "modified": "2017-10-02 15:16:44.386000", "modified_by": "Administrator", "module": "Schools", "name": "Student Admission", @@ -504,10 +384,11 @@ "write": 1 } ], - "quick_entry": 1, + "quick_entry": 0, "read_only": 0, "read_only_onload": 0, "restrict_to_domain": "Education", + "route": "admissions", "show_name_in_global_search": 1, "sort_field": "modified", "sort_order": "DESC", diff --git a/erpnext/schools/doctype/student_admission/student_admission.py b/erpnext/schools/doctype/student_admission/student_admission.py index a849d65d7b..e166b9b5e8 100644 --- a/erpnext/schools/doctype/student_admission/student_admission.py +++ b/erpnext/schools/doctype/student_admission/student_admission.py @@ -4,26 +4,41 @@ from __future__ import unicode_literals import frappe -from frappe.website.website_generator import WebsiteGenerator from frappe import _ +from frappe.utils import nowdate +from frappe.website.website_generator import WebsiteGenerator + class StudentAdmission(WebsiteGenerator): - website = frappe._dict( - template = "templates/generators/student_admission.html", - condition_field = "publish", - page_title_field = "title" - ) - def autoname(self): if not self.title: self.title = self.get_title() self.name = self.title + def validate(self): + if not self.route: #pylint: disable=E0203 + self.route = "admissions/" + "-".join(self.title.split(" ")) + def get_context(self, context): - context.parents = [{'name': 'admissions', 'title': _('All Student Admissions') }] + context.no_cache = 1 + context.show_sidebar = True + context.title = self.title + context.parents = [{'name': 'admissions', 'title': _('All Student Admissions'), 'route': 'admissions' }] def get_title(self): return _("Admissions for {0}").format(self.academic_year) -def get_list_context(context): - context.title = _("Student Admissions") + +def get_list_context(context=None): + context.update({ + "show_sidebar": True, + "title": _("Student Admissions"), + "get_list": get_admission_list, + "row_template": "schools/doctype/student_admission/templates/student_admission_row.html", + }) + +def get_admission_list(doctype, txt, filters, limit_start, limit_page_length=20, order_by="modified"): + return frappe.db.sql('''select name, title, academic_year, modified, admission_start_date, route, + admission_end_date from `tabStudent Admission` where published=1 and admission_end_date >= %s + order by admission_end_date asc limit {0}, {1} + '''.format(limit_start, limit_page_length), [nowdate()], as_dict=1) diff --git a/erpnext/schools/doctype/student_admission/templates/student_admission.html b/erpnext/schools/doctype/student_admission/templates/student_admission.html new file mode 100644 index 0000000000..25afaca84d --- /dev/null +++ b/erpnext/schools/doctype/student_admission/templates/student_admission.html @@ -0,0 +1,74 @@ + +{% extends "templates/web.html" %} + +{% block breadcrumbs %} + {% include "templates/includes/breadcrumbs.html" %} +{% endblock %} + +{% block header %} +

    {{ title }}

    +{% endblock %} + +{% block page_content %} + {% set today = frappe.utils.getdate(frappe.utils.nowdate()) %} +
    +
    + Application will be closed soon + {% elif frappe.utils.getdate(doc.admission_end_date) > today >= frappe.utils.getdate(doc.admission_start_date)%} + green"> Application open + {% elif frappe.utils.getdate(doc.admission_start_date) > today %} + blue"> Application will open + {% else %} + darkgrey + {% endif %} + +
    +
    + {{ _("Start on") }}: {{ frappe.format_date(admission_start_date) }}
    + {{ _("End on") }}: {{ frappe.format_date(admission_end_date) }} +
    +

    + + {%- if introduction -%} +
    {{ introduction }}
    + {% endif %} + + {% if program_details %} +
    +
    +

    Eligibility and Other Details:

    + + + + + + + + + + + {% for row in program_details %} + + + + + + + {% endfor %} + +
    Program/Std.Minumum Age(DOB)Maximum Age(DOB)Application Fee
    {{ row.program }}{{ row.minimum_age }}{{ row.maximum_age }}{{ row.application_fee }}
    +
    + {% endif %} + + {%- if application_form_route -%} +
    +

    + + {{ _("Apply Now") }} +

    + {% endif %} + +{% endblock %} diff --git a/erpnext/schools/doctype/student_admission/templates/student_admission_row.html b/erpnext/schools/doctype/student_admission/templates/student_admission_row.html new file mode 100644 index 0000000000..e049773037 --- /dev/null +++ b/erpnext/schools/doctype/student_admission/templates/student_admission_row.html @@ -0,0 +1,36 @@ + \ No newline at end of file diff --git a/erpnext/schools/doctype/student_admission_program/__init__.py b/erpnext/schools/doctype/student_admission_program/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/student_admission_program/student_admission_program.json b/erpnext/schools/doctype/student_admission_program/student_admission_program.json new file mode 100644 index 0000000000..29bb57fbd5 --- /dev/null +++ b/erpnext/schools/doctype/student_admission_program/student_admission_program.json @@ -0,0 +1,222 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "", + "beta": 0, + "creation": "2017-09-15 12:59:43.207923", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "program", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Program", + "length": 0, + "no_copy": 0, + "options": "Program", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "minimum_age", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Minimum Age", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "maximum_age", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Maximum Age", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "application_fee", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Application Fee", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "applicant_naming_series", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Naming Series (for Student Applicant)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2017-10-02 17:13:52.586218", + "modified_by": "Administrator", + "module": "Schools", + "name": "Student Admission Program", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/student_admission_program/student_admission_program.py b/erpnext/schools/doctype/student_admission_program/student_admission_program.py new file mode 100644 index 0000000000..406027ca2c --- /dev/null +++ b/erpnext/schools/doctype/student_admission_program/student_admission_program.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document + +class StudentAdmissionProgram(Document): + pass diff --git a/erpnext/schools/doctype/student_applicant/student_applicant.py b/erpnext/schools/doctype/student_applicant/student_applicant.py index aeeffcedac..7fa44a65e6 100644 --- a/erpnext/schools/doctype/student_applicant/student_applicant.py +++ b/erpnext/schools/doctype/student_applicant/student_applicant.py @@ -6,13 +6,18 @@ from __future__ import print_function, unicode_literals import frappe from frappe import _ from frappe.model.document import Document +from frappe.utils import getdate class StudentApplicant(Document): def autoname(self): from frappe.model.naming import set_name_by_naming_series if self.student_admission: - naming_series = frappe.db.get_value('Student Admission', self.student_admission, - 'naming_series_for_student_applicant') + if self.program: + student_admission = get_student_admission_data(self.student_admission, self.program) + if student_admission: + naming_series = student_admission.get("applicant_naming_series") + else: + frappe.throw(_("Select the program first")) if naming_series: self.naming_series = naming_series @@ -21,11 +26,35 @@ class StudentApplicant(Document): def validate(self): self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name])) + if self.student_admission and self.program and self.date_of_birth: + self.validation_from_student_admission() def on_update_after_submit(self): student = frappe.get_list("Student", filters= {"student_applicant": self.name}) if student: frappe.throw(_("Cannot change status as student {0} is linked with student application {1}").format(student[0].name, self.name)) + def on_submit(self): + if self.paid and not self.student_admission: + frappe.throw(_("Please select Student Admission which is mandatory for the paid student applicant")) + + def validation_from_student_admission(self): + student_admission = get_student_admission_data(self.student_admission, self.program) + if student_admission: + if not (getdate(student_admission.minimum_age) >= getdate(self.date_of_birth) >= + getdate(student_admission.maximum_age)): + frappe.throw(_("Not eligible for the admission in this program as per DOB")) + def on_payment_authorized(self, *args, **kwargs): self.db_set('paid', 1) + + +def get_student_admission_data(student_admission, program): + student_admission = frappe.db.sql("""select sa.admission_start_date, sa.admission_end_date, + sap.program, sap.minimum_age, sap.maximum_age, sap.applicant_naming_series + from `tabStudent Admission` sa, `tabStudent Admission Program` sap + where sa.name = sap.parent and sa.name = %s and sap.program = %s""", (student_admission, program), as_dict=1) + if student_admission: + return student_admission[0] + else: + return None From 34ad2e6a60a458fa78e36c418e7bd53edd57836c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 5 Oct 2017 15:28:43 +0530 Subject: [PATCH 72/81] Use format_currency only if fieldtype is currency --- .../report/salary_register/salary_register.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/hr/report/salary_register/salary_register.html b/erpnext/hr/report/salary_register/salary_register.html index 6c372b7501..4c7e1d1d3a 100644 --- a/erpnext/hr/report/salary_register/salary_register.html +++ b/erpnext/hr/report/salary_register/salary_register.html @@ -12,21 +12,21 @@ {% } %} - + {% for(var j=0, k=data.length; j {% for(var i=1, l=report.columns.length; i {% var fieldname = report.columns[i].field; %} - {% if (!isNaN(row[fieldname])) { %} - {%= format_currency(row[fieldname]) %} - {% } else { %} - {% if (!is_null(row[fieldname])) { %} - {%= row[fieldname] %} - {% } %} + {% if (report.columns[i].fieldtype=='Currency' && !isNaN(row[fieldname])) { %} + {%= format_currency(row[fieldname]) %} + {% } else { %} + {% if (!is_null(row[fieldname])) { %} + {%= row[fieldname] %} + {% } %} {% } %} {% } %} From ea390effa557216b5985585e26a19ce706c2680c Mon Sep 17 00:00:00 2001 From: Stavros Anastasiadis Date: Thu, 5 Oct 2017 13:01:25 +0300 Subject: [PATCH 73/81] Add multirows in Attendees selection (#11067) --- erpnext/hr/doctype/training_event/training_event.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/training_event/training_event.js b/erpnext/hr/doctype/training_event/training_event.js index 6a6e8fe0a6..12bc920b18 100644 --- a/erpnext/hr/doctype/training_event/training_event.js +++ b/erpnext/hr/doctype/training_event/training_event.js @@ -2,6 +2,9 @@ // For license information, please see license.txt frappe.ui.form.on('Training Event', { + onload_post_render: function(frm) { + frm.get_field("employees").grid.set_multiple_add("employee"); + }, refresh: function(frm) { if(!frm.doc.__islocal) { frm.add_custom_button(__("Training Result"), function() { @@ -18,4 +21,4 @@ frappe.ui.form.on('Training Event', { }); } } -}); \ No newline at end of file +}); From 975d28307a389efa4bb9f3feefab22b039544e75 Mon Sep 17 00:00:00 2001 From: Utkarsh Goswami Date: Thu, 5 Oct 2017 15:59:51 +0530 Subject: [PATCH 74/81] Payroll feature (#10900) --- .../doctype/salary_detail/salary_detail.json | 47 ++++++++++++++++++- erpnext/hr/doctype/salary_slip/salary_slip.js | 10 +++- erpnext/hr/doctype/salary_slip/salary_slip.py | 7 ++- 3 files changed, 58 insertions(+), 6 deletions(-) diff --git a/erpnext/hr/doctype/salary_detail/salary_detail.json b/erpnext/hr/doctype/salary_detail/salary_detail.json index d131295765..01d02779b7 100644 --- a/erpnext/hr/doctype/salary_detail/salary_detail.json +++ b/erpnext/hr/doctype/salary_detail/salary_detail.json @@ -12,6 +12,7 @@ "editable_grid": 1, "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -42,6 +43,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -73,6 +75,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -101,6 +104,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -131,6 +135,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -159,6 +164,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -189,6 +195,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -221,6 +228,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -253,6 +261,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -284,6 +293,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -314,6 +324,37 @@ "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "do_not_include_in_total", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Do not include in total", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -345,6 +386,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -374,6 +416,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -415,8 +458,8 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-04-13 00:47:33.980646", - "modified_by": "chude.osiegbu@manqala.com", + "modified": "2017-10-02 13:57:22.769751", + "modified_by": "Administrator", "module": "HR", "name": "Salary Detail", "name_case": "", diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.js b/erpnext/hr/doctype/salary_slip/salary_slip.js index de3276c8e3..24f2016bd6 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.js +++ b/erpnext/hr/doctype/salary_slip/salary_slip.js @@ -158,14 +158,18 @@ var calculate_earning_total = function(doc, dt, dn, reset_amount) { var total_earn = 0; for(var i = 0; i < tbl.length; i++){ if(cint(tbl[i].depends_on_lwp) == 1) { + tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days) / cint(doc.total_working_days)*100)/100; refresh_field('amount', tbl[i].name, 'earnings'); + } else if(reset_amount) { tbl[i].amount = tbl[i].default_amount; refresh_field('amount', tbl[i].name, 'earnings'); } - total_earn += flt(tbl[i].amount); + if(!tbl[i].do_not_include_in_total) { + total_earn += flt(tbl[i].amount); + } } doc.gross_pay = total_earn; refresh_many(['amount','gross_pay']); @@ -184,7 +188,9 @@ var calculate_ded_total = function(doc, dt, dn, reset_amount) { tbl[i].amount = tbl[i].default_amount; refresh_field('amount', tbl[i].name, 'deductions'); } - total_ded += flt(tbl[i].amount); + if(!tbl[i].do_not_include_in_total) { + total_ded += flt(tbl[i].amount); + } } doc.total_deduction = total_ded; refresh_field('total_deduction'); diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index 356104e69c..f769d6f3db 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -69,7 +69,8 @@ class SalarySlip(TransactionBase): 'amount': amount, 'default_amount': amount, 'depends_on_lwp' : struct_row.depends_on_lwp, - 'salary_component' : struct_row.salary_component + 'salary_component' : struct_row.salary_component, + 'do_not_include_in_total' : struct_row.do_not_include_in_total }) else: component_row.amount = amount @@ -345,11 +346,13 @@ class SalarySlip(TransactionBase): (flt(d.default_amount) * flt(self.payment_days) / cint(self.total_working_days)), self.precision("amount", component_type) ) + elif not self.payment_days and not self.salary_slip_based_on_timesheet: d.amount = 0 elif not d.amount: d.amount = d.default_amount - self.set(total_field, self.get(total_field) + flt(d.amount)) + if not d.do_not_include_in_total: + self.set(total_field, self.get(total_field) + flt(d.amount)) def calculate_net_pay(self): if self.salary_structure: From 4cb4d2f1550581b69b773dcf150eacf8a077b6c6 Mon Sep 17 00:00:00 2001 From: Utkarsh Goswami Date: Thu, 5 Oct 2017 16:51:42 +0530 Subject: [PATCH 75/81] Tests for payment entry against purchase invoice (#10930) --- .../test_payment_against_purchase_invoice.js | 60 +++++++++++++++++++ .../purchase_invoice/test_purchase_invoice.js | 3 +- erpnext/tests/ui/tests.txt | 1 + 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 erpnext/accounts/doctype/payment_entry/tests/test_payment_against_purchase_invoice.js diff --git a/erpnext/accounts/doctype/payment_entry/tests/test_payment_against_purchase_invoice.js b/erpnext/accounts/doctype/payment_entry/tests/test_payment_against_purchase_invoice.js new file mode 100644 index 0000000000..14aa0736d4 --- /dev/null +++ b/erpnext/accounts/doctype/payment_entry/tests/test_payment_against_purchase_invoice.js @@ -0,0 +1,60 @@ +QUnit.module('Payment Entry'); + +QUnit.test("test payment entry", function(assert) { + assert.expect(7 ); + let done = assert.async(); + + frappe.run_serially([ + () => { + return frappe.tests.make('Purchase Invoice', [ + {supplier: 'Test Supplier'}, + {bill_no: 'in1234'}, + {items: [ + [ + {'qty': 2}, + {'item_code': 'Test Product 1'}, + {'rate':1000}, + ] + ]}, + {update_stock:1}, + {supplier_address: 'Test1-Billing'}, + {contact_person: 'Contact 3-Test Supplier'}, + {tc_name: 'Test Term 1'}, + {terms: 'This is just a Test'} + ]); + }, + + () => cur_frm.save(), + () => frappe.tests.click_button('Submit'), + () => frappe.tests.click_button('Yes'), + () => frappe.timeout(1), + () => frappe.click_button('Make'), + () => frappe.timeout(2), + () => frappe.click_link('Payment'), + () => frappe.timeout(3), + () => cur_frm.set_value('mode_of_payment','Cash'), + () => frappe.timeout(3), + () => { + assert.equal(frappe.get_route()[1], 'Payment Entry', + 'made payment entry'); + assert.equal(cur_frm.doc.party, 'Test Supplier', + 'supplier set in payment entry'); + assert.equal(cur_frm.doc.paid_amount, 2000, + 'paid amount set in payment entry'); + assert.equal(cur_frm.doc.references[0].allocated_amount, 2000, + 'amount allocated against purchase invoice'); + assert.equal(cur_frm.doc.references[0].bill_no, 'in1234', + 'invoice number allocated against purchase invoice'); + assert.equal(cur_frm.get_field('total_allocated_amount').value, 2000, + 'correct amount allocated in Write Off'); + assert.equal(cur_frm.get_field('unallocated_amount').value, 0, + 'correct amount unallocated in Write Off'); + }, + + () => cur_frm.save(), + () => frappe.tests.click_button('Submit'), + () => frappe.tests.click_button('Yes'), + () => frappe.timeout(3), + () => done() + ]); +}); \ No newline at end of file diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js index 6e33e1d7f2..e01dda32bf 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js @@ -7,6 +7,7 @@ QUnit.test("test purchase invoice", function(assert) { () => { return frappe.tests.make('Purchase Invoice', [ {supplier: 'Test Supplier'}, + {bill_no: 'in123'}, {items: [ [ {'qty': 5}, @@ -36,7 +37,7 @@ QUnit.test("test purchase invoice", function(assert) { }, () => frappe.tests.click_button('Submit'), () => frappe.tests.click_button('Yes'), - () => frappe.timeout(0.3), + () => frappe.timeout(1), () => done() ]); }); diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt index 199d886deb..f35f6d7bc1 100644 --- a/erpnext/tests/ui/tests.txt +++ b/erpnext/tests/ui/tests.txt @@ -86,6 +86,7 @@ erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice.js erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment.js erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_payment_request.js erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.js +erpnext/accounts/doctype/payment_entry/tests/test_payment_against_purchase_invoice.js erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_item_wise_discount.js erpnext/buying/doctype/purchase_order/tests/test_purchase_order.js erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_multi_uom.js From 9c0d30a087662f89d9c799884b45c1af2a08d0b0 Mon Sep 17 00:00:00 2001 From: AravindPranera Date: Thu, 5 Oct 2017 17:08:32 +0530 Subject: [PATCH 76/81] Fetching Document ID also in Email Subject while clicking "Send Supplier Emails" button (#10874) --- .../doctype/request_for_quotation/request_for_quotation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py index 97c4438dd3..5becb825dc 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py @@ -138,7 +138,7 @@ class RequestforQuotation(BuyingController): 'user_fullname': full_name } - subject = _("Request for Quotation") + subject = _("Request for Quotation: {0}".format(self.name)) template = "templates/emails/request_for_quotation.html" sender = frappe.session.user not in STANDARD_USERS and frappe.session.user or None message = frappe.get_template(template).render(args) From 925e9776e8b4306e8d0e0b73c563eb451b959baa Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Thu, 5 Oct 2017 17:17:41 +0530 Subject: [PATCH 77/81] [hub] rename is_hub_item to is_item_from_hub (#11069) * [hub] rename is_hub_item to is_item_from_hub * [rename] is_hub_item to is_item_from_hub --- erpnext/hub_node/__init__.py | 111 +- erpnext/stock/doctype/item/item.json | 6552 +++++++++++++------------- erpnext/stock/doctype/item/item.py | 2 +- 3 files changed, 3278 insertions(+), 3387 deletions(-) diff --git a/erpnext/hub_node/__init__.py b/erpnext/hub_node/__init__.py index 1756b764a9..8889df1398 100644 --- a/erpnext/hub_node/__init__.py +++ b/erpnext/hub_node/__init__.py @@ -56,115 +56,6 @@ def make_opportunity(buyer_name, email_id): o.lead = frappe.get_all("Lead", filters={"email_id": email_id}, fields = ["name"])[0]["name"] o.save(ignore_permissions=True) -# @frappe.whitelist() -# def get_items(text='', by_item_codes=0, start=0, limit=20, order_by='', category=None, company_name=None, country=None): -# item_codes = [] -# if cint(by_item_codes): -# item_codes = [d["item_code"] for d in frappe.get_all("Item", fields=["item_code"], filters={"is_hub_item": "1"}, -# limit_start = start, limit_page_length = limit)] -# if not item_codes: -# return [] - -# args = { -# "text": text, -# "item_codes": item_codes, -# "category": category, -# "company_name": company_name, -# "country": country, -# "order_by": order_by, -# "start": start, -# "limit": limit -# } -# return hub_request('get_items', data=json.dumps(args)) - -# @frappe.whitelist() -# def get_all_companies(): -# return hub_request('get_all_companies') - -# @frappe.whitelist() -# def get_item_details(item_code): -# args = { -# "item_code": item_code, -# } -# return hub_request('get_item_details', data=json.dumps(args)) - -# @frappe.whitelist() -# def get_company_details(company_id): -# args = { -# "company_id": company_id, -# } -# return hub_request('get_company_details', data=json.dumps(args)) - -# @frappe.whitelist() -# def get_categories(): -# # update_local_hub_categories() -# return hub_request('get_categories') - -# def update_local_hub_categories(): -# categories = get_categories() -# categories_to_remove = [] -# categories_to_add = [] -# old_categories = frappe.db.sql_list("select category_name from from `tabHub Category`") -# new_categories = [d.category_name for d in categories] -# for old_category in old_categories: -# if old_category not in new_categories: -# categories_to_remove.append(old_category) - -# for new_category in new_categories: -# if new_category not in old_categories: -# categories_to_add.append(new_category) - -# for d in categories_to_remove: -# docname = frappe.get_list('Hub Category', filters = {"category_name": d})[0]["name"] -# frappe.delete_doc("Hub Category", docname) - -# for d in categories_to_add: -# doc = frappe.new_doc("Hub Category") -# doc.category_name = d -# doc.save() - - -# @frappe.whitelist() -# def get_items_seen_states(items): -# items = json.loads(items) -# for d in items: -# local_item_code = "HUB-" + d["item_code"] -# if frappe.db.exists("Item", {"item_code": local_item_code}): -# d["seen"] = 1 -# else: -# d["seen"] = 0 -# return items - -# @frappe.whitelist() -# def get_local_hub_item_codes(): -# item_codes = [] -# for d in frappe.get_all("Item", fields=["item_code"], filters={"is_hub_item": 1}): -# item_codes.append(d["item_code"][4:]) -# return item_codes - -# @frappe.whitelist() -# def hub_item_request_action(item): -# item = json.loads(item) -# rfq = make_rfq(item) -# # , send click count and say requested -# send_opportunity_details(supplier_name, supplier_email) -# make_opportunities() -# return rfq - -# def send_opportunity_details(supplier_name, supplier_email): -# connection = get_connection() -# params = { -# "buyer_name": supplier_name, -# "email_id": supplier_email -# } -# args = frappe._dict(dict( -# doctype="Hub Document", -# type="Opportunity", -# document_data=json.dumps(params), -# user=supplier_email -# )) -# response = connection.insert("Hub Document", args) - @frappe.whitelist() def make_rfq_and_send_opportunity(item, supplier): supplier = make_supplier(supplier) @@ -221,7 +112,7 @@ def make_item(item): 'doctype': 'Item', 'item_code': item.item_code, 'item_group': item.item_group, - 'is_hub_item': 1 + 'is_item_from_hub': 1 }).insert() else: item_doc = frappe.get_doc('Item', item.item_code) diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index dc057a65ff..05525ab54f 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -1,3509 +1,3509 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 1, - "allow_rename": 1, - "autoname": "field:item_code", - "beta": 0, - "creation": "2013-05-03 10:45:46", - "custom": 0, - "default_print_format": "", - "description": "A Product or a Service that is bought, sold or kept in stock.", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Setup", - "editable_grid": 1, - "engine": "InnoDB", + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:item_code", + "beta": 0, + "creation": "2013-05-03 10:45:46", + "custom": 0, + "default_print_format": "", + "description": "A Product or a Service that is bought, sold or kept in stock.", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", "fields": [ { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "name_and_description_section", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "fa fa-flag", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "name_and_description_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "fa fa-flag", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "naming_series", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Series", - "length": 0, - "no_copy": 0, - "options": "ITEM-", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 1, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Series", + "length": 0, + "no_copy": 0, + "options": "ITEM-", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 1, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 1, - "collapsible": 0, - "columns": 0, - "description": "", - "fieldname": "item_code", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Item Code", - "length": 0, - "no_copy": 0, - "oldfieldname": "item_code", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 0, + "description": "", + "fieldname": "item_code", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Code", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_code", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "variant_of", - "description": "If item is a variant of another item then description, image, pricing, taxes etc will be set from the template unless explicitly specified", - "fieldname": "variant_of", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 1, - "label": "Variant Of", - "length": 0, - "no_copy": 0, - "options": "Item", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "variant_of", + "description": "If item is a variant of another item then description, image, pricing, taxes etc will be set from the template unless explicitly specified", + "fieldname": "variant_of", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Variant Of", + "length": 0, + "no_copy": 0, + "options": "Item", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 1, - "collapsible": 0, - "columns": 0, - "fieldname": "item_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Item Name", - "length": 0, - "no_copy": 0, - "oldfieldname": "item_name", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 1, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 0, + "fieldname": "item_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Name", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_name", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 1, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "barcode", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Barcode", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "barcode", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Barcode", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "", - "fieldname": "item_group", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Item Group", - "length": 0, - "no_copy": 0, - "oldfieldname": "item_group", - "oldfieldtype": "Link", - "options": "Item Group", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "", + "fieldname": "item_group", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Item Group", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_group", + "oldfieldtype": "Link", + "options": "Item Group", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "is_hub_item", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Is Hub Item", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_item_from_hub", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Item from Hub", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "", - "fieldname": "stock_uom", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Unit of Measure", - "length": 0, - "no_copy": 0, - "oldfieldname": "stock_uom", - "oldfieldtype": "Link", - "options": "UOM", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "", + "fieldname": "stock_uom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Unit of Measure", + "length": 0, + "no_copy": 0, + "oldfieldname": "stock_uom", + "oldfieldtype": "Link", + "options": "UOM", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break0", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "disabled", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Disabled", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "disabled", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Disabled", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "1", - "description": "", - "fieldname": "is_stock_item", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Maintain Stock", - "length": 0, - "no_copy": 0, - "oldfieldname": "is_stock_item", - "oldfieldtype": "Select", - "options": "", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "1", + "description": "", + "fieldname": "is_stock_item", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Maintain Stock", + "length": 0, + "no_copy": 0, + "oldfieldname": "is_stock_item", + "oldfieldtype": "Select", + "options": "", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 1, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:(doc.__islocal&&doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)", - "fieldname": "opening_stock", - "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Opening Stock", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:(doc.__islocal&&doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)", + "fieldname": "opening_stock", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Opening Stock", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:(doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)", - "fieldname": "valuation_rate", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Valuation Rate", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:(doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)", + "fieldname": "valuation_rate", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Valuation Rate", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 1, - "collapsible": 0, - "columns": 0, - "fieldname": "standard_rate", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Standard Selling Rate", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 0, + "fieldname": "standard_rate", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Standard Selling Rate", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "is_fixed_asset", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Is Fixed Asset", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "is_fixed_asset", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Fixed Asset", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "is_fixed_asset", - "fieldname": "asset_category", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Asset Category", - "length": 0, - "no_copy": 0, - "options": "Asset Category", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "is_fixed_asset", + "fieldname": "asset_category", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Asset Category", + "length": 0, + "no_copy": 0, + "options": "Asset Category", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:!doc.__islocal", - "description": "", - "fieldname": "tolerance", - "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Allow over delivery or receipt upto this percent", - "length": 0, - "no_copy": 0, - "oldfieldname": "tolerance", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:!doc.__islocal", + "description": "", + "fieldname": "tolerance", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Allow over delivery or receipt upto this percent", + "length": 0, + "no_copy": 0, + "oldfieldname": "tolerance", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "image", - "fieldtype": "Attach Image", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Image", - "length": 0, - "no_copy": 0, - "options": "image", - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "image", + "fieldtype": "Attach Image", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Image", + "length": 0, + "no_copy": 0, + "options": "image", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "fieldname": "section_break_11", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Description", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "section_break_11", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "brand", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Brand", - "length": 0, - "no_copy": 0, - "oldfieldname": "brand", - "oldfieldtype": "Link", - "options": "Brand", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "brand", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Brand", + "length": 0, + "no_copy": 0, + "oldfieldname": "brand", + "oldfieldtype": "Link", + "options": "Brand", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "description", - "fieldtype": "Text Editor", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Description", - "length": 0, - "no_copy": 0, - "oldfieldname": "description", - "oldfieldtype": "Text", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "oldfieldname": "description", + "oldfieldtype": "Text", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "collapsible_depends_on": "is_stock_item", - "columns": 0, - "depends_on": "is_stock_item", - "fieldname": "inventory", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Inventory", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "fa fa-truck", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "is_stock_item", + "columns": 0, + "depends_on": "is_stock_item", + "fieldname": "inventory", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Inventory", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "fa fa-truck", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "is_stock_item", - "description": "", - "fieldname": "default_warehouse", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Warehouse", - "length": 0, - "no_copy": 0, - "oldfieldname": "default_warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "is_stock_item", + "description": "", + "fieldname": "default_warehouse", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Warehouse", + "length": 0, + "no_copy": 0, + "oldfieldname": "default_warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "2099-12-31", - "depends_on": "is_stock_item", - "fieldname": "end_of_life", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "End of Life", - "length": 0, - "no_copy": 0, - "oldfieldname": "end_of_life", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "2099-12-31", + "depends_on": "is_stock_item", + "fieldname": "end_of_life", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "End of Life", + "length": 0, + "no_copy": 0, + "oldfieldname": "end_of_life", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "Purchase", - "fieldname": "default_material_request_type", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Material Request Type", - "length": 0, - "no_copy": 0, - "options": "Purchase\nMaterial Transfer\nMaterial Issue\nManufacture", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Purchase", + "fieldname": "default_material_request_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Material Request Type", + "length": 0, + "no_copy": 0, + "options": "Purchase\nMaterial Transfer\nMaterial Issue\nManufacture", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "is_stock_item", - "fieldname": "column_break1", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "is_stock_item", + "fieldname": "column_break1", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "is_stock_item", - "fieldname": "valuation_method", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Valuation Method", - "length": 0, - "no_copy": 0, - "options": "\nFIFO\nMoving Average", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "is_stock_item", + "fieldname": "valuation_method", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Valuation Method", + "length": 0, + "no_copy": 0, + "options": "\nFIFO\nMoving Average", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.is_stock_item", - "fieldname": "warranty_period", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Warranty Period (in days)", - "length": 0, - "no_copy": 0, - "oldfieldname": "warranty_period", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.is_stock_item", + "fieldname": "warranty_period", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Warranty Period (in days)", + "length": 0, + "no_copy": 0, + "oldfieldname": "warranty_period", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "is_stock_item", - "description": "", - "fieldname": "net_weight", - "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Net Weight", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "is_stock_item", + "description": "", + "fieldname": "net_weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Net Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.is_stock_item", - "fieldname": "weight_uom", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Weight UOM", - "length": 0, - "no_copy": 0, - "options": "UOM", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.is_stock_item", + "fieldname": "weight_uom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Weight UOM", + "length": 0, + "no_copy": 0, + "options": "UOM", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "depends_on": "is_stock_item", - "description": "", - "fieldname": "reorder_section", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Auto re-order", - "length": 0, - "no_copy": 0, - "options": "fa fa-rss", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "depends_on": "is_stock_item", + "description": "", + "fieldname": "reorder_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Auto re-order", + "length": 0, + "no_copy": 0, + "options": "fa fa-rss", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "description": "Will also apply for variants unless overrridden", - "fieldname": "reorder_levels", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Reorder level based on Warehouse", - "length": 0, - "no_copy": 0, - "options": "Item Reorder", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "description": "Will also apply for variants unless overrridden", + "fieldname": "reorder_levels", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reorder level based on Warehouse", + "length": 0, + "no_copy": 0, + "options": "Item Reorder", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "depends_on": "", - "fieldname": "unit_of_measure_conversion", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Units of Measure", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "depends_on": "", + "fieldname": "unit_of_measure_conversion", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Units of Measure", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "description": "Will also apply for variants", - "fieldname": "uoms", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "UOMs", - "length": 0, - "no_copy": 1, - "oldfieldname": "uom_conversion_details", - "oldfieldtype": "Table", - "options": "UOM Conversion Detail", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "description": "Will also apply for variants", + "fieldname": "uoms", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "UOMs", + "length": 0, + "no_copy": 1, + "oldfieldname": "uom_conversion_details", + "oldfieldtype": "Table", + "options": "UOM Conversion Detail", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "collapsible_depends_on": "eval:doc.has_batch_no || doc.has_serial_no", - "columns": 0, - "depends_on": "is_stock_item", - "fieldname": "serial_nos_and_batches", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Serial Nos and Batches", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "eval:doc.has_batch_no || doc.has_serial_no", + "columns": 0, + "depends_on": "is_stock_item", + "fieldname": "serial_nos_and_batches", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Serial Nos and Batches", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "", - "depends_on": "eval:doc.is_stock_item", - "fieldname": "has_batch_no", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Has Batch No", - "length": 0, - "no_copy": 1, - "oldfieldname": "has_batch_no", - "oldfieldtype": "Select", - "options": "", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "depends_on": "eval:doc.is_stock_item", + "fieldname": "has_batch_no", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Has Batch No", + "length": 0, + "no_copy": 1, + "oldfieldname": "has_batch_no", + "oldfieldtype": "Select", + "options": "", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "has_batch_no", - "description": "", - "fieldname": "create_new_batch", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Automatically Create New Batch", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "has_batch_no", + "description": "", + "fieldname": "create_new_batch", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Automatically Create New Batch", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_37", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_37", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "", - "depends_on": "eval:doc.is_stock_item", - "description": "", - "fieldname": "has_serial_no", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Has Serial No", - "length": 0, - "no_copy": 1, - "oldfieldname": "has_serial_no", - "oldfieldtype": "Select", - "options": "", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "depends_on": "eval:doc.is_stock_item", + "description": "", + "fieldname": "has_serial_no", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Has Serial No", + "length": 0, + "no_copy": 1, + "oldfieldname": "has_serial_no", + "oldfieldtype": "Select", + "options": "", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "has_serial_no", - "description": "Example: ABCD.#####\nIf series is set and Serial No is not mentioned in transactions, then automatic serial number will be created based on this series. If you always want to explicitly mention Serial Nos for this item. leave this blank.", - "fieldname": "serial_no_series", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Serial Number Series", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "has_serial_no", + "description": "Example: ABCD.#####\nIf series is set and Serial No is not mentioned in transactions, then automatic serial number will be created based on this series. If you always want to explicitly mention Serial Nos for this item. leave this blank.", + "fieldname": "serial_no_series", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Serial Number Series", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "collapsible_depends_on": "attributes", - "columns": 0, - "depends_on": "", - "fieldname": "variants_section", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Variants", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "attributes", + "columns": 0, + "depends_on": "", + "fieldname": "variants_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Variants", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "0", - "depends_on": "eval:!doc.variant_of", - "description": "If this item has variants, then it cannot be selected in sales orders etc.", - "fieldname": "has_variants", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Has Variants", - "length": 0, - "no_copy": 1, - "options": "", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "depends_on": "eval:!doc.variant_of", + "description": "If this item has variants, then it cannot be selected in sales orders etc.", + "fieldname": "has_variants", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Has Variants", + "length": 0, + "no_copy": 1, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "Item Attribute", - "depends_on": "has_variants", - "fieldname": "variant_based_on", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Variant Based On", - "length": 0, - "no_copy": 0, - "options": "Item Attribute\nManufacturer", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Item Attribute", + "depends_on": "has_variants", + "fieldname": "variant_based_on", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Variant Based On", + "length": 0, + "no_copy": 0, + "options": "Item Attribute\nManufacturer", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.has_variants && doc.variant_based_on==='Item Attribute'", - "fieldname": "attributes", - "fieldtype": "Table", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Attributes", - "length": 0, - "no_copy": 1, - "options": "Item Variant Attribute", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.has_variants && doc.variant_based_on==='Item Attribute'", + "fieldname": "attributes", + "fieldtype": "Table", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Attributes", + "length": 0, + "no_copy": 1, + "options": "Item Variant Attribute", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "fieldname": "purchase_details", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Purchase Details", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "fa fa-shopping-cart", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "purchase_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Purchase Details", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "fa fa-shopping-cart", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "1", - "fieldname": "is_purchase_item", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Is Purchase Item", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "1", + "fieldname": "is_purchase_item", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Purchase Item", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "purchase_uom", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Purchase Unit of Measure", - "length": 0, - "no_copy": 0, - "options": "UOM", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "purchase_uom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Purchase Unit of Measure", + "length": 0, + "no_copy": 0, + "options": "UOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "0.00", - "depends_on": "is_stock_item", - "description": "", - "fieldname": "min_order_qty", - "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Minimum Order Qty", - "length": 0, - "no_copy": 0, - "oldfieldname": "min_order_qty", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0.00", + "depends_on": "is_stock_item", + "description": "", + "fieldname": "min_order_qty", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Minimum Order Qty", + "length": 0, + "no_copy": 0, + "oldfieldname": "min_order_qty", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "safety_stock", - "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Safety Stock", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "safety_stock", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Safety Stock", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "description": "Average time taken by the supplier to deliver", - "fieldname": "lead_time_days", - "fieldtype": "Int", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Lead Time in days", - "length": 0, - "no_copy": 0, - "oldfieldname": "lead_time_days", - "oldfieldtype": "Int", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "description": "Average time taken by the supplier to deliver", + "fieldname": "lead_time_days", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Lead Time in days", + "length": 0, + "no_copy": 0, + "oldfieldname": "lead_time_days", + "oldfieldtype": "Int", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "description": "", - "fieldname": "buying_cost_center", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Buying Cost Center", - "length": 0, - "no_copy": 0, - "oldfieldname": "cost_center", - "oldfieldtype": "Link", - "options": "Cost Center", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "description": "", + "fieldname": "buying_cost_center", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Buying Cost Center", + "length": 0, + "no_copy": 0, + "oldfieldname": "cost_center", + "oldfieldtype": "Link", + "options": "Cost Center", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "description": "", - "fieldname": "expense_account", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Expense Account", - "length": 0, - "no_copy": 0, - "oldfieldname": "purchase_account", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "description": "", + "fieldname": "expense_account", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Expense Account", + "length": 0, + "no_copy": 0, + "oldfieldname": "purchase_account", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "last_purchase_rate", - "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Last Purchase Rate", - "length": 0, - "no_copy": 1, - "oldfieldname": "last_purchase_rate", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "last_purchase_rate", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Last Purchase Rate", + "length": 0, + "no_copy": 1, + "oldfieldname": "last_purchase_rate", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "depends_on": "", - "fieldname": "supplier_details", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Supplier Details", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "depends_on": "", + "fieldname": "supplier_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Supplier Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "default_supplier", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Supplier", - "length": 0, - "no_copy": 0, - "options": "Supplier", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "default_supplier", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Supplier", + "length": 0, + "no_copy": 0, + "options": "Supplier", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "delivered_by_supplier", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Delivered by Supplier (Drop Ship)", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "delivered_by_supplier", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Delivered by Supplier (Drop Ship)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "manufacturer", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Manufacturer", - "length": 0, - "no_copy": 0, - "options": "Manufacturer", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "manufacturer", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Manufacturer", + "length": 0, + "no_copy": 0, + "options": "Manufacturer", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "manufacturer_part_no", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Manufacturer Part Number", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "manufacturer_part_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Manufacturer Part Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "column_break2", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Item Code for Suppliers", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "column_break2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Code for Suppliers", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "supplier_items", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Supplier Items", - "length": 0, - "no_copy": 0, - "options": "Item Supplier", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "supplier_items", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Supplier Items", + "length": 0, + "no_copy": 0, + "options": "Item Supplier", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "fieldname": "foreign_trade_details", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Foreign Trade Details", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "foreign_trade_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Foreign Trade Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "country_of_origin", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Country of Origin", - "length": 0, - "no_copy": 0, - "options": "Country", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "country_of_origin", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Country of Origin", + "length": 0, + "no_copy": 0, + "options": "Country", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_59", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_59", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "customs_tariff_number", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Customs Tariff Number", - "length": 0, - "no_copy": 0, - "options": "Customs Tariff Number", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customs_tariff_number", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customs Tariff Number", + "length": 0, + "no_copy": 0, + "options": "Customs Tariff Number", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "fieldname": "sales_details", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Sales Details", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "fa fa-tag", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "sales_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sales Details", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "fa fa-tag", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "1", - "fieldname": "is_sales_item", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Is Sales Item", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "1", + "fieldname": "is_sales_item", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Is Sales Item", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "sales_uom", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Sales Unit of Measure", - "length": 0, - "no_copy": 0, - "options": "UOM", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "sales_uom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Sales Unit of Measure", + "length": 0, + "no_copy": 0, + "options": "UOM", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "income_account", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Income Account", - "length": 0, - "no_copy": 0, - "options": "Account", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "income_account", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Income Account", + "length": 0, + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "selling_cost_center", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default Selling Cost Center", - "length": 0, - "no_copy": 0, - "options": "Cost Center", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "selling_cost_center", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Selling Cost Center", + "length": 0, + "no_copy": 0, + "options": "Cost Center", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "column_break3", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Customer Item Codes", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "column_break3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Item Codes", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, "width": "50%" - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "description": "", - "fieldname": "customer_items", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Customer Items", - "length": 0, - "no_copy": 0, - "options": "Item Customer Detail", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "description": "", + "fieldname": "customer_items", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Items", + "length": 0, + "no_copy": 0, + "options": "Item Customer Detail", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "max_discount", - "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Max Discount (%)", - "length": 0, - "no_copy": 0, - "oldfieldname": "max_discount", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "max_discount", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Max Discount (%)", + "length": 0, + "no_copy": 0, + "oldfieldname": "max_discount", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "fieldname": "item_tax_section_break", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Item Tax", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "fa fa-money", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "item_tax_section_break", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Tax", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "fa fa-money", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "Will also apply for variants", - "fieldname": "taxes", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Taxes", - "length": 0, - "no_copy": 0, - "oldfieldname": "item_tax", - "oldfieldtype": "Table", - "options": "Item Tax", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Will also apply for variants", + "fieldname": "taxes", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Taxes", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_tax", + "oldfieldtype": "Table", + "options": "Item Tax", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "fieldname": "inspection_criteria", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Inspection Criteria", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "fa fa-search", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "inspection_criteria", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Inspection Criteria", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "fa fa-search", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "", - "fieldname": "inspection_required_before_purchase", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Inspection Required before Purchase", - "length": 0, - "no_copy": 0, - "oldfieldname": "inspection_required", - "oldfieldtype": "Select", - "options": "", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "fieldname": "inspection_required_before_purchase", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Inspection Required before Purchase", + "length": 0, + "no_copy": 0, + "oldfieldname": "inspection_required", + "oldfieldtype": "Select", + "options": "", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "inspection_required_before_delivery", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Inspection Required before Delivery", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "inspection_required_before_delivery", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Inspection Required before Delivery", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:(doc.inspection_required_before_purchase || doc.inspection_required_before_delivery)", - "description": "Will also apply to variants", - "fieldname": "quality_parameters", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Quality Parameters", - "length": 0, - "no_copy": 0, - "oldfieldname": "item_specification_details", - "oldfieldtype": "Table", - "options": "Item Quality Inspection Parameter", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:(doc.inspection_required_before_purchase || doc.inspection_required_before_delivery)", + "description": "Will also apply to variants", + "fieldname": "quality_parameters", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quality Parameters", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_specification_details", + "oldfieldtype": "Table", + "options": "Item Quality Inspection Parameter", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "depends_on": "is_stock_item", - "fieldname": "manufacturing", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Manufacturing", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "fa fa-cogs", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "depends_on": "is_stock_item", + "fieldname": "manufacturing", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Manufacturing", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "fa fa-cogs", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "default_bom", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Default BOM", - "length": 0, - "no_copy": 1, - "oldfieldname": "default_bom", - "oldfieldtype": "Link", - "options": "BOM", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "default_bom", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default BOM", + "length": 0, + "no_copy": 1, + "oldfieldname": "default_bom", + "oldfieldtype": "Link", + "options": "BOM", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "", - "description": "If subcontracted to a vendor", - "fieldname": "is_sub_contracted_item", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Supply Raw Materials for Purchase", - "length": 0, - "no_copy": 0, - "oldfieldname": "is_sub_contracted_item", - "oldfieldtype": "Select", - "options": "", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "description": "If subcontracted to a vendor", + "fieldname": "is_sub_contracted_item", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Supply Raw Materials for Purchase", + "length": 0, + "no_copy": 0, + "oldfieldname": "is_sub_contracted_item", + "oldfieldtype": "Select", + "options": "", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_74", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_74", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "customer_code", - "fieldtype": "Data", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Customer Code", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "customer_code", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer Code", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "columns": 0, - "fieldname": "website_section", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Website", - "length": 0, - "no_copy": 0, - "options": "fa fa-globe", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "columns": 0, + "fieldname": "website_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Website", + "length": 0, + "no_copy": 0, + "options": "fa fa-globe", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:!doc.variant_of", - "fieldname": "show_in_website", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Show in Website", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:!doc.variant_of", + "fieldname": "show_in_website", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Show in Website", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "variant_of", - "fieldname": "show_variant_in_website", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Show in Website (Variant)", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "variant_of", + "fieldname": "show_variant_in_website", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Show in Website (Variant)", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", - "fieldname": "route", - "fieldtype": "Small Text", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Route", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", + "fieldname": "route", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Route", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", - "description": "Items with higher weightage will be shown higher", - "fieldname": "weightage", - "fieldtype": "Int", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Weightage", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 1, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", + "description": "Items with higher weightage will be shown higher", + "fieldname": "weightage", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Weightage", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 1, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", - "description": "Show a slideshow at the top of the page", - "fieldname": "slideshow", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Slideshow", - "length": 0, - "no_copy": 0, - "options": "Website Slideshow", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", + "description": "Show a slideshow at the top of the page", + "fieldname": "slideshow", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Slideshow", + "length": 0, + "no_copy": 0, + "options": "Website Slideshow", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", - "description": "Item Image (if not slideshow)", - "fieldname": "website_image", - "fieldtype": "Attach", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Image", - "length": 0, - "no_copy": 0, - "options": "", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", + "description": "Item Image (if not slideshow)", + "fieldname": "website_image", + "fieldtype": "Attach", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Image", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "thumbnail", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Thumbnail", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "thumbnail", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Thumbnail", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "cb72", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "cb72", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", - "description": "Show \"In Stock\" or \"Not in Stock\" based on stock available in this warehouse.", - "fieldname": "website_warehouse", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Website Warehouse", - "length": 0, - "no_copy": 0, - "options": "Warehouse", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", + "description": "Show \"In Stock\" or \"Not in Stock\" based on stock available in this warehouse.", + "fieldname": "website_warehouse", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Website Warehouse", + "length": 0, + "no_copy": 0, + "options": "Warehouse", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", - "description": "List this Item in multiple groups on the website.", - "fieldname": "website_item_groups", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Website Item Groups", - "length": 0, - "no_copy": 0, - "options": "Website Item Group", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", + "description": "List this Item in multiple groups on the website.", + "fieldname": "website_item_groups", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Website Item Groups", + "length": 0, + "no_copy": 0, + "options": "Website Item Group", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "collapsible_depends_on": "website_specifications", - "columns": 0, - "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", - "fieldname": "sb72", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Website Specifications", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "website_specifications", + "columns": 0, + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", + "fieldname": "sb72", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Website Specifications", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", - "fieldname": "copy_from_item_group", - "fieldtype": "Button", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Copy From Item Group", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", + "fieldname": "copy_from_item_group", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Copy From Item Group", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", - "fieldname": "website_specifications", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Website Specifications", - "length": 0, - "no_copy": 0, - "options": "Item Website Specification", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", + "fieldname": "website_specifications", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Website Specifications", + "length": 0, + "no_copy": 0, + "options": "Item Website Specification", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", - "fieldname": "web_long_description", - "fieldtype": "Text Editor", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Website Description", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", + "fieldname": "web_long_description", + "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Website Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "total_projected_qty", - "fieldtype": "Float", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Total Projected Qty", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "total_projected_qty", + "fieldtype": "Float", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Total Projected Qty", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:(!doc.is_hub_item)", - "fieldname": "hub_publishing_sb", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Hub Publishing Details", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:(!doc.is_item_from_hub)", + "fieldname": "hub_publishing_sb", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Hub Publishing Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "0", - "description": "Publish Item to hub.erpnext.com", - "fieldname": "publish_in_hub", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Publish in Hub", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "description": "Publish Item to hub.erpnext.com", + "fieldname": "publish_in_hub", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Publish in Hub", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "hub_category_to_publish", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Hub Category to Publish", - "length": 0, - "no_copy": 0, - "options": "Hub Category", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "hub_category_to_publish", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Hub Category to Publish", + "length": 0, + "no_copy": 0, + "options": "Hub Category", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "description": "Publish \"In Stock\" or \"Not in Stock\" on Hub based on stock available in this warehouse.", - "fieldname": "hub_warehouse", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Hub Warehouse", - "length": 0, - "no_copy": 0, - "options": "Warehouse", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "description": "Publish \"In Stock\" or \"Not in Stock\" on Hub based on stock available in this warehouse.", + "fieldname": "hub_warehouse", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Hub Warehouse", + "length": 0, + "no_copy": 0, + "options": "Warehouse", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "0", - "fieldname": "synced_with_hub", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Synced With Hub", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "fieldname": "synced_with_hub", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Synced With Hub", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, "unique": 0 } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "fa fa-tag", - "idx": 2, - "image_field": "image", - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 1, - "modified": "2017-09-27 14:08:02.948326", - "modified_by": "Administrator", - "module": "Stock", - "name": "Item", - "owner": "Administrator", + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "fa fa-tag", + "idx": 2, + "image_field": "image", + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 1, + "modified": "2017-10-03 14:08:02.948326", + "modified_by": "Administrator", + "module": "Stock", + "name": "Item", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Item Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Item Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, "write": 1 - }, + }, { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Stock Manager", - "set_user_permissions": 0, - "share": 0, - "submit": 0, + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock Manager", + "set_user_permissions": 0, + "share": 0, + "submit": 0, "write": 0 - }, + }, { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Stock User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, "write": 0 - }, + }, { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 0, - "role": "Sales User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Sales User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, "write": 0 - }, + }, { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 0, - "role": "Purchase User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Purchase User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, "write": 0 - }, + }, { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 0, - "role": "Maintenance User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Maintenance User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, "write": 0 - }, + }, { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 0, - "role": "Accounts User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Accounts User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, "write": 0 - }, + }, { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 0, - "role": "Manufacturing User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Manufacturing User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, "write": 0 } - ], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "search_fields": "item_name,description,item_group,customer_code", - "show_name_in_global_search": 1, - "sort_field": "idx desc, modified desc", - "sort_order": "DESC", - "title_field": "item_name", - "track_changes": 1, + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "item_name,description,item_group,customer_code", + "show_name_in_global_search": 1, + "sort_field": "idx desc, modified desc", + "sort_order": "DESC", + "title_field": "item_name", + "track_changes": 1, "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 3f71db89af..e7ed5d0076 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -52,7 +52,7 @@ class Item(WebsiteGenerator): if not self.description: self.description = self.item_name - if self.is_sales_item and not self.is_hub_item: + if self.is_sales_item and not self.is_item_from_hub: self.publish_in_hub = 1 def after_insert(self): From e31757b0010bcfcb18f6ab4a45373f035dbbd364 Mon Sep 17 00:00:00 2001 From: Stavros Anastasiadis Date: Thu, 5 Oct 2017 16:11:51 +0300 Subject: [PATCH 78/81] Show Stock Level section only to stock maintain items (#11073) --- erpnext/stock/doctype/item/item.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 40b80c7c49..baa59bf14f 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -249,15 +249,18 @@ $.extend(erpnext.item, { if(frm.doc.__islocal) return; - frappe.require('assets/js/item-dashboard.min.js', function() { - var section = frm.dashboard.add_section('
    \ - ' + __("Stock Levels") + '
    '); - erpnext.item.item_dashboard = new erpnext.stock.ItemDashboard({ - parent: section, - item_code: frm.doc.name + // Show Stock Levels only if is_stock_item + if (frm.doc.is_stock_item) { + frappe.require('assets/js/item-dashboard.min.js', function() { + var section = frm.dashboard.add_section('
    \ + ' + __("Stock Levels") + '
    '); + erpnext.item.item_dashboard = new erpnext.stock.ItemDashboard({ + parent: section, + item_code: frm.doc.name + }); + erpnext.item.item_dashboard.refresh(); }); - erpnext.item.item_dashboard.refresh(); - }); + } }, edit_prices_button: function(frm) { From 58b587834ec3997cd922ce21b838cc3e2281d82c Mon Sep 17 00:00:00 2001 From: Stavros Anastasiadis Date: Thu, 5 Oct 2017 16:14:50 +0300 Subject: [PATCH 79/81] Provide a minor warning message if no stock levels are availiable (#11074) * Provide a minor warning message if no stock levels are availiable * Update item_dashboard.js --- erpnext/stock/dashboard/item_dashboard.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js index e9499895fe..113a2efb50 100644 --- a/erpnext/stock/dashboard/item_dashboard.js +++ b/erpnext/stock/dashboard/item_dashboard.js @@ -75,8 +75,13 @@ erpnext.stock.ItemDashboard = Class.extend({ this.content.find('.more').addClass('hidden'); } - $(frappe.render_template('item_dashboard_list', context)).appendTo(this.result); - + // If not any stock in any warehouses provide a message to end user + if (context.data.length > 0) { + $(frappe.render_template('item_dashboard_list', context)).appendTo(this.result); + } else { + var message = __(" Currently no stock available in any warehouse") + $(" "+message+"").appendTo(this.result); + } }, get_item_dashboard_data: function(data, max_count, show_item) { if(!max_count) max_count = 0; @@ -182,4 +187,4 @@ erpnext.stock.move_item = function(item, source, target, actual_qty, rate, callb frappe.set_route('Form', doc.doctype, doc.name); }) }); -} \ No newline at end of file +} From 455c3ebb2706c368309635ff73e9d9b2aa5ff673 Mon Sep 17 00:00:00 2001 From: Stavros Anastasiadis Date: Thu, 5 Oct 2017 16:15:37 +0300 Subject: [PATCH 80/81] Add as optional field link Company (#11068) --- .../training_event/training_event.json | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/training_event/training_event.json b/erpnext/hr/doctype/training_event/training_event.json index 7be9d974fe..f3c0e4171a 100644 --- a/erpnext/hr/doctype/training_event/training_event.json +++ b/erpnext/hr/doctype/training_event/training_event.json @@ -133,6 +133,37 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "company", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Company", + "length": 0, + "no_copy": 0, + "options": "Company", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -684,7 +715,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-08-11 03:11:25.768563", + "modified": "2017-10-05 05:57:08.212658", "modified_by": "Administrator", "module": "HR", "name": "Training Event", From e3a589998027249f26a53de53af93139897fb735 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 5 Oct 2017 19:43:08 +0530 Subject: [PATCH 81/81] [hub] Add hub category filters, fix minor issues (#11079) --- erpnext/hub_node/__init__.py | 20 ++- .../doctype/hub_settings/hub_settings.py | 4 +- erpnext/hub_node/page/hub/hub.js | 160 +++++++++--------- 3 files changed, 93 insertions(+), 91 deletions(-) diff --git a/erpnext/hub_node/__init__.py b/erpnext/hub_node/__init__.py index 8889df1398..686fe8d202 100644 --- a/erpnext/hub_node/__init__.py +++ b/erpnext/hub_node/__init__.py @@ -15,32 +15,40 @@ def enable_hub(): return hub_settings @frappe.whitelist() -def get_items(start=0, page_length=20): +def get_items(start=0, limit=20, category=None, order_by=None, text=None): connection = get_connection() - response = connection.connection.get_list('Hub Item', limit_start=start, limit_page_length=page_length) + filters = { + 'hub_category': category, + } + if text: + filters.update({'item_name': ('like', '%' + text + '%')}) + response = connection.get_list('Hub Item', + limit_start=start, limit_page_length=limit, + filters=filters) return response @frappe.whitelist() def get_categories(): connection = get_connection() response = connection.get_list('Hub Category') - return response.list + return response @frappe.whitelist() def get_item_details(hub_sync_id): connection = get_connection() - return connection.connection.get_doc('Hub Item', hub_sync_id) + return connection.get_doc('Hub Item', hub_sync_id) @frappe.whitelist() def get_company_details(hub_sync_id): connection = get_connection() - return connection.connection.get_doc('Hub Company', hub_sync_id) + return connection.get_doc('Hub Company', hub_sync_id) def get_connection(): hub_connector = frappe.get_doc( 'Data Migration Connector', 'Hub Connector') hub_connection = hub_connector.get_connection() - return hub_connection + # frappeclient connection + return hub_connection.connection def make_opportunity(buyer_name, email_id): buyer_name = "HUB-" + buyer_name diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.py b/erpnext/hub_node/doctype/hub_settings/hub_settings.py index 50069cea80..50b8e01461 100644 --- a/erpnext/hub_node/doctype/hub_settings/hub_settings.py +++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.py @@ -62,9 +62,9 @@ class HubSettings(Document): 'Data Migration Connector', 'Hub Connector') connection = hub_connector.get_connection() - response = connection.update('User', frappe._dict({'enabled': 0}), hub_connector.username) + response_doc = connection.update('User', frappe._dict({'enabled': 0}), hub_connector.username) - if response.ok: + if response_doc['enabled'] == 0: self.enabled = 0 self.save() diff --git a/erpnext/hub_node/page/hub/hub.js b/erpnext/hub_node/page/hub/hub.js index 7f34a5ac38..143f55444f 100644 --- a/erpnext/hub_node/page/hub/hub.js +++ b/erpnext/hub_node/page/hub/hub.js @@ -9,28 +9,26 @@ frappe.pages['hub'].on_page_load = function(wrapper) { single_col: false }); - erpnext.hub.Hub = new Hub({ page }); - + wrapper.hub_page = new erpnext.hub.Hub({ page }); }; frappe.pages['hub'].on_page_show = function(wrapper) { - const current_route = frappe.get_route(); - if(current_route[1] === "Products") { - const item_code = current_route[2]; - if(item_code) { - erpnext.hub.Hub.go_to_item_page(item_code); - } + const hub_page = wrapper.hub_page; + const [hub, type, id] = frappe.get_route(); + + if (!(hub || type || id)) { + hub_page.go_to_home_page(); + return; } - if(current_route[1] === "Company") { - const company_name = current_route[2]; - if(company_name) { - erpnext.hub.Hub.go_to_company_page(company_name); - } + if (type === "Products") { + hub_page.go_to_item_page(id); + } else if (type === "Company") { + hub_page.go_to_company_page(id); } } -window.Hub = class Hub { +erpnext.hub.Hub = class Hub { constructor({ page }) { this.page = page; frappe.require('/assets/erpnext/css/hub.css', () => { @@ -88,6 +86,9 @@ window.Hub = class Hub { } register_for_hub() { + if (frappe.session.user.includes('Administrator')) { + frappe.throw(__('Please login as another user.')) + } frappe.verify_password(() => { frappe.call({ method: 'erpnext.hub_node.enable_hub', @@ -204,7 +205,7 @@ window.Hub = class Hub { this.refresh_item_only_page(); }); - this.$search = this.page.add_data(__('Search')); + this.setup_hub_category_filter(); this.setup_search(); } @@ -279,7 +280,7 @@ window.Hub = class Hub { } setup_lists() { - this.home_item_list = new HubList({ + this.home_item_list = new erpnext.hub.HubList({ parent: this.$main_list_section, title: 'New', page_length: 20, @@ -295,7 +296,44 @@ window.Hub = class Hub { this.home_item_list.setup(); } + setup_hub_category_filter() { + const me = this; + + this.hub_category_field = this.page.add_field({ + fieldtype: 'Autocomplete', + label: 'Hub Category', + change() { + let value = this.get_value(); + let title = value; + if (value === 'All Categories') { + // show all items + value = null; + } + + me.home_item_list.title = title; + me.home_item_list.refresh({ + text: '', + start: 0, + limit: 20, + category: value + }); + } + }); + + frappe.call('erpnext.hub_node.get_categories') + .then((r) => { + if (r.message) { + const categories = r.message; + + this.hub_category_field.set_data( + categories.map(c => c.hub_category_name) + ); + } + }); + } + setup_search() { + this.$search = this.page.add_data(__('Search')); this.$search.on('keypress', (e) => { if(e.which === 13) { var search_term = ($(this.$search).val() || '').toLowerCase(); @@ -312,7 +350,7 @@ window.Hub = class Hub { go_to_items_only_page(route, title, class_name, filters = {text: ''}, by_item_codes=0) { frappe.set_route(route); this.$hub_main_section.empty(); - this.filtered_item_list = new HubList({ + this.filtered_item_list = new erpnext.hub.HubList({ parent: this.$hub_main_section, title: title, page_length: 20, @@ -361,7 +399,7 @@ window.Hub = class Hub { let $company_items = $item_page.find('.company-items'); - let company_item_list = new HubList({ + let company_item_list = new erpnext.hub.HubList({ parent: $company_items, title: 'More by ' + item.company_name, page_length: 5, @@ -465,7 +503,7 @@ window.Hub = class Hub { let $company_items = $company_page.find('.company-items'); - let company_item_list = new HubList({ + let company_item_list = new erpnext.hub.HubList({ parent: $company_items, title: 'More by ' + company_details.company_name, page_length: 5, @@ -574,12 +612,14 @@ window.Hub = class Hub { } setup_menu() { + if (this.menu_setup) return; + this.page.add_menu_item(__('Hub Settings'), () => frappe.set_route('Form', 'Hub Settings')); - this.page.add_menu_item(__('Refresh'), () => this.refresh()); - this.page.add_menu_item(__('Sync'), () => this.sync_items_to_hub()); + + this.menu_setup = true; } sync_items_to_hub() { @@ -588,12 +628,12 @@ window.Hub = class Hub { setup_sidebar() { var me = this; - this.sidebar = new HubSidebar({ - wrapper: this.page.wrapper.find('.layout-side-section') + this.sidebar = new frappe.ui.Sidebar({ + wrapper: this.page.wrapper.find('.layout-side-section'), + css_class: 'hub-sidebar' }); this.add_account_to_sidebar(); - } add_account_to_sidebar() { @@ -603,8 +643,8 @@ window.Hub = class Hub { }, __("Account")); this.sidebar.add_item({ - label: __("Requested Products"), - on_click: () => this.go_to_seen_items() + label: __("My Orders"), + on_click: () => frappe.set_route('List', 'Request for Quotation') }, __("Account")); } @@ -638,7 +678,7 @@ window.Hub = class Hub { } } -class HubList { +erpnext.hub.HubList = class HubList { constructor({ parent = null, title = 'Products', @@ -744,6 +784,8 @@ class HubList { render_items(items) { if(items) { + // clear any filler divs + this.$list.find('.filler').remove(); let done = 0; console.log("items length", items.length); if(items.length && items.length > this.page_length) { @@ -755,10 +797,16 @@ class HubList { items.forEach((item) => { this.make_item_card(item).appendTo(this.$list); }); - console.log(done); + + const remainder = items.length % 4; + if (remainder > 0) { + // fill with filler divs to make flexbox happy + Array.from(Array(remainder)) + .map(r => $('
    ').css('width', '200px').appendTo(this.$list)); + } this.update_list_state(done); } else { - this.$item_list_title.html('No results found'); + this.update_list_state(1); } } @@ -814,57 +862,3 @@ class HubList {
    `; } } - -class HubSidebar { - constructor({ wrapper }) { - this.wrapper = wrapper; - this.make_dom(); - } - - make_dom() { - this.wrapper.html(` - - `); - - this.$sidebar = this.wrapper.find('.hub-sidebar'); - } - - add_item(item, section) { - let $section; - if(!section && this.wrapper.find('.sidebar-menu').length === 0) { - // if no section, add section with no heading - $section = this.get_section(); - } else { - $section = this.get_section(section); - } - - const $li_item = $(` -
  • ${item.label}
  • - `).click( - () => item.on_click && item.on_click() - ); - - $section.append($li_item); - } - - get_section(section_heading="") { - let $section = $(this.wrapper.find( - `[data-section-heading="${section_heading}"]`)); - if($section.length) { - return $section; - } - - const $section_heading = section_heading ? - `
  • ${section_heading}
  • ` : ''; - - $section = $(` - - `); - - this.$sidebar.append($section); - return $section; - } -} \ No newline at end of file