Merge branch 'develop' into fix_indentation

This commit is contained in:
sahil28297 2019-09-17 17:08:16 +05:30 committed by GitHub
commit c1930fa64d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 593 additions and 1607 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
import frappe
import requests
from frappe import _
# api/method/erpnext.erpnext_integrations.exotel_integration.handle_incoming_call
# api/method/erpnext.erpnext_integrations.exotel_integration.handle_end_call
@ -7,6 +8,7 @@ import requests
@frappe.whitelist(allow_guest=True)
def handle_incoming_call(**kwargs):
try:
exotel_settings = get_exotel_settings()
if not exotel_settings.enabled: return
@ -20,6 +22,10 @@ def handle_incoming_call(**kwargs):
create_call_log(call_payload)
else:
update_call_log(call_payload, call_log=call_log)
except Exception as e:
frappe.db.rollback()
frappe.log_error(title=_('Error in Exotel incoming call'))
frappe.db.commit()
@frappe.whitelist(allow_guest=True)
def handle_end_call(**kwargs):

View File

@ -635,3 +635,4 @@ erpnext.patches.v12_0.remove_bank_remittance_custom_fields
erpnext.patches.v12_0.generate_leave_ledger_entries
erpnext.patches.v12_0.move_credit_limit_to_customer_credit_limit
erpnext.patches.v12_0.add_variant_of_in_item_attribute_table
erpnext.patches.v12_0.create_default_energy_point_rules

View File

@ -0,0 +1,6 @@
import frappe
from erpnext.setup.install import create_default_energy_point_rules
def execute():
frappe.reload_doc('social', 'doctype', 'energy_point_rule')
create_default_energy_point_rules()

View File

@ -4,6 +4,7 @@
"creation": "2013-01-29 19:25:50",
"doctype": "DocType",
"document_type": "Setup",
"engine": "InnoDB",
"field_order": [
"subject",
"project",
@ -14,6 +15,7 @@
"status",
"priority",
"task_weight",
"completed_by",
"color",
"parent_task",
"sb_timeline",
@ -53,10 +55,10 @@
"fieldname": "subject",
"fieldtype": "Data",
"in_global_search": 1,
"in_standard_filter": 1,
"label": "Subject",
"reqd": 1,
"search_index": 1,
"in_standard_filter": 1
"search_index": 1
},
{
"bold": 1,
@ -183,6 +185,7 @@
"label": "% Progress"
},
{
"default": "0",
"fieldname": "is_milestone",
"fieldtype": "Check",
"in_list_view": 1,
@ -348,12 +351,18 @@
"ignore_user_permissions": 1,
"label": "Old Parent",
"read_only": 1
},
{
"fieldname": "completed_by",
"fieldtype": "Link",
"label": "Completed By",
"options": "User"
}
],
"icon": "fa fa-check",
"idx": 1,
"max_attachments": 5,
"modified": "2019-06-19 09:51:15.599416",
"modified": "2019-09-10 13:46:24.631754",
"modified_by": "Administrator",
"module": "Projects",
"name": "Task",
@ -374,8 +383,9 @@
"search_fields": "subject",
"show_name_in_global_search": 1,
"show_preview_popup": 1,
"sort_field": "modified",
"sort_order": "DESC",
"timeline_field": "project",
"title_field": "subject",
"track_seen": 1
}
}

View File

@ -0,0 +1,58 @@
from __future__ import unicode_literals
from frappe import _
doctype_rule_map = {
'Item': {
'points': 5,
'for_doc_event': 'New'
},
'Customer': {
'points': 5,
'for_doc_event': 'New'
},
'Supplier': {
'points': 5,
'for_doc_event': 'New'
},
'Lead': {
'points': 2,
'for_doc_event': 'New'
},
'Opportunity': {
'points': 10,
'for_doc_event': 'Custom',
'condition': 'doc.status=="Converted"',
'rule_name': _('On Converting Opportunity'),
'user_field': 'converted_by'
},
'Sales Order': {
'points': 10,
'for_doc_event': 'Submit',
'rule_name': _('On Sales Order Submission'),
'user_field': 'modified_by'
},
'Purchase Order': {
'points': 10,
'for_doc_event': 'Submit',
'rule_name': _('On Purchase Order Submission'),
'user_field': 'modified_by'
},
'Task': {
'points': 5,
'condition': 'doc.status == "Completed"',
'rule_name': _('On Task Completion'),
'user_field': 'completed_by'
}
}
def get_default_energy_point_rules():
return [{
'doctype': 'Energy Point Rule',
'reference_doctype': doctype,
'for_doc_event': rule.get('for_doc_event') or 'Custom',
'condition': rule.get('condition'),
'rule_name': rule.get('rule_name') or _('On {0} Creation').format(doctype),
'points': rule.get('points'),
'user_field': rule.get('user_field') or 'owner'
} for doctype, rule in doctype_rule_map.items()]

View File

@ -11,10 +11,10 @@ doctype_list = [
]
def get_message(doctype):
return _("{0} has been submitted successfully".format(_(doctype)))
return _("{0} has been submitted successfully").format(_(doctype))
def get_first_success_message(doctype):
return _("{0} has been submitted successfully".format(_(doctype)))
return get_message(doctype)
def get_default_success_action():
return [{

View File

@ -9,6 +9,7 @@ from .default_success_action import get_default_success_action
from frappe import _
from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
from erpnext.setup.default_energy_point_rules import get_default_energy_point_rules
default_mail_footer = """<div style="padding: 7px; text-align: right; color: #888"><small>Sent via
<a style="color: #888" href="http://erpnext.org">ERPNext</a></div>"""
@ -22,6 +23,7 @@ def after_install():
add_all_roles_to("Administrator")
create_default_cash_flow_mapper_templates()
create_default_success_action()
create_default_energy_point_rules()
add_company_to_session_defaults()
frappe.db.commit()
@ -86,6 +88,17 @@ def create_default_success_action():
doc = frappe.get_doc(success_action)
doc.insert(ignore_permissions=True)
def create_default_energy_point_rules():
for rule in get_default_energy_point_rules():
# check if any rule for ref. doctype exists
rule_exists = frappe.db.exists('Energy Point Rule', {
'reference_doctype': rule.get('reference_doctype')
})
if rule_exists: continue
doc = frappe.get_doc(rule)
doc.insert(ignore_permissions=True)
def add_company_to_session_defaults():
settings = frappe.get_single("Session Default Settings")
settings.append("session_defaults", {