From 8a6febbaa5c8dba6bba5693c5d17fa8cc71028b5 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 6 May 2014 19:44:22 +0530 Subject: [PATCH] Autocreate naming series options based on Fiscal Year --- .../setup/page/setup_wizard/setup_wizard.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.py b/erpnext/setup/page/setup_wizard/setup_wizard.py index 42c85d7101..e64f5a00b9 100644 --- a/erpnext/setup/page/setup_wizard/setup_wizard.py +++ b/erpnext/setup/page/setup_wizard/setup_wizard.py @@ -36,6 +36,9 @@ def setup_account(args=None): create_fiscal_year_and_company(args) frappe.local.message_log = [] + create_naming_series(args) + frappe.local.message_log = [] + set_defaults(args) frappe.local.message_log = [] @@ -127,6 +130,21 @@ def create_fiscal_year_and_company(args): args["curr_fiscal_year"] = curr_fiscal_year +def create_naming_series(args): + for doctype in ("Production Order", "Supplier Quotation", "Purchase Order", + "Purchase Invoice", "Purchase Receipt", "Opportunity", "Quotation", + "Sales Order", "Sales Invoice", "Delivery Note", "Installation Note", + "Customer Issue", "Journal Voucher"): + + naming_series = frappe.get_doc("Naming Series") + naming_series.select_doc_for_series = doctype + + # append fiscal year name to existing series + existing_series = frappe.get_meta(doctype).get_field("naming_series").options.split("\n") + naming_series.set_options = "\n".join(existing_series + ["{}{}-".format(existing_series[0], args["curr_fiscal_year"])]) + + naming_series.update_series() + def create_price_lists(args): for pl_type in ["Selling", "Buying"]: frappe.get_doc({