diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index fde016527c..680e7ccb3b 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -327,6 +327,32 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "depends_on": "eval:(doc.__islocal && doc.is_stock_item && doc.opening_stock)", + "fieldname": "valuation_rate", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Valuation Rate", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 1, @@ -338,7 +364,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "label": "Standard Rate", + "label": "Standard Selling Rate", "length": 0, "no_copy": 0, "permlevel": 0, @@ -352,6 +378,58 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "is_fixed_asset", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 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, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 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_list_view": 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, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -2229,7 +2307,7 @@ "issingle": 0, "istable": 0, "max_attachments": 1, - "modified": "2016-06-27 17:41:38.336900", + "modified": "2016-07-06 16:00:45.561339", "modified_by": "Administrator", "module": "Stock", "name": "Item", diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 2f346bc66e..eee88bc517 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -118,6 +118,9 @@ class Item(WebsiteGenerator): def set_opening_stock(self): '''set opening stock''' + if not self.valuation_rate: + frappe.throw(_("Valuation Rate is mandatory if Opening Stock entered")) + from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry # default warehouse, or Stores @@ -125,9 +128,8 @@ class Item(WebsiteGenerator): or frappe.db.get_value('Warehouse', {'warehouse_name': _('Stores')})) if default_warehouse: - stock_entry = make_stock_entry(item_code=self.name, - target=default_warehouse, - qty=self.opening_stock) + stock_entry = make_stock_entry(item_code=self.name, target=default_warehouse, + qty=self.opening_stock, rate=self.valuation_rate) stock_entry.add_comment("Comment", _("Opening Stock"))