From 8d9edbf133004cb0402200b84dabfac972c08c6c Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Tue, 28 Nov 2017 16:09:58 +0530 Subject: [PATCH] Letterhead in user progress (#11679) * added letter-head to user progress slides * added letterhead action to patch * improvised * added date in patches.txt --- erpnext/patches.txt | 2 +- .../patches/v8_9/add_setup_progress_actions.py | 2 ++ erpnext/setup/setup_wizard/install_fixtures.py | 2 ++ erpnext/utilities/user_progress.py | 18 ++++++++++++++++++ erpnext/utilities/user_progress_utils.py | 15 +++++++++++++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index fcf5cfcc92..2c28b9281f 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -439,7 +439,7 @@ erpnext.patches.v8_7.add_more_gst_fields #21-09-2017 erpnext.patches.v8_7.fix_purchase_receipt_status erpnext.patches.v8_6.rename_bom_update_tool erpnext.patches.v8_7.set_offline_in_pos_settings #11-09-17 -erpnext.patches.v8_9.add_setup_progress_actions #08-09-2017 #26-09-2017 +erpnext.patches.v8_9.add_setup_progress_actions #08-09-2017 #26-09-2017 #22-11-2017 erpnext.patches.v8_9.rename_company_sales_target_field erpnext.patches.v8_8.set_bom_rate_as_per_uom erpnext.patches.v8_8.add_new_fields_in_accounts_settings diff --git a/erpnext/patches/v8_9/add_setup_progress_actions.py b/erpnext/patches/v8_9/add_setup_progress_actions.py index dbd0face7b..fe123111bc 100644 --- a/erpnext/patches/v8_9/add_setup_progress_actions.py +++ b/erpnext/patches/v8_9/add_setup_progress_actions.py @@ -30,6 +30,8 @@ def execute(): {"action_name": "Add Rooms", "action_doctype": "Room", "min_doc_count": 1, "is_completed": 0, "domains": '["Education"]' }, {"action_name": "Add Users", "action_doctype": "User", "min_doc_count": 4, "is_completed": 0, + "domains": '[]' }, + {"action_name": "Add Letterhead", "action_doctype": "Letter Head", "min_doc_count": 1, "is_completed": 0, "domains": '[]' } ] diff --git a/erpnext/setup/setup_wizard/install_fixtures.py b/erpnext/setup/setup_wizard/install_fixtures.py index 95c562ad06..ed89568947 100644 --- a/erpnext/setup/setup_wizard/install_fixtures.py +++ b/erpnext/setup/setup_wizard/install_fixtures.py @@ -44,6 +44,8 @@ def install(country=None): {"action_name": "Add Rooms", "action_doctype": "Room", "min_doc_count": 1, "is_completed": 0, "domains": '["Education"]' }, {"action_name": "Add Users", "action_doctype": "User", "min_doc_count": 4, "is_completed": 0, + "domains": '[]' }, + {"action_name": "Add Letterhead", "action_doctype": "Letter Head", "min_doc_count": 1, "is_completed": 0, "domains": '[]' } ]}, diff --git a/erpnext/utilities/user_progress.py b/erpnext/utilities/user_progress.py index 685624e030..e84377e1e8 100644 --- a/erpnext/utilities/user_progress.py +++ b/erpnext/utilities/user_progress.py @@ -81,6 +81,24 @@ def get_slide_settings(): } ] ), + + frappe._dict( + action_name='Add Letterhead', + domains=('Manufacturing', 'Services', 'Retail', 'Distribution', 'Education'), + title=_("Add Letterhead"), + help=_("Upload your letter head (Keep it web friendly as 900px by 100px)"), + fields=[ + {"fieldtype":"Attach Image", "fieldname":"letterhead", + "is_private": 0, + "align": "center" + }, + ], + mandatory_entry=1, + submit_method="erpnext.utilities.user_progress_utils.create_letterhead", + done_state_title=_("Go to Letterheads"), + done_state_title_route=["List", "Letter Head"] + ), + frappe._dict( action_name='Add Suppliers', domains=('Manufacturing', 'Services', 'Retail', 'Distribution'), diff --git a/erpnext/utilities/user_progress_utils.py b/erpnext/utilities/user_progress_utils.py index 1af5364d10..08dd7efe19 100644 --- a/erpnext/utilities/user_progress_utils.py +++ b/erpnext/utilities/user_progress_utils.py @@ -37,6 +37,21 @@ def create_customers(args_data): except frappe.NameError: pass +@frappe.whitelist() +def create_letterhead(args_data): + args = json.loads(args_data) + letterhead = args.get("letterhead") + if letterhead: + try: + frappe.get_doc({ + "doctype":"Letter Head", + "content":"""

""".format(letterhead), + "letter_head_name": _("Standard"), + "is_default": 1 + }).insert() + except frappe.NameError: + pass + @frappe.whitelist() def create_suppliers(args_data): args = json.loads(args_data)