From 70aa8933b111815f6d35b559f67993708a65bb07 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 26 Sep 2014 18:54:01 +0530 Subject: [PATCH] [item variant] started --- .../doctype/pricing_rule/pricing_rule.json | 3 +- .../doctype/pricing_rule/test_records.json | 6 + erpnext/config/stock.py | 5 + erpnext/stock/doctype/item/item.js | 27 +- erpnext/stock/doctype/item/item.json | 1486 +++++++++-------- erpnext/stock/doctype/item/item.py | 42 + erpnext/stock/doctype/item/test_item.py | 12 +- erpnext/stock/doctype/item/test_records.json | 47 +- .../stock/doctype/item_attribute/__init__.py | 0 .../item_attribute/item_attribute.json | 87 + .../doctype/item_attribute/item_attribute.py | 19 + .../item_attribute/test_item_attribute.py | 10 + .../doctype/item_attribute/test_records.json | 22 + .../doctype/item_attribute_value/__init__.py | 0 .../item_attribute_value.json | 64 + .../item_attribute_value.py | 9 + .../test_item_attribute_value.py | 10 + .../item_attribute_value/test_records.json | 6 + .../stock/doctype/item_variant/__init__.py | 0 .../doctype/item_variant/item_variant.json | 72 + .../doctype/item_variant/item_variant.py | 9 + 21 files changed, 1196 insertions(+), 740 deletions(-) create mode 100644 erpnext/accounts/doctype/pricing_rule/test_records.json create mode 100644 erpnext/stock/doctype/item_attribute/__init__.py create mode 100644 erpnext/stock/doctype/item_attribute/item_attribute.json create mode 100644 erpnext/stock/doctype/item_attribute/item_attribute.py create mode 100644 erpnext/stock/doctype/item_attribute/test_item_attribute.py create mode 100644 erpnext/stock/doctype/item_attribute/test_records.json create mode 100644 erpnext/stock/doctype/item_attribute_value/__init__.py create mode 100644 erpnext/stock/doctype/item_attribute_value/item_attribute_value.json create mode 100644 erpnext/stock/doctype/item_attribute_value/item_attribute_value.py create mode 100644 erpnext/stock/doctype/item_attribute_value/test_item_attribute_value.py create mode 100644 erpnext/stock/doctype/item_attribute_value/test_records.json create mode 100644 erpnext/stock/doctype/item_variant/__init__.py create mode 100644 erpnext/stock/doctype/item_variant/item_variant.json create mode 100644 erpnext/stock/doctype/item_variant/item_variant.py diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json index 2d318c6360..7a79c1af0b 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json @@ -164,6 +164,7 @@ "permlevel": 0 }, { + "description": "Higher the number, higher the priority", "fieldname": "priority", "fieldtype": "Select", "label": "Priority", @@ -235,7 +236,7 @@ "icon": "icon-gift", "idx": 1, "istable": 0, - "modified": "2014-06-20 19:36:22.502381", + "modified": "2014-09-26 09:09:38.418765", "modified_by": "Administrator", "module": "Accounts", "name": "Pricing Rule", diff --git a/erpnext/accounts/doctype/pricing_rule/test_records.json b/erpnext/accounts/doctype/pricing_rule/test_records.json new file mode 100644 index 0000000000..706d54cf2e --- /dev/null +++ b/erpnext/accounts/doctype/pricing_rule/test_records.json @@ -0,0 +1,6 @@ +[ + { + "doctype": "Pricing Rule", + "name": "_Test Pricing Rule 1" + } +] diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index 7a4345e4d2..f535a30e19 100644 --- a/erpnext/config/stock.py +++ b/erpnext/config/stock.py @@ -129,6 +129,11 @@ def get_data(): "description": _("Multiple Item prices."), "route": "Report/Item Price" }, + { + "type": "doctype", + "name": "Item Attribute", + "description": _("Attributes for Item Variants. e.g Size, Color etc."), + }, ] }, { diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index fce8dfaf5b..9af1d904cc 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -35,11 +35,32 @@ erpnext.item.toggle_reqd = function(frm) { frm.toggle_reqd("default_warehouse", frm.doc.is_stock_item==="Yes"); }; -frappe.ui.form.on("Item", "is_stock_item", function(frm) { - erpnext.item.toggle_reqd(frm); +frappe.ui.form.on("Item", "onload", function(frm) { + var df = frappe.meta.get_docfield("Item Variant", "item_attribute_value"); + df.on_make = function(field) { + field.$input.autocomplete({ + minLength: 0, + minChars: 0, + source: function(request, response) { + frappe.call({ + method:"frappe.client.get_list", + args:{ + doctype:"Item Attribute Value", + filters: [ + ["parent","=", field.doc.item_attribute], + ["attribute_value", "like", request.term + "%"] + ], + fields: ["attribute_value"] + }, + callback: function(r) { + response($.map(r.message, function(d) { return d.attribute_value; })); + } + }); + } + }) + } }); - cur_frm.cscript.make_dashboard = function() { cur_frm.dashboard.reset(); if(cur_frm.doc.__islocal) diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index db39f7badb..70e28974c0 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -1,905 +1,941 @@ { - "allow_import": 1, - "allow_rename": 1, - "autoname": "field:item_code", - "creation": "2013-05-03 10:45:46", - "default_print_format": "Standard", - "description": "A Product or a Service that is bought, sold or kept in stock.", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:item_code", + "creation": "2013-05-03 10:45:46", + "default_print_format": "Standard", + "description": "A Product or a Service that is bought, sold or kept in stock.", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "name_and_description_section", - "fieldtype": "Section Break", - "label": "Name and Description", - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "icon-flag", - "permlevel": 0, + "fieldname": "name_and_description_section", + "fieldtype": "Section Break", + "label": "Name and Description", + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "icon-flag", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "options": "ITEM-", - "permlevel": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "options": "ITEM-", + "permlevel": 0, "read_only": 0 - }, + }, { - "description": "Item will be saved by this name in the data base.", - "fieldname": "item_code", - "fieldtype": "Data", - "in_filter": 0, - "label": "Item Code", - "no_copy": 1, - "oldfieldname": "item_code", - "oldfieldtype": "Data", - "permlevel": 0, - "read_only": 0, - "reqd": 0, + "description": "Item will be saved by this name in the data base.", + "fieldname": "item_code", + "fieldtype": "Data", + "in_filter": 0, + "label": "Item Code", + "no_copy": 1, + "oldfieldname": "item_code", + "oldfieldtype": "Data", + "permlevel": 0, + "read_only": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "fieldname": "item_name", - "fieldtype": "Data", - "in_filter": 1, - "in_list_view": 1, - "label": "Item Name", - "oldfieldname": "item_name", - "oldfieldtype": "Data", - "permlevel": 0, - "read_only": 0, - "reqd": 1, + "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", + "label": "Variant Of", + "options": "Item", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "item_name", + "fieldtype": "Data", + "in_filter": 1, + "in_list_view": 1, + "label": "Item Name", + "oldfieldname": "item_name", + "oldfieldtype": "Data", + "permlevel": 0, + "read_only": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "description": "Add / Edit", - "fieldname": "item_group", - "fieldtype": "Link", - "in_filter": 1, - "label": "Item Group", - "oldfieldname": "item_group", - "oldfieldtype": "Link", - "options": "Item Group", - "permlevel": 0, - "read_only": 0, + "description": "Add / Edit", + "fieldname": "item_group", + "fieldtype": "Link", + "in_filter": 1, + "label": "Item Group", + "oldfieldname": "item_group", + "oldfieldtype": "Link", + "options": "Item Group", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "description": "Unit of measurement of this item (e.g. Kg, Unit, No, Pair).", - "fieldname": "stock_uom", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Unit of Measure", - "oldfieldname": "stock_uom", - "oldfieldtype": "Link", - "options": "UOM", - "permlevel": 0, - "read_only": 0, + "description": "Unit of measurement of this item (e.g. Kg, Unit, No, Pair).", + "fieldname": "stock_uom", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Unit of Measure", + "oldfieldname": "stock_uom", + "oldfieldtype": "Link", + "options": "UOM", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "fieldname": "brand", - "fieldtype": "Link", - "hidden": 0, - "label": "Brand", - "oldfieldname": "brand", - "oldfieldtype": "Link", - "options": "Brand", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "brand", + "fieldtype": "Link", + "hidden": 0, + "label": "Brand", + "oldfieldname": "brand", + "oldfieldtype": "Link", + "options": "Brand", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "reqd": 0 - }, + }, { - "fieldname": "barcode", - "fieldtype": "Data", - "label": "Barcode", - "permlevel": 0, + "fieldname": "barcode", + "fieldtype": "Data", + "label": "Barcode", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "image", - "fieldtype": "Attach", - "label": "Image", - "options": "", - "permlevel": 0, + "fieldname": "image", + "fieldtype": "Attach", + "label": "Image", + "options": "", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "image_view", - "fieldtype": "Image", - "in_list_view": 1, - "label": "Image View", - "options": "image", - "permlevel": 0, + "fieldname": "image_view", + "fieldtype": "Image", + "in_list_view": 1, + "label": "Image View", + "options": "image", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "description", - "fieldtype": "Small Text", - "in_filter": 0, - "in_list_view": 1, - "label": "Description", - "oldfieldname": "description", - "oldfieldtype": "Text", - "permlevel": 0, - "read_only": 0, - "reqd": 1, + "fieldname": "description", + "fieldtype": "Small Text", + "in_filter": 0, + "in_list_view": 1, + "label": "Description", + "oldfieldname": "description", + "oldfieldtype": "Text", + "permlevel": 0, + "read_only": 0, + "reqd": 1, "search_index": 0 - }, + }, { - "fieldname": "description_html", - "fieldtype": "Small Text", - "label": "Description HTML", - "permlevel": 0, + "fieldname": "description_html", + "fieldtype": "Small Text", + "label": "Description HTML", + "permlevel": 0, "read_only": 0 - }, + }, { - "description": "Generates HTML to include selected image in the description", - "fieldname": "add_image", - "fieldtype": "Button", - "label": "Generate Description HTML", - "permlevel": 0, + "description": "Generates HTML to include selected image in the description", + "fieldname": "add_image", + "fieldtype": "Button", + "label": "Generate Description HTML", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "inventory", - "fieldtype": "Section Break", - "label": "Inventory", - "oldfieldtype": "Section Break", - "options": "icon-truck", - "permlevel": 0, + "fieldname": "variants", + "fieldtype": "Section Break", + "label": "Variants", + "permlevel": 0, + "precision": "" + }, + { + "description": "Automatically set. If this item has variants, then it cannot be selected in sales orders etc.", + "fieldname": "has_variants", + "fieldtype": "Check", + "label": "Has Variants", + "options": "", + "permlevel": 0, + "precision": "", "read_only": 0 - }, + }, { - "default": "Yes", - "description": "Select \"Yes\" if you are maintaining stock of this item in your Inventory.", - "fieldname": "is_stock_item", - "fieldtype": "Select", - "label": "Is Stock Item", - "oldfieldname": "is_stock_item", - "oldfieldtype": "Select", - "options": "Yes\nNo", - "permlevel": 0, - "read_only": 0, + "depends_on": "has_variants", + "description": "A new variant (Item) will be created for each attribute value combination", + "fieldname": "item_variants", + "fieldtype": "Table", + "label": "Item Variants", + "options": "Item Variant", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "inventory", + "fieldtype": "Section Break", + "label": "Inventory", + "oldfieldtype": "Section Break", + "options": "icon-truck", + "permlevel": 0, + "read_only": 0 + }, + { + "default": "Yes", + "description": "Select \"Yes\" if you are maintaining stock of this item in your Inventory.", + "fieldname": "is_stock_item", + "fieldtype": "Select", + "label": "Is Stock Item", + "oldfieldname": "is_stock_item", + "oldfieldtype": "Select", + "options": "Yes\nNo", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "depends_on": "", - "description": "Mandatory if Stock Item is \"Yes\". Also the default warehouse where reserved quantity is set from Sales Order.", - "fieldname": "default_warehouse", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Warehouse", - "oldfieldname": "default_warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "permlevel": 0, + "depends_on": "", + "description": "Mandatory if Stock Item is \"Yes\". Also the default warehouse where reserved quantity is set from Sales Order.", + "fieldname": "default_warehouse", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Warehouse", + "oldfieldname": "default_warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "description": "Percentage variation in quantity to be allowed while receiving or delivering this item.", - "fieldname": "tolerance", - "fieldtype": "Float", - "label": "Allowance Percent", - "oldfieldname": "tolerance", - "oldfieldtype": "Currency", - "permlevel": 0, + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "description": "Percentage variation in quantity to be allowed while receiving or delivering this item.", + "fieldname": "tolerance", + "fieldtype": "Float", + "label": "Allowance Percent", + "oldfieldname": "tolerance", + "oldfieldtype": "Currency", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "fieldname": "valuation_method", - "fieldtype": "Select", - "label": "Valuation Method", - "options": "\nFIFO\nMoving Average", - "permlevel": 0, + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "fieldname": "valuation_method", + "fieldtype": "Select", + "label": "Valuation Method", + "options": "\nFIFO\nMoving Average", + "permlevel": 0, "read_only": 0 - }, + }, { - "default": "0.00", - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "description": "You can enter the minimum quantity of this item to be ordered.", - "fieldname": "min_order_qty", - "fieldtype": "Float", - "hidden": 0, - "label": "Minimum Order Qty", - "oldfieldname": "min_order_qty", - "oldfieldtype": "Currency", - "permlevel": 0, + "default": "0.00", + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "description": "You can enter the minimum quantity of this item to be ordered.", + "fieldname": "min_order_qty", + "fieldtype": "Float", + "hidden": 0, + "label": "Minimum Order Qty", + "oldfieldname": "min_order_qty", + "oldfieldtype": "Currency", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "default": "No", - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "description": "Select \"Yes\" if this item is used for some internal purpose in your company.", - "fieldname": "is_asset_item", - "fieldtype": "Select", - "label": "Is Fixed Asset Item", - "oldfieldname": "is_asset_item", - "oldfieldtype": "Select", - "options": "Yes\nNo", - "permlevel": 0, - "read_only": 0, + "default": "No", + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "description": "Select \"Yes\" if this item is used for some internal purpose in your company.", + "fieldname": "is_asset_item", + "fieldtype": "Select", + "label": "Is Fixed Asset Item", + "oldfieldname": "is_asset_item", + "oldfieldtype": "Select", + "options": "Yes\nNo", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "default": "No", - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "fieldname": "has_batch_no", - "fieldtype": "Select", - "label": "Has Batch No", - "oldfieldname": "has_batch_no", - "oldfieldtype": "Select", - "options": "Yes\nNo", - "permlevel": 0, - "read_only": 0, + "default": "No", + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "fieldname": "has_batch_no", + "fieldtype": "Select", + "label": "Has Batch No", + "oldfieldname": "has_batch_no", + "oldfieldtype": "Select", + "options": "Yes\nNo", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "default": "No", - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "description": "Selecting \"Yes\" will give a unique identity to each entity of this item which can be viewed in the Serial No master.", - "fieldname": "has_serial_no", - "fieldtype": "Select", - "in_filter": 1, - "label": "Has Serial No", - "oldfieldname": "has_serial_no", - "oldfieldtype": "Select", - "options": "Yes\nNo", - "permlevel": 0, - "read_only": 0, + "default": "No", + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "description": "Selecting \"Yes\" will give a unique identity to each entity of this item which can be viewed in the Serial No master.", + "fieldname": "has_serial_no", + "fieldtype": "Select", + "in_filter": 1, + "label": "Has Serial No", + "oldfieldname": "has_serial_no", + "oldfieldtype": "Select", + "options": "Yes\nNo", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "depends_on": "eval: doc.has_serial_no===\"Yes\"", - "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", - "label": "Serial Number Series", - "no_copy": 1, + "depends_on": "eval: doc.has_serial_no===\"Yes\"", + "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", + "label": "Serial Number Series", + "no_copy": 1, "permlevel": 0 - }, + }, { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "fieldname": "warranty_period", - "fieldtype": "Data", - "label": "Warranty Period (in days)", - "oldfieldname": "warranty_period", - "oldfieldtype": "Data", - "permlevel": 0, + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "fieldname": "warranty_period", + "fieldtype": "Data", + "label": "Warranty Period (in days)", + "oldfieldname": "warranty_period", + "oldfieldtype": "Data", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "fieldname": "end_of_life", - "fieldtype": "Date", - "label": "End of Life", - "oldfieldname": "end_of_life", - "oldfieldtype": "Date", - "permlevel": 0, + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "fieldname": "end_of_life", + "fieldtype": "Date", + "label": "End of Life", + "oldfieldname": "end_of_life", + "oldfieldtype": "Date", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "description": "Net Weight of each Item", - "fieldname": "net_weight", - "fieldtype": "Float", - "label": "Net Weight", - "permlevel": 0, + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "description": "Net Weight of each Item", + "fieldname": "net_weight", + "fieldtype": "Float", + "label": "Net Weight", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "fieldname": "weight_uom", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Weight UOM", - "options": "UOM", - "permlevel": 0, + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "fieldname": "weight_uom", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Weight UOM", + "options": "UOM", + "permlevel": 0, "read_only": 0 - }, + }, { - "description": "Auto-raise Material Request if quantity goes below re-order level in a warehouse", - "fieldname": "reorder_section", - "fieldtype": "Section Break", - "label": "Re-order", - "options": "icon-rss", - "permlevel": 0, + "description": "Auto-raise Material Request if quantity goes below re-order level in a warehouse", + "fieldname": "reorder_section", + "fieldtype": "Section Break", + "label": "Re-order", + "options": "icon-rss", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "fieldname": "re_order_level", - "fieldtype": "Float", - "label": "Re-Order Level", - "oldfieldname": "re_order_level", - "oldfieldtype": "Currency", - "permlevel": 0, + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "fieldname": "re_order_level", + "fieldtype": "Float", + "label": "Re-Order Level", + "oldfieldname": "re_order_level", + "oldfieldtype": "Currency", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_stock_item==\"Yes\"", - "fieldname": "re_order_qty", - "fieldtype": "Float", - "label": "Re-Order Qty", - "permlevel": 0, + "depends_on": "eval:doc.is_stock_item==\"Yes\"", + "fieldname": "re_order_qty", + "fieldtype": "Float", + "label": "Re-Order Qty", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "section_break_31", - "fieldtype": "Section Break", - "permlevel": 0, + "fieldname": "section_break_31", + "fieldtype": "Section Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "item_reorder", - "fieldtype": "Table", - "label": "Warehouse-wise Item Reorder", - "options": "Item Reorder", - "permlevel": 0, + "fieldname": "item_reorder", + "fieldtype": "Table", + "label": "Warehouse-wise Item Reorder", + "options": "Item Reorder", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "purchase_details", - "fieldtype": "Section Break", - "label": "Purchase Details", - "oldfieldtype": "Section Break", - "options": "icon-shopping-cart", - "permlevel": 0, + "fieldname": "purchase_details", + "fieldtype": "Section Break", + "label": "Purchase Details", + "oldfieldtype": "Section Break", + "options": "icon-shopping-cart", + "permlevel": 0, "read_only": 0 - }, + }, { - "default": "Yes", - "description": "Selecting \"Yes\" will allow this item to appear in Purchase Order , Purchase Receipt.", - "fieldname": "is_purchase_item", - "fieldtype": "Select", - "label": "Is Purchase Item", - "oldfieldname": "is_purchase_item", - "oldfieldtype": "Select", - "options": "Yes\nNo", - "permlevel": 0, - "read_only": 0, + "default": "Yes", + "description": "Selecting \"Yes\" will allow this item to appear in Purchase Order , Purchase Receipt.", + "fieldname": "is_purchase_item", + "fieldtype": "Select", + "label": "Is Purchase Item", + "oldfieldname": "is_purchase_item", + "oldfieldtype": "Select", + "options": "Yes\nNo", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "fieldname": "default_supplier", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Supplier", - "options": "Supplier", + "fieldname": "default_supplier", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Supplier", + "options": "Supplier", "permlevel": 0 - }, + }, { - "depends_on": "eval:doc.is_purchase_item==\"Yes\"", - "description": "Lead Time days is number of days by which this item is expected in your warehouse. This days is fetched in Material Request when you select this item.", - "fieldname": "lead_time_days", - "fieldtype": "Int", - "label": "Lead Time Days", - "no_copy": 1, - "oldfieldname": "lead_time_days", - "oldfieldtype": "Int", - "permlevel": 0, + "depends_on": "eval:doc.is_purchase_item==\"Yes\"", + "description": "Lead Time days is number of days by which this item is expected in your warehouse. This days is fetched in Material Request when you select this item.", + "fieldname": "lead_time_days", + "fieldtype": "Int", + "label": "Lead Time Days", + "no_copy": 1, + "oldfieldname": "lead_time_days", + "oldfieldtype": "Int", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_purchase_item==\"Yes\"", - "description": "Default Purchase Account in which cost of the item will be debited.", - "fieldname": "expense_account", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Expense Account", - "oldfieldname": "purchase_account", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, + "depends_on": "eval:doc.is_purchase_item==\"Yes\"", + "description": "Default Purchase Account in which cost of the item will be debited.", + "fieldname": "expense_account", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Expense Account", + "oldfieldname": "purchase_account", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_purchase_item==\"Yes\"", - "description": "", - "fieldname": "buying_cost_center", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Buying Cost Center", - "oldfieldname": "cost_center", - "oldfieldtype": "Link", - "options": "Cost Center", - "permlevel": 0, + "depends_on": "eval:doc.is_purchase_item==\"Yes\"", + "description": "", + "fieldname": "buying_cost_center", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Buying Cost Center", + "oldfieldname": "cost_center", + "oldfieldtype": "Link", + "options": "Cost Center", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_purchase_item==\"Yes\"", - "fieldname": "last_purchase_rate", - "fieldtype": "Float", - "label": "Last Purchase Rate", - "no_copy": 1, - "oldfieldname": "last_purchase_rate", - "oldfieldtype": "Currency", - "permlevel": 0, + "depends_on": "eval:doc.is_purchase_item==\"Yes\"", + "fieldname": "last_purchase_rate", + "fieldtype": "Float", + "label": "Last Purchase Rate", + "no_copy": 1, + "oldfieldname": "last_purchase_rate", + "oldfieldtype": "Currency", + "permlevel": 0, "read_only": 1 - }, + }, { - "depends_on": "eval:doc.is_purchase_item==\"Yes\"", - "fieldname": "column_break2", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "depends_on": "eval:doc.is_purchase_item==\"Yes\"", + "fieldname": "column_break2", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "depends_on": "eval:doc.is_purchase_item==\"Yes\"", - "fieldname": "uom_conversion_details", - "fieldtype": "Table", - "label": "UOM Conversion Details", - "no_copy": 1, - "oldfieldname": "uom_conversion_details", - "oldfieldtype": "Table", - "options": "UOM Conversion Detail", - "permlevel": 0, + "depends_on": "eval:doc.is_purchase_item==\"Yes\"", + "fieldname": "uom_conversion_details", + "fieldtype": "Table", + "label": "UOM Conversion Details", + "no_copy": 1, + "oldfieldname": "uom_conversion_details", + "oldfieldtype": "Table", + "options": "UOM Conversion Detail", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_purchase_item==\"Yes\"", - "fieldname": "manufacturer", - "fieldtype": "Data", - "label": "Manufacturer", - "permlevel": 0, + "depends_on": "eval:doc.is_purchase_item==\"Yes\"", + "fieldname": "manufacturer", + "fieldtype": "Data", + "label": "Manufacturer", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_purchase_item==\"Yes\"", - "fieldname": "manufacturer_part_no", - "fieldtype": "Data", - "label": "Manufacturer Part Number", - "permlevel": 0, + "depends_on": "eval:doc.is_purchase_item==\"Yes\"", + "fieldname": "manufacturer_part_no", + "fieldtype": "Data", + "label": "Manufacturer Part Number", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_purchase_item==\"Yes\"", - "fieldname": "item_supplier_details", - "fieldtype": "Table", - "label": "Item Supplier Details", - "options": "Item Supplier", - "permlevel": 0, + "depends_on": "eval:doc.is_purchase_item==\"Yes\"", + "fieldname": "item_supplier_details", + "fieldtype": "Table", + "label": "Item Supplier Details", + "options": "Item Supplier", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "sales_details", - "fieldtype": "Section Break", - "label": "Sales Details", - "oldfieldtype": "Section Break", - "options": "icon-tag", - "permlevel": 0, + "fieldname": "sales_details", + "fieldtype": "Section Break", + "label": "Sales Details", + "oldfieldtype": "Section Break", + "options": "icon-tag", + "permlevel": 0, "read_only": 0 - }, + }, { - "default": "Yes", - "description": "Selecting \"Yes\" will allow this item to figure in Sales Order, Delivery Note", - "fieldname": "is_sales_item", - "fieldtype": "Select", - "in_filter": 1, - "label": "Is Sales Item", - "oldfieldname": "is_sales_item", - "oldfieldtype": "Select", - "options": "Yes\nNo", - "permlevel": 0, - "read_only": 0, + "default": "Yes", + "description": "Selecting \"Yes\" will allow this item to figure in Sales Order, Delivery Note", + "fieldname": "is_sales_item", + "fieldtype": "Select", + "in_filter": 1, + "label": "Is Sales Item", + "oldfieldname": "is_sales_item", + "oldfieldtype": "Select", + "options": "Yes\nNo", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "default": "No", - "depends_on": "eval:doc.is_sales_item==\"Yes\"", - "description": "Select \"Yes\" if this item represents some work like training, designing, consulting etc.", - "fieldname": "is_service_item", - "fieldtype": "Select", - "in_filter": 1, - "label": "Is Service Item", - "oldfieldname": "is_service_item", - "oldfieldtype": "Select", - "options": "Yes\nNo", - "permlevel": 0, - "read_only": 0, + "default": "No", + "depends_on": "eval:doc.is_sales_item==\"Yes\"", + "description": "Select \"Yes\" if this item represents some work like training, designing, consulting etc.", + "fieldname": "is_service_item", + "fieldtype": "Select", + "in_filter": 1, + "label": "Is Service Item", + "oldfieldname": "is_service_item", + "oldfieldtype": "Select", + "options": "Yes\nNo", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:doc.is_sales_item==\"Yes\"", - "fieldname": "max_discount", - "fieldtype": "Float", - "label": "Max Discount (%)", - "oldfieldname": "max_discount", - "oldfieldtype": "Currency", - "permlevel": 0, + "depends_on": "eval:doc.is_sales_item==\"Yes\"", + "fieldname": "max_discount", + "fieldtype": "Float", + "label": "Max Discount (%)", + "oldfieldname": "max_discount", + "oldfieldtype": "Currency", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_sales_item==\"Yes\"", - "fieldname": "income_account", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Income Account", - "options": "Account", - "permlevel": 0, + "depends_on": "eval:doc.is_sales_item==\"Yes\"", + "fieldname": "income_account", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Income Account", + "options": "Account", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_sales_item==\"Yes\"", - "fieldname": "selling_cost_center", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Selling Cost Center", - "options": "Cost Center", - "permlevel": 0, + "depends_on": "eval:doc.is_sales_item==\"Yes\"", + "fieldname": "selling_cost_center", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Selling Cost Center", + "options": "Cost Center", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.is_sales_item==\"Yes\"", - "fieldname": "column_break3", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "depends_on": "eval:doc.is_sales_item==\"Yes\"", + "fieldname": "column_break3", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "depends_on": "eval:doc.is_sales_item==\"Yes\"", - "description": "For the convenience of customers, these codes can be used in print formats like Invoices and Delivery Notes", - "fieldname": "item_customer_details", - "fieldtype": "Table", - "label": "Customer Codes", - "options": "Item Customer Detail", - "permlevel": 0, + "depends_on": "eval:doc.is_sales_item==\"Yes\"", + "description": "For the convenience of customers, these codes can be used in print formats like Invoices and Delivery Notes", + "fieldname": "item_customer_details", + "fieldtype": "Table", + "label": "Customer Codes", + "options": "Item Customer Detail", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "item_tax_section_break", - "fieldtype": "Section Break", - "label": "Item Tax", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, + "fieldname": "item_tax_section_break", + "fieldtype": "Section Break", + "label": "Item Tax", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "item_tax", - "fieldtype": "Table", - "label": "Item Tax1", - "oldfieldname": "item_tax", - "oldfieldtype": "Table", - "options": "Item Tax", - "permlevel": 0, + "fieldname": "item_tax", + "fieldtype": "Table", + "label": "Item Tax1", + "oldfieldname": "item_tax", + "oldfieldtype": "Table", + "options": "Item Tax", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "inspection_criteria", - "fieldtype": "Section Break", - "label": "Inspection Criteria", - "oldfieldtype": "Section Break", - "options": "icon-search", - "permlevel": 0, + "fieldname": "inspection_criteria", + "fieldtype": "Section Break", + "label": "Inspection Criteria", + "oldfieldtype": "Section Break", + "options": "icon-search", + "permlevel": 0, "read_only": 0 - }, + }, { - "default": "No", - "fieldname": "inspection_required", - "fieldtype": "Select", - "label": "Inspection Required", - "no_copy": 0, - "oldfieldname": "inspection_required", - "oldfieldtype": "Select", - "options": "\nYes\nNo", - "permlevel": 0, - "read_only": 0, + "default": "No", + "fieldname": "inspection_required", + "fieldtype": "Select", + "label": "Inspection Required", + "no_copy": 0, + "oldfieldname": "inspection_required", + "oldfieldtype": "Select", + "options": "\nYes\nNo", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:doc.inspection_required==\"Yes\"", - "description": "Quality Inspection Parameters", - "fieldname": "item_specification_details", - "fieldtype": "Table", - "label": "Item Quality Inspection Parameter", - "oldfieldname": "item_specification_details", - "oldfieldtype": "Table", - "options": "Item Quality Inspection Parameter", - "permlevel": 0, + "depends_on": "eval:doc.inspection_required==\"Yes\"", + "description": "Quality Inspection Parameters", + "fieldname": "item_specification_details", + "fieldtype": "Table", + "label": "Item Quality Inspection Parameter", + "oldfieldname": "item_specification_details", + "oldfieldtype": "Table", + "options": "Item Quality Inspection Parameter", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "manufacturing", - "fieldtype": "Section Break", - "label": "Manufacturing", - "oldfieldtype": "Section Break", - "options": "icon-cogs", - "permlevel": 0, + "fieldname": "manufacturing", + "fieldtype": "Section Break", + "label": "Manufacturing", + "oldfieldtype": "Section Break", + "options": "icon-cogs", + "permlevel": 0, "read_only": 0 - }, + }, { - "default": "No", - "description": "Selecting \"Yes\" will allow you to create Bill of Material showing raw material and operational costs incurred to manufacture this item.", - "fieldname": "is_manufactured_item", - "fieldtype": "Select", - "label": "Allow Bill of Materials", - "oldfieldname": "is_manufactured_item", - "oldfieldtype": "Select", - "options": "Yes\nNo", - "permlevel": 0, - "read_only": 0, + "default": "No", + "description": "Selecting \"Yes\" will allow you to create Bill of Material showing raw material and operational costs incurred to manufacture this item.", + "fieldname": "is_manufactured_item", + "fieldtype": "Select", + "label": "Allow Bill of Materials", + "oldfieldname": "is_manufactured_item", + "oldfieldtype": "Select", + "options": "Yes\nNo", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:doc.is_manufactured_item==\"Yes\"", - "fieldname": "default_bom", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default BOM", - "no_copy": 1, - "oldfieldname": "default_bom", - "oldfieldtype": "Link", - "options": "BOM", - "permlevel": 0, + "depends_on": "eval:doc.is_manufactured_item==\"Yes\"", + "fieldname": "default_bom", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default BOM", + "no_copy": 1, + "oldfieldname": "default_bom", + "oldfieldtype": "Link", + "options": "BOM", + "permlevel": 0, "read_only": 1 - }, + }, { - "default": "No", - "depends_on": "eval:doc.is_manufactured_item==\"Yes\"", - "description": "Selecting \"Yes\" will allow you to make a Production Order for this item.", - "fieldname": "is_pro_applicable", - "fieldtype": "Select", - "label": "Allow Production Order", - "oldfieldname": "is_pro_applicable", - "oldfieldtype": "Select", - "options": "Yes\nNo", - "permlevel": 0, - "read_only": 0, + "default": "No", + "depends_on": "eval:doc.is_manufactured_item==\"Yes\"", + "description": "Selecting \"Yes\" will allow you to make a Production Order for this item.", + "fieldname": "is_pro_applicable", + "fieldtype": "Select", + "label": "Allow Production Order", + "oldfieldname": "is_pro_applicable", + "oldfieldtype": "Select", + "options": "Yes\nNo", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "default": "No", - "description": "Select \"Yes\" if you supply raw materials to your supplier to manufacture this item.", - "fieldname": "is_sub_contracted_item", - "fieldtype": "Select", - "label": "Is Sub Contracted Item", - "oldfieldname": "is_sub_contracted_item", - "oldfieldtype": "Select", - "options": "Yes\nNo", - "permlevel": 0, - "read_only": 0, + "default": "No", + "description": "Select \"Yes\" if you supply raw materials to your supplier to manufacture this item.", + "fieldname": "is_sub_contracted_item", + "fieldtype": "Select", + "label": "Is Sub Contracted Item", + "oldfieldname": "is_sub_contracted_item", + "oldfieldtype": "Select", + "options": "Yes\nNo", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "fieldname": "customer_code", - "fieldtype": "Data", - "hidden": 1, - "in_filter": 1, - "label": "Customer Code", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, + "fieldname": "customer_code", + "fieldtype": "Data", + "hidden": 1, + "in_filter": 1, + "label": "Customer Code", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "website_section", - "fieldtype": "Section Break", - "label": "Website", - "options": "icon-globe", - "permlevel": 0, + "fieldname": "website_section", + "fieldtype": "Section Break", + "label": "Website", + "options": "icon-globe", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "show_in_website", - "fieldtype": "Check", - "label": "Show in Website", - "permlevel": 0, + "fieldname": "show_in_website", + "fieldtype": "Check", + "label": "Show in Website", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "show_in_website", - "description": "website page link", - "fieldname": "page_name", - "fieldtype": "Data", - "label": "Page Name", - "no_copy": 1, - "permlevel": 0, + "depends_on": "show_in_website", + "description": "website page link", + "fieldname": "page_name", + "fieldtype": "Data", + "label": "Page Name", + "no_copy": 1, + "permlevel": 0, "read_only": 1 - }, + }, { - "depends_on": "show_in_website", - "description": "Products will be sorted by weight-age in default searches. More the weight-age, higher the product will appear in the list.", - "fieldname": "weightage", - "fieldtype": "Int", - "label": "Weightage", - "permlevel": 0, - "read_only": 0, + "depends_on": "show_in_website", + "description": "Products will be sorted by weight-age in default searches. More the weight-age, higher the product will appear in the list.", + "fieldname": "weightage", + "fieldtype": "Int", + "label": "Weightage", + "permlevel": 0, + "read_only": 0, "search_index": 1 - }, + }, { - "depends_on": "show_in_website", - "description": "Show a slideshow at the top of the page", - "fieldname": "slideshow", - "fieldtype": "Link", - "label": "Slideshow", - "options": "Website Slideshow", - "permlevel": 0, + "depends_on": "show_in_website", + "description": "Show a slideshow at the top of the page", + "fieldname": "slideshow", + "fieldtype": "Link", + "label": "Slideshow", + "options": "Website Slideshow", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "show_in_website", - "description": "Item Image (if not slideshow)", - "fieldname": "website_image", - "fieldtype": "Select", - "label": "Image", - "options": "attach_files:", - "permlevel": 0, + "depends_on": "show_in_website", + "description": "Item Image (if not slideshow)", + "fieldname": "website_image", + "fieldtype": "Select", + "label": "Image", + "options": "attach_files:", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "cb72", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "cb72", + "fieldtype": "Column Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "show_in_website", - "description": "Show \"In Stock\" or \"Not in Stock\" based on stock available in this warehouse.", - "fieldname": "website_warehouse", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Website Warehouse", - "options": "Warehouse", - "permlevel": 0, + "depends_on": "show_in_website", + "description": "Show \"In Stock\" or \"Not in Stock\" based on stock available in this warehouse.", + "fieldname": "website_warehouse", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Website Warehouse", + "options": "Warehouse", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "show_in_website", - "description": "List this Item in multiple groups on the website.", - "fieldname": "website_item_groups", - "fieldtype": "Table", - "label": "Website Item Groups", - "options": "Website Item Group", - "permlevel": 0, + "depends_on": "show_in_website", + "description": "List this Item in multiple groups on the website.", + "fieldname": "website_item_groups", + "fieldtype": "Table", + "label": "Website Item Groups", + "options": "Website Item Group", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "show_in_website", - "fieldname": "sb72", - "fieldtype": "Section Break", - "permlevel": 0, + "depends_on": "show_in_website", + "fieldname": "sb72", + "fieldtype": "Section Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "show_in_website", - "fieldname": "copy_from_item_group", - "fieldtype": "Button", - "label": "Copy From Item Group", - "permlevel": 0, + "depends_on": "show_in_website", + "fieldname": "copy_from_item_group", + "fieldtype": "Button", + "label": "Copy From Item Group", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "show_in_website", - "fieldname": "item_website_specifications", - "fieldtype": "Table", - "label": "Item Website Specifications", - "options": "Item Website Specification", - "permlevel": 0, + "depends_on": "show_in_website", + "fieldname": "item_website_specifications", + "fieldtype": "Table", + "label": "Item Website Specifications", + "options": "Item Website Specification", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "show_in_website", - "fieldname": "web_long_description", - "fieldtype": "Text Editor", - "label": "Website Description", - "permlevel": 0, + "depends_on": "show_in_website", + "fieldname": "web_long_description", + "fieldtype": "Text Editor", + "label": "Website Description", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "parent_website_route", - "fieldtype": "Read Only", - "ignore_user_permissions": 1, - "label": "Parent Website Route", - "no_copy": 1, - "options": "", + "fieldname": "parent_website_route", + "fieldtype": "Read Only", + "ignore_user_permissions": 1, + "label": "Parent Website Route", + "no_copy": 1, + "options": "", "permlevel": 0 } - ], - "icon": "icon-tag", - "idx": 1, - "max_attachments": 1, - "modified": "2014-08-19 06:41:28.565607", - "modified_by": "Administrator", - "module": "Stock", - "name": "Item", - "owner": "Administrator", + ], + "icon": "icon-tag", + "idx": 1, + "max_attachments": 1, + "modified": "2014-09-26 06:04:48.683214", + "modified_by": "Administrator", + "module": "Stock", + "name": "Item", + "owner": "Administrator", "permissions": [ { - "create": 1, - "delete": 1, - "email": 1, - "import": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Material Master Manager", - "submit": 0, + "create": 1, + "delete": 1, + "email": 1, + "import": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Material Master Manager", + "submit": 0, "write": 1 - }, + }, { - "amend": 0, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Material Manager", - "submit": 0, + "amend": 0, + "create": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Material Manager", + "submit": 0, "write": 0 - }, + }, { - "amend": 0, - "apply_user_permissions": 1, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Material User", - "submit": 0, + "amend": 0, + "apply_user_permissions": 1, + "create": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Material User", + "submit": 0, "write": 0 - }, + }, { - "apply_user_permissions": 1, - "permlevel": 0, - "read": 1, + "apply_user_permissions": 1, + "permlevel": 0, + "read": 1, "role": "Sales User" - }, + }, { - "apply_user_permissions": 1, - "permlevel": 0, - "read": 1, + "apply_user_permissions": 1, + "permlevel": 0, + "read": 1, "role": "Purchase User" - }, + }, { - "apply_user_permissions": 1, - "permlevel": 0, - "read": 1, + "apply_user_permissions": 1, + "permlevel": 0, + "read": 1, "role": "Maintenance User" - }, + }, { - "apply_user_permissions": 1, - "permlevel": 0, - "read": 1, + "apply_user_permissions": 1, + "permlevel": 0, + "read": 1, "role": "Accounts User" - }, + }, { - "apply_user_permissions": 1, - "permlevel": 0, - "read": 1, + "apply_user_permissions": 1, + "permlevel": 0, + "read": 1, "role": "Manufacturing User" } - ], + ], "search_fields": "item_name,description,item_group,customer_code" -} +} \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index b8a31909ce..4fcf937e60 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -11,6 +11,7 @@ from frappe.website.render import clear_cache from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow class WarehouseNotSet(frappe.ValidationError): pass +class DuplicateVariant(frappe.ValidationError): pass class Item(WebsiteGenerator): page_title_field = "item_name" @@ -50,6 +51,7 @@ class Item(WebsiteGenerator): self.validate_barcode() self.cant_change() self.validate_item_type_for_reorder() + self.validate_variants_are_unique() if not self.get("__islocal"): self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group") @@ -61,6 +63,7 @@ class Item(WebsiteGenerator): invalidate_cache_for_item(self) self.validate_name_with_item_group() self.update_item_price() + self.make_variants() def get_context(self, context): context["parent_groups"] = get_parent_item_groups(self.item_group) + \ @@ -114,6 +117,45 @@ class Item(WebsiteGenerator): if not matched: frappe.throw(_("Default Unit of Measure can not be changed directly because you have already made some transaction(s) with another UOM. To change default UOM, use 'UOM Replace Utility' tool under Stock module.")) + def validate_variants_are_unique(self): + variants = [] + for d in self.item_variants: + key = (d.item_attribute, d.item_attribute_value) + if key in variants: + frappe.throw(_("{0} {1} is entered more than once in Item Variants table").format(d.item_attribute, + d.item_attribute_value), DuplicateVariant) + variants.append(key) + + def make_variants(self): + variant_dict = {} + variant_item_codes = [] + + for d in self.item_variants: + variant_dict.setdefault(d.item_attribute, []).append(d.item_attribute_value) + + attributes = variant_dict.keys() + for d in frappe.get_list("Item Attribute", order_by = "priority asc", ignore_permissions=True): + if d.name in attributes: + attr = frappe.get_doc("Item Attribute", d.name) + abbr = dict((d.attribute_value, d.abbr) for d in attr.item_attribute_values) + for value in variant_dict[d.name]: + variant_item_codes.append(self.name + "-" + abbr[value]) + + # delete missing variants + existing_variants = [d.name for d in frappe.get_list("Item", + filters={"variant_of":self.name}, ignore_permissions=True)] + + for existing_variant in existing_variants: + if existing_variant.name not in variant_item_codes: + frappe.delete_doc("Item", existing_variant.name) + else: + # update mandatory fields + pass + + # for item_code in variant_item_codes: + # for + + def validate_conversion_factor(self): check_list = [] for d in self.get('uom_conversion_details'): diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index 56150cabac..b2714e90ac 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -6,13 +6,23 @@ import unittest import frappe from frappe.test_runner import make_test_records +from erpnext.stock.doctype.item.item import WarehouseNotSet, DuplicateVariant test_ignore = ["BOM"] test_dependencies = ["Warehouse"] class TestItem(unittest.TestCase): + def test_duplicate_variant(self): + item = frappe.copy_doc(test_records[11]) + item.append("item_variants", {"item_attribute": "Test Size", "item_attribute_value": "Small"}) + self.assertRaises(DuplicateVariant, item.insert) + + def test_item_creation(self): + frappe.delete_doc("Item", test_records[11].get("item_code")) + item = frappe.copy_doc(test_records[11]) + item.insert() + def test_default_warehouse(self): - from erpnext.stock.doctype.item.item import WarehouseNotSet item = frappe.copy_doc(test_records[0]) item.is_stock_item = "Yes" item.default_warehouse = None diff --git a/erpnext/stock/doctype/item/test_records.json b/erpnext/stock/doctype/item/test_records.json index a256149571..fdae118b1a 100644 --- a/erpnext/stock/doctype/item/test_records.json +++ b/erpnext/stock/doctype/item/test_records.json @@ -1,7 +1,7 @@ [ { "default_warehouse": "_Test Warehouse - _TC", - "description": "_Test Item", + "description": "_Test Item 1", "doctype": "Item", "expense_account": "_Test Account Cost for Goods Sold - _TC", "has_batch_no": "No", @@ -57,7 +57,7 @@ }, { "default_warehouse": "_Test Warehouse - _TC", - "description": "_Test Item Home Desktop 100", + "description": "_Test Item Home Desktop 100 3", "doctype": "Item", "expense_account": "_Test Account Cost for Goods Sold - _TC", "has_batch_no": "No", @@ -87,7 +87,7 @@ }, { "default_warehouse": "_Test Warehouse - _TC", - "description": "_Test Item Home Desktop 200", + "description": "_Test Item Home Desktop 200 4", "doctype": "Item", "expense_account": "_Test Account Cost for Goods Sold - _TC", "has_batch_no": "No", @@ -108,7 +108,7 @@ "stock_uom": "_Test UOM" }, { - "description": "_Test Sales BOM Item", + "description": "_Test Sales BOM Item 5", "doctype": "Item", "expense_account": "_Test Account Cost for Goods Sold - _TC", "has_batch_no": "No", @@ -129,7 +129,7 @@ }, { "default_warehouse": "_Test Warehouse - _TC", - "description": "_Test FG Item", + "description": "_Test FG Item 6", "doctype": "Item", "expense_account": "_Test Account Cost for Goods Sold - _TC", "has_batch_no": "No", @@ -149,7 +149,7 @@ "stock_uom": "_Test UOM" }, { - "description": "_Test Non Stock Item", + "description": "_Test Non Stock Item 7", "doctype": "Item", "has_batch_no": "No", "has_serial_no": "No", @@ -168,7 +168,7 @@ }, { "default_warehouse": "_Test Warehouse - _TC", - "description": "_Test Serialized Item", + "description": "_Test Serialized Item 8", "doctype": "Item", "has_batch_no": "No", "has_serial_no": "Yes", @@ -187,7 +187,7 @@ }, { "default_warehouse": "_Test Warehouse - _TC", - "description": "_Test Serialized Item", + "description": "_Test Serialized Item 9", "doctype": "Item", "has_batch_no": "No", "has_serial_no": "Yes", @@ -207,7 +207,7 @@ }, { "default_warehouse": "_Test Warehouse - _TC", - "description": "_Test Item Home Desktop Manufactured", + "description": "_Test Item Home Desktop Manufactured 10", "doctype": "Item", "expense_account": "_Test Account Cost for Goods Sold - _TC", "has_batch_no": "No", @@ -229,7 +229,7 @@ }, { "default_warehouse": "_Test Warehouse - _TC", - "description": "_Test FG Item 2", + "description": "_Test FG Item 2 11", "doctype": "Item", "expense_account": "_Test Account Cost for Goods Sold - _TC", "has_batch_no": "No", @@ -247,5 +247,32 @@ "item_group": "_Test Item Group Desktops", "item_name": "_Test FG Item 2", "stock_uom": "_Test UOM" + }, + { + "default_warehouse": "_Test Warehouse - _TC", + "description": "_Test Variant Item 12", + "doctype": "Item", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "has_batch_no": "No", + "has_serial_no": "No", + "income_account": "Sales - _TC", + "inspection_required": "No", + "is_asset_item": "No", + "is_pro_applicable": "Yes", + "is_purchase_item": "Yes", + "is_sales_item": "Yes", + "is_service_item": "No", + "is_stock_item": "Yes", + "is_sub_contracted_item": "Yes", + "item_code": "_Test Variant Item", + "item_group": "_Test Item Group Desktops", + "item_name": "_Test Variant Item", + "stock_uom": "_Test UOM", + "item_variants": [ + {"item_attribute": "Test Size", "item_attribute_value": "Small"}, + {"item_attribute": "Test Size", "item_attribute_value": "Medium"}, + {"item_attribute": "Test Size", "item_attribute_value": "Large"} + ] } + ] diff --git a/erpnext/stock/doctype/item_attribute/__init__.py b/erpnext/stock/doctype/item_attribute/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.json b/erpnext/stock/doctype/item_attribute/item_attribute.json new file mode 100644 index 0000000000..d41646c564 --- /dev/null +++ b/erpnext/stock/doctype/item_attribute/item_attribute.json @@ -0,0 +1,87 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "field:attribute_name", + "creation": "2014-09-26 03:49:54.899170", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", + "fields": [ + { + "allow_on_submit": 0, + "fieldname": "attribute_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Attribute Name", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0 + }, + { + "default": "1", + "description": "Lower the number, higher the priority in the Item Code suffix that will be created for this Item Attribute for the Item Variant", + "fieldname": "priority", + "fieldtype": "Int", + "label": "Priority", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "item_attribute_values", + "fieldtype": "Table", + "label": "Item Attribute Values", + "options": "Item Attribute Value", + "permlevel": 0, + "precision": "" + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "icon-edit", + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "modified": "2014-09-26 06:08:28.729519", + "modified_by": "Administrator", + "module": "Stock", + "name": "Item Attribute", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 0, + "export": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 1, + "role": "Material Master Manager", + "set_user_permissions": 0, + "submit": 0, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.py b/erpnext/stock/doctype/item_attribute/item_attribute.py new file mode 100644 index 0000000000..e4fd38cce6 --- /dev/null +++ b/erpnext/stock/doctype/item_attribute/item_attribute.py @@ -0,0 +1,19 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe import _ + +class ItemAttribute(Document): + def validate(self): + values, abbrs = [], [] + for d in self.item_attribute_values: + if d.attribute_value in values: + frappe.throw(_("{0} must appear only once").format(d.attribute_value)) + values.append(d.attribute_value) + + if d.abbr in abbrs: + frappe.throw(_("{0} must appear only once").format(d.abbr)) + abbrs.append(d.abbr) diff --git a/erpnext/stock/doctype/item_attribute/test_item_attribute.py b/erpnext/stock/doctype/item_attribute/test_item_attribute.py new file mode 100644 index 0000000000..51c335ce26 --- /dev/null +++ b/erpnext/stock/doctype/item_attribute/test_item_attribute.py @@ -0,0 +1,10 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors +# See license.txt + +import frappe +import unittest + +test_records = frappe.get_test_records('Item Attribute') + +class TestItemAttribute(unittest.TestCase): + pass diff --git a/erpnext/stock/doctype/item_attribute/test_records.json b/erpnext/stock/doctype/item_attribute/test_records.json new file mode 100644 index 0000000000..f418475041 --- /dev/null +++ b/erpnext/stock/doctype/item_attribute/test_records.json @@ -0,0 +1,22 @@ +[ + { + "doctype": "Item Attribute", + "attribute_name": "Test Size", + "priority": 1, + "item_attribute_values": [ + {"attribute_value": "Small", "abbr": "SM"}, + {"attribute_value": "Medium", "abbr": "MD"}, + {"attribute_value": "Large", "abbr": "LG"} + ] + }, + { + "doctype": "Item Attribute", + "attribute_name": "Test Colour", + "priority": 2, + "item_attribute_values": [ + {"attribute_value": "Red", "abbr": "R"}, + {"attribute_value": "Green", "abbr": "G"}, + {"attribute_value": "Blue", "abbr": "B"} + ] + } +] diff --git a/erpnext/stock/doctype/item_attribute_value/__init__.py b/erpnext/stock/doctype/item_attribute_value/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/stock/doctype/item_attribute_value/item_attribute_value.json b/erpnext/stock/doctype/item_attribute_value/item_attribute_value.json new file mode 100644 index 0000000000..f6d66bcd89 --- /dev/null +++ b/erpnext/stock/doctype/item_attribute_value/item_attribute_value.json @@ -0,0 +1,64 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "", + "creation": "2014-09-26 03:52:31.161255", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", + "fields": [ + { + "allow_on_submit": 0, + "fieldname": "attribute_value", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Attribute Value", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "description": "This will be appended to the Item Code of the variant. For example, if your abbreviation is \"SM\", and the item code is \"T-SHIRT\", the item code of the variant will be \"T-SHIRT-SM\"", + "fieldname": "abbr", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Abbreviation", + "permlevel": 0, + "precision": "", + "reqd": 1, + "search_index": 1, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "icon-edit", + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "modified": "2014-09-26 06:17:47.136386", + "modified_by": "Administrator", + "module": "Stock", + "name": "Item Attribute Value", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/stock/doctype/item_attribute_value/item_attribute_value.py b/erpnext/stock/doctype/item_attribute_value/item_attribute_value.py new file mode 100644 index 0000000000..c3a83b7100 --- /dev/null +++ b/erpnext/stock/doctype/item_attribute_value/item_attribute_value.py @@ -0,0 +1,9 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ItemAttributeValue(Document): + pass diff --git a/erpnext/stock/doctype/item_attribute_value/test_item_attribute_value.py b/erpnext/stock/doctype/item_attribute_value/test_item_attribute_value.py new file mode 100644 index 0000000000..86b8908041 --- /dev/null +++ b/erpnext/stock/doctype/item_attribute_value/test_item_attribute_value.py @@ -0,0 +1,10 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors +# See license.txt + +import frappe +import unittest + +test_records = frappe.get_test_records('Item Attribute Value') + +class TestItemAttributeValue(unittest.TestCase): + pass diff --git a/erpnext/stock/doctype/item_attribute_value/test_records.json b/erpnext/stock/doctype/item_attribute_value/test_records.json new file mode 100644 index 0000000000..dcfdf23fa9 --- /dev/null +++ b/erpnext/stock/doctype/item_attribute_value/test_records.json @@ -0,0 +1,6 @@ +[ + { + "doctype": "Item Attribute Value", + "name": "_Test Item Attribute Value 1" + } +] diff --git a/erpnext/stock/doctype/item_variant/__init__.py b/erpnext/stock/doctype/item_variant/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/stock/doctype/item_variant/item_variant.json b/erpnext/stock/doctype/item_variant/item_variant.json new file mode 100644 index 0000000000..aeb445e2f9 --- /dev/null +++ b/erpnext/stock/doctype/item_variant/item_variant.json @@ -0,0 +1,72 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "", + "creation": "2014-09-26 03:54:04.370259", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Other", + "fields": [ + { + "allow_on_submit": 0, + "fieldname": "item_attribute", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Item Attribute", + "no_copy": 0, + "options": "Item Attribute", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0 + }, + { + "allow_on_submit": 0, + "fieldname": "item_attribute_value", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Item Attribute Value", + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "", + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "modified": "2014-09-26 06:24:14.248364", + "modified_by": "Administrator", + "module": "Stock", + "name": "Item Variant", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/stock/doctype/item_variant/item_variant.py b/erpnext/stock/doctype/item_variant/item_variant.py new file mode 100644 index 0000000000..7b3c15d275 --- /dev/null +++ b/erpnext/stock/doctype/item_variant/item_variant.py @@ -0,0 +1,9 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ItemVariant(Document): + pass