Merge pull request #7840 from rmehta/new-buttons
[enhance] connect new buttons on dashboard to custom make buttons and fix text for payment request
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index e9be38a..cd1d288 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
-__version__ = '7.2.22'
+__version__ = '7.2.23'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index c98e77f..add3e54 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -38,7 +38,7 @@
},
posting_date: function(frm) {
- if(!frm.doc.multi_currency) return;
+ if(!frm.doc.multi_currency || !frm.doc.posting_date) return;
$.each(frm.doc.accounts || [], function(i, row) {
erpnext.journal_entry.set_exchange_rate(frm, row.doctype, row.name);
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 5cf2d92..0f9b5d3 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -832,7 +832,7 @@
# Added posting_date as one of the parameters of get_exchange_rate
@frappe.whitelist()
-def get_exchange_rate(posting_date, account, account_currency=None, company=None,
+def get_exchange_rate(posting_date, account=None, account_currency=None, company=None,
reference_type=None, reference_name=None, debit=None, credit=None, exchange_rate=None):
from erpnext.setup.utils import get_exchange_rate
account_details = frappe.db.get_value("Account", account,
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index 5ff8e3e..7e57dce 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -8,7 +8,7 @@
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
def execute(filters=None):
- period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
+ period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity, filters.company)
asset = get_data(filters.company, "Asset", "Debit", period_list, only_current_fiscal_year=False)
liability = get_data(filters.company, "Liability", "Credit", period_list, only_current_fiscal_year=False)
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.py b/erpnext/accounts/report/cash_flow/cash_flow.py
index 182878a..d4d2252 100644
--- a/erpnext/accounts/report/cash_flow/cash_flow.py
+++ b/erpnext/accounts/report/cash_flow/cash_flow.py
@@ -10,7 +10,7 @@
def execute(filters=None):
- period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
+ period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity, filters.company)
operation_accounts = {
"section_name": "Operations",
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index bc4a220..6955037 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -8,7 +8,7 @@
from frappe.utils import (flt, getdate, get_first_day, get_last_day, date_diff,
add_months, add_days, formatdate, cint)
-def get_period_list(from_fiscal_year, to_fiscal_year, periodicity):
+def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, company):
"""Get a list of dict {"from_date": from_date, "to_date": to_date, "key": key, "label": label}
Periodicity can be (Yearly, Quarterly, Monthly)"""
@@ -50,7 +50,7 @@
# if a fiscal year ends before a 12 month period
period.to_date = year_end_date
- period.to_date_fiscal_year = get_date_fiscal_year(period.to_date)
+ period.to_date_fiscal_year = get_date_fiscal_year(period.to_date, company)
period_list.append(period)
@@ -142,15 +142,16 @@
if entry.posting_date <= period.to_date:
if (accumulated_values or entry.posting_date >= period.from_date) and \
(entry.fiscal_year == period.to_date_fiscal_year or not ignore_accumulated_values_for_fy):
+ frappe.errprint([entry.fiscal_year, period.to_date_fiscal_year])
d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit)
if entry.posting_date < period_list[0].year_start_date:
d["opening_balance"] = d.get("opening_balance", 0.0) + flt(entry.debit) - flt(entry.credit)
-def get_date_fiscal_year(date):
+def get_date_fiscal_year(date, company):
from erpnext.accounts.utils import get_fiscal_year
- return get_fiscal_year(date)[0]
+ return get_fiscal_year(date, company=company)[0]
def accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values):
"""accumulate children's values in parent accounts"""
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
index 747eb43..e12fa06 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
@@ -8,7 +8,7 @@
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
def execute(filters=None):
- period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
+ period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity, filters.company)
income = get_data(filters.company, "Income", "Credit", period_list, filters = filters,
accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py
index 9397ffc..75b7660 100644
--- a/erpnext/config/desktop.py
+++ b/erpnext/config/desktop.py
@@ -231,7 +231,7 @@
{
"module_name": "Assessment",
"color": "#8a70be",
- "icon": "fa fa-file-text-alt",
+ "icon": "fa fa-file-text",
"label": _("Assessment"),
"link": "List/Assessment",
"_doctype": "Assessment",
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 95f6c0b..af364e8 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -28,6 +28,7 @@
boot_session = "erpnext.startup.boot.boot_session"
notification_config = "erpnext.startup.notifications.get_notification_config"
+get_help_messages = "erpnext.utilities.activation.get_help_messages"
on_session_creation = "erpnext.shopping_cart.utils.set_cart_count"
on_logout = "erpnext.shopping_cart.utils.clear_cart_count"
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list_calendar.js b/erpnext/hr/doctype/holiday_list/holiday_list_calendar.js
index 507d070..3cc8dd5 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list_calendar.js
+++ b/erpnext/hr/doctype/holiday_list/holiday_list_calendar.js
@@ -3,8 +3,8 @@
frappe.views.calendar["Holiday List"] = {
field_map: {
- "start": "from_date",
- "end": "to_date",
+ "start": "holiday_date",
+ "end": "holiday_date",
"id": "name",
"title": "description",
"allDay": "allDay"
diff --git a/erpnext/selling/page/sales_analytics/sales_analytics.js b/erpnext/selling/page/sales_analytics/sales_analytics.js
index 2f9b02c..73793d4 100644
--- a/erpnext/selling/page/sales_analytics/sales_analytics.js
+++ b/erpnext/selling/page/sales_analytics/sales_analytics.js
@@ -202,7 +202,9 @@
if (posting_date >= from_date && posting_date <= to_date) {
var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
me.item_by_name['Not Set'];
- item[me.column_map[tl.posting_date].field] += (is_val ? tl.base_net_amount : tl.qty);
+ if(item){
+ item[me.column_map[tl.posting_date].field] += (is_val ? tl.base_net_amount : tl.qty);
+ }
}
}
});
diff --git a/erpnext/utilities/activation.py b/erpnext/utilities/activation.py
index 563f71e..eec3973 100644
--- a/erpnext/utilities/activation.py
+++ b/erpnext/utilities/activation.py
@@ -1,4 +1,6 @@
-import frappe
+import frappe, erpnext
+
+from frappe import _
def get_level():
activation_level = 0
@@ -20,6 +22,9 @@
if frappe.db.count('Employee') > 3:
activation_level += 1
+ if frappe.db.count('Lead') > 3:
+ activation_level += 1
+
if frappe.db.count('Payment Entry') > 2:
activation_level += 1
@@ -29,8 +34,104 @@
if frappe.db.count('User') > 5:
activation_level += 1
+ if frappe.db.count('Student') > 5:
+ activation_level += 1
+
+ if frappe.db.count('Student Batch') > 5:
+ activation_level += 1
+
+ if frappe.db.count('Instructor') > 5:
+ activation_level += 1
+
# recent login
if frappe.db.sql('select name from tabUser where last_login > date_sub(now(), interval 2 day) limit 1'):
activation_level += 1
- return activation_level
\ No newline at end of file
+ return activation_level
+
+def get_help_messages():
+ '''Returns help messages to be shown on Desktop'''
+ # if get_level() > 6:
+ # return []
+
+ messages = []
+
+ domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
+
+ if domain in ('Manufacturing', 'Retail', 'Services', 'Distribution'):
+ count = frappe.db.count('Lead')
+ if count < 3:
+ messages.append(dict(
+ title=_('Create Leads'),
+ description=_('Create Leads'),
+ action=_('Leads help you get business, add all your contacts and more as your leads'),
+ route='List/Lead',
+ count=count
+ ))
+
+ count = frappe.db.count('Quotation')
+ if count < 3:
+ messages.append(dict(
+ title=_('Create customer quotes'),
+ description=_('Quotations are proposals, bids you have sent to your customers'),
+ action=_('Make Quotation'),
+ route='List/Quotation'
+ ))
+
+ count = frappe.db.count('Sales Order')
+ if count < 3:
+ messages.append(dict(
+ title=_('Manage your orders'),
+ description=_('Make Sales Orders to help you plan your work and deliver on-time'),
+ action=_('Make Sales Order'),
+ route='List/Sales Order'
+ ))
+
+ count = frappe.db.count('Purchase Order')
+ if count < 3:
+ messages.append(dict(
+ title=_('Create Purchase Orders'),
+ description=_('Purchase orders help you plan and follow up on your purchases'),
+ action=_('Make Purchase Order'),
+ route='List/Purchase Order'
+ ))
+
+ count = frappe.db.count('User')
+ if count < 3:
+ messages.append(dict(
+ title=_('Create Users'),
+ description=_('Add the rest of your organization as your users. You can also add invite Customers to your portal by adding them from Contacts'),
+ action=_('Make User'),
+ route='List/User'
+ ))
+
+ elif domain == 'Education':
+ count = frappe.db.count('Student')
+ if count < 5:
+ messages.append(dict(
+ title=_('Add Students'),
+ description=_('Students are at the heart of the system, add all your students'),
+ action=_('Make Student'),
+ route='List/Student'
+ ))
+
+ count = frappe.db.count('Student Batch')
+ if count < 3:
+ messages.append(dict(
+ title=_('Group your students in batches'),
+ description=_('Student Batches help you track attendance, assessments and fees for students'),
+ action=_('Make Student Batch'),
+ route='List/Student Batch'
+ ))
+
+ # anyways
+ count = frappe.db.count('Employee')
+ if count < 3:
+ messages.append(dict(
+ title=_('Create Employee Records'),
+ description=_('Create Employee records to manage leaves, expense claims and payroll'),
+ action=_('Make Employee'),
+ route='List/Employee'
+ ))
+
+ return messages
\ No newline at end of file