Letterhead in user progress (#11679)
* added letter-head to user progress slides
* added letterhead action to patch
* improvised
* added date in patches.txt
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index fcf5cfc..2c28b92 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -439,7 +439,7 @@
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 dbd0fac..fe12311 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 @@
{"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 95c562a..ed89568 100644
--- a/erpnext/setup/setup_wizard/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/install_fixtures.py
@@ -44,6 +44,8 @@
{"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 685624e..e84377e 100644
--- a/erpnext/utilities/user_progress.py
+++ b/erpnext/utilities/user_progress.py
@@ -81,6 +81,24 @@
}
]
),
+
+ 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 1af5364..08dd7ef 100644
--- a/erpnext/utilities/user_progress_utils.py
+++ b/erpnext/utilities/user_progress_utils.py
@@ -38,6 +38,21 @@
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":"""<div><img src="{0}" style='max-width: 100%%;'><br></div>""".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)
defaults = frappe.defaults.get_defaults()