diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py index 3fabae0e07..96ddc634f8 100644 --- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py +++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py @@ -11,7 +11,5 @@ class ManufacturingSettings(Document): pass def get_mins_between_operations(): - if not hasattr(frappe.local, "_mins_between_operations"): - frappe.local._mins_between_operations = cint(frappe.db.get_single_value("Manufacturing Settings", - "mins_between_operations")) or 10 - return relativedelta(minutes=frappe.local._mins_between_operations) + return relativedelta(minutes=cint(frappe.db.get_single_value("Manufacturing Settings", + "mins_between_operations"))) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 0941b4fc1f..62aa2b4366 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -202,3 +202,4 @@ execute:frappe.delete_doc_if_exists("Print Format", "Credit Note - Negative Invo # V6.0 erpnext.patches.v6_0.set_default_title # 2015-09-03 erpnext.patches.v6_0.default_activity_rate +execute:frappe.db.set_value("Stock Settings", None, "automatically_set_serial_nos_based_on_fifo", 1) diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.py b/erpnext/setup/page/setup_wizard/setup_wizard.py index 869b7e5a49..f3f236d035 100644 --- a/erpnext/setup/page/setup_wizard/setup_wizard.py +++ b/erpnext/setup/page/setup_wizard/setup_wizard.py @@ -223,6 +223,7 @@ def set_defaults(args): stock_settings.stock_uom = _("Nos") stock_settings.auto_indent = 1 stock_settings.auto_insert_price_list_rate_if_missing = 1 + stock_settings.automatically_set_serial_nos_based_on_fifo = 1 stock_settings.save() selling_settings = frappe.get_doc("Selling Settings") diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json index c476199b84..2d6e2b4080 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.json +++ b/erpnext/stock/doctype/stock_settings/stock_settings.json @@ -76,28 +76,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "auto_insert_price_list_rate_if_missing", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Auto insert Price List rate if missing", - "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, @@ -162,6 +140,49 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "section_break_7", + "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": "auto_insert_price_list_rate_if_missing", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Auto insert Price List rate if missing", + "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, @@ -171,7 +192,7 @@ "hidden": 0, "ignore_user_permissions": 0, "in_filter": 0, - "in_list_view": 1, + "in_list_view": 0, "label": "Allow Negative Stock", "no_copy": 0, "permlevel": 0, @@ -183,6 +204,50 @@ "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, + "default": "1", + "fieldname": "automatically_set_serial_nos_based_on_fifo", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Automatically Set Serial Nos based on FIFO", + "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, @@ -341,7 +406,7 @@ "is_submittable": 0, "issingle": 1, "istable": 0, - "modified": "2015-08-12 08:51:24.798096", + "modified": "2015-09-03 00:42:16.833424", "modified_by": "Administrator", "module": "Stock", "name": "Stock Settings", diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 40c2729028..3ad03f1121 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -212,7 +212,7 @@ def get_price_list_rate(args, item_doc, out): price_list_rate = get_price_list_rate_for(args, item_doc.name) if not price_list_rate and item_doc.variant_of: price_list_rate = get_price_list_rate_for(args, item_doc.variant_of) - + if not price_list_rate: if args.price_list and args.rate: insert_item_price(args) @@ -231,10 +231,10 @@ def insert_item_price(args): if frappe.db.get_value("Price List", args.price_list, "currency") == args.currency \ and cint(frappe.db.get_single_value("Stock Settings", "auto_insert_price_list_rate_if_missing")): if frappe.has_permission("Item Price", "write"): - + price_list_rate = args.rate / args.conversion_factor \ if args.get("conversion_factor") else args.rate - + item_price = frappe.get_doc({ "doctype": "Item Price", "price_list": args.price_list, @@ -322,13 +322,14 @@ def get_pos_profile(company): def get_serial_nos_by_fifo(args, item_doc): - return "\n".join(frappe.db.sql_list("""select name from `tabSerial No` - where item_code=%(item_code)s and warehouse=%(warehouse)s and status='Available' - order by timestamp(purchase_date, purchase_time) asc limit %(qty)s""", { - "item_code": args.item_code, - "warehouse": args.warehouse, - "qty": abs(cint(args.qty)) - })) + if frappe.db.get_single_value("Stock Settings", "automatically_set_serial_nos_based_on_fifo"): + return "\n".join(frappe.db.sql_list("""select name from `tabSerial No` + where item_code=%(item_code)s and warehouse=%(warehouse)s and status='Available' + order by timestamp(purchase_date, purchase_time) asc limit %(qty)s""", { + "item_code": args.item_code, + "warehouse": args.warehouse, + "qty": abs(cint(args.qty)) + })) def get_actual_batch_qty(batch_no,warehouse,item_code): actual_batch_qty = 0