Progress fixes (#10710)
* [progress] sales target slide * [fix] rerun patch for sales target slide
This commit is contained in:
parent
c050c6945c
commit
242218d2b7
@ -436,7 +436,7 @@ erpnext.patches.v8_7.add_more_gst_fields
|
|||||||
erpnext.patches.v8_7.fix_purchase_receipt_status
|
erpnext.patches.v8_7.fix_purchase_receipt_status
|
||||||
erpnext.patches.v8_6.rename_bom_update_tool
|
erpnext.patches.v8_6.rename_bom_update_tool
|
||||||
erpnext.patches.v8_7.set_offline_in_pos_settings #11-09-17
|
erpnext.patches.v8_7.set_offline_in_pos_settings #11-09-17
|
||||||
erpnext.patches.v8_9.add_setup_progress_actions
|
erpnext.patches.v8_9.add_setup_progress_actions #08-09-2017
|
||||||
erpnext.patches.v8_9.rename_company_sales_target_field
|
erpnext.patches.v8_9.rename_company_sales_target_field
|
||||||
erpnext.patches.v8_8.set_bom_rate_as_per_uom
|
erpnext.patches.v8_8.set_bom_rate_as_per_uom
|
||||||
erpnext.patches.v8_7.make_subscription_from_recurring_data
|
erpnext.patches.v8_7.make_subscription_from_recurring_data
|
@ -11,6 +11,10 @@ def execute():
|
|||||||
actions = [
|
actions = [
|
||||||
{"action_name": _("Add Company"), "action_doctype": "Company", "min_doc_count": 1, "is_completed": 1,
|
{"action_name": _("Add Company"), "action_doctype": "Company", "min_doc_count": 1, "is_completed": 1,
|
||||||
"domains": '[]' },
|
"domains": '[]' },
|
||||||
|
{"action_name": _("Set Sales Target"), "action_doctype": "Company", "min_doc_count": 99,
|
||||||
|
"action_document": frappe.defaults.get_defaults().get("company") or '',
|
||||||
|
"action_field": "monthly_sales_target", "is_completed": 0,
|
||||||
|
"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
|
||||||
{"action_name": _("Add Customers"), "action_doctype": "Customer", "min_doc_count": 1, "is_completed": 0,
|
{"action_name": _("Add Customers"), "action_doctype": "Customer", "min_doc_count": 1, "is_completed": 0,
|
||||||
"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
|
"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
|
||||||
{"action_name": _("Add Suppliers"), "action_doctype": "Supplier", "min_doc_count": 1, "is_completed": 0,
|
{"action_name": _("Add Suppliers"), "action_doctype": "Supplier", "min_doc_count": 1, "is_completed": 0,
|
||||||
@ -30,6 +34,7 @@ def execute():
|
|||||||
]
|
]
|
||||||
|
|
||||||
setup_progress = frappe.get_doc("Setup Progress", "Setup Progress")
|
setup_progress = frappe.get_doc("Setup Progress", "Setup Progress")
|
||||||
|
setup_progress.actions = []
|
||||||
for action in actions:
|
for action in actions:
|
||||||
setup_progress.append("actions", action)
|
setup_progress.append("actions", action)
|
||||||
|
|
||||||
|
@ -24,10 +24,21 @@ def update_action_completed_state(action_name):
|
|||||||
if d.action_name == action_name][0]
|
if d.action_name == action_name][0]
|
||||||
update_action(action_table_doc)
|
update_action(action_table_doc)
|
||||||
|
|
||||||
def update_action(action_table_doc):
|
def update_action(doc):
|
||||||
if not action_table_doc.is_completed and frappe.db.count(action_table_doc.action_doctype) >= action_table_doc.min_doc_count:
|
doctype = doc.action_doctype
|
||||||
action_table_doc.is_completed = 1
|
docname = doc.action_document
|
||||||
action_table_doc.save()
|
field = doc.action_field
|
||||||
|
|
||||||
|
if not doc.is_completed:
|
||||||
|
if doc.min_doc_count:
|
||||||
|
if frappe.db.count(doctype) >= doc.min_doc_count:
|
||||||
|
doc.is_completed = 1
|
||||||
|
doc.save()
|
||||||
|
if docname and field:
|
||||||
|
d = frappe.get_doc(doctype, docname)
|
||||||
|
if d.get(field):
|
||||||
|
doc.is_completed = 1
|
||||||
|
doc.save()
|
||||||
|
|
||||||
def update_domain_actions(domain):
|
def update_domain_actions(domain):
|
||||||
for d in get_setup_progress().actions:
|
for d in get_setup_progress().actions:
|
||||||
|
@ -73,6 +73,67 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "action_document",
|
||||||
|
"fieldtype": "Dynamic Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Action Document",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"options": "action_doctype",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "action_field",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Action Field",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -174,7 +235,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-08-28 17:44:58.008526",
|
"modified": "2017-09-01 14:34:59.685730",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"name": "Setup Progress Action",
|
"name": "Setup Progress Action",
|
||||||
|
@ -25,6 +25,10 @@ def install(country=None):
|
|||||||
{'doctype': "Setup Progress", "actions": [
|
{'doctype': "Setup Progress", "actions": [
|
||||||
{"action_name": _("Add Company"), "action_doctype": "Company", "min_doc_count": 1, "is_completed": 1,
|
{"action_name": _("Add Company"), "action_doctype": "Company", "min_doc_count": 1, "is_completed": 1,
|
||||||
"domains": '[]' },
|
"domains": '[]' },
|
||||||
|
{"action_name": _("Set Sales Target"), "action_doctype": "Company", "min_doc_count": 99,
|
||||||
|
"action_document": frappe.defaults.get_defaults().get("company") or '',
|
||||||
|
"action_field": "monthly_sales_target", "is_completed": 0,
|
||||||
|
"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
|
||||||
{"action_name": _("Add Customers"), "action_doctype": "Customer", "min_doc_count": 1, "is_completed": 0,
|
{"action_name": _("Add Customers"), "action_doctype": "Customer", "min_doc_count": 1, "is_completed": 0,
|
||||||
"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
|
"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
|
||||||
{"action_name": _("Add Suppliers"), "action_doctype": "Supplier", "min_doc_count": 1, "is_completed": 0,
|
{"action_name": _("Add Suppliers"), "action_doctype": "Supplier", "min_doc_count": 1, "is_completed": 0,
|
||||||
|
@ -9,6 +9,14 @@ def get_slide_settings():
|
|||||||
defaults = frappe.defaults.get_defaults()
|
defaults = frappe.defaults.get_defaults()
|
||||||
domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
|
domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
|
||||||
company = defaults.get("company") or ''
|
company = defaults.get("company") or ''
|
||||||
|
currency = defaults.get("currency") or ''
|
||||||
|
|
||||||
|
doc = frappe.get_doc("Setup Progress")
|
||||||
|
item = [d for d in doc.get("actions") if d.action_name == "Set Sales Target"][0]
|
||||||
|
item.action_document = company
|
||||||
|
item.save()
|
||||||
|
doc.save()
|
||||||
|
|
||||||
# Initial state of slides
|
# Initial state of slides
|
||||||
return [
|
return [
|
||||||
frappe._dict(
|
frappe._dict(
|
||||||
@ -29,12 +37,29 @@ def get_slide_settings():
|
|||||||
"video_id": "U5wPIvEn-0c"
|
"video_id": "U5wPIvEn-0c"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
)
|
),
|
||||||
,
|
frappe._dict(
|
||||||
|
action_name='Set Sales Target',
|
||||||
|
domains=('Manufacturing', 'Services', 'Retail', 'Distribution'),
|
||||||
|
title=_("Set a Target"),
|
||||||
|
help=_("Set a sales goal you'd like to achieve for your company."),
|
||||||
|
fields=[
|
||||||
|
{"fieldtype":"Currency", "fieldname":"monthly_sales_target",
|
||||||
|
"label":_("Monthly Sales Target (" + currency + ")")},
|
||||||
|
],
|
||||||
|
submit_method="erpnext.utilities.user_progress_utils.set_sales_target",
|
||||||
|
done_state_title=_("Go to " + company),
|
||||||
|
done_state_title_route=["Form", "Company", company],
|
||||||
|
help_links=[
|
||||||
|
{
|
||||||
|
"label": _('Learn More'),
|
||||||
|
"url": ["https://erpnext.org/docs/user/manual/en/setting-up/setting-company-sales-goal"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
),
|
||||||
frappe._dict(
|
frappe._dict(
|
||||||
action_name='Add Customers',
|
action_name='Add Customers',
|
||||||
domains=('Manufacturing', 'Services', 'Retail', 'Distribution'),
|
domains=('Manufacturing', 'Services', 'Retail', 'Distribution'),
|
||||||
icon="fa fa-group",
|
|
||||||
title=_("Add Customers"),
|
title=_("Add Customers"),
|
||||||
help=_("List a few of your customers. They could be organizations or individuals."),
|
help=_("List a few of your customers. They could be organizations or individuals."),
|
||||||
fields=[
|
fields=[
|
||||||
|
@ -8,6 +8,12 @@ from frappe import _
|
|||||||
from frappe.utils import flt
|
from frappe.utils import flt
|
||||||
from erpnext.setup.doctype.setup_progress.setup_progress import update_domain_actions, get_domain_actions_state
|
from erpnext.setup.doctype.setup_progress.setup_progress import update_domain_actions, get_domain_actions_state
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def set_sales_target(args_data):
|
||||||
|
args = json.loads(args_data)
|
||||||
|
defaults = frappe.defaults.get_defaults()
|
||||||
|
frappe.db.set_value("Company", defaults.get("company"), "monthly_sales_target", args.get('monthly_sales_target'))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def create_customers(args_data):
|
def create_customers(args_data):
|
||||||
args = json.loads(args_data)
|
args = json.loads(args_data)
|
||||||
|
Loading…
Reference in New Issue
Block a user