diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 734c8e8ca2b..44ba88adfa6 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
-__version__ = '8.0.17'
+__version__ = '8.0.18'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/bank_guarantee/__init__.py b/erpnext/accounts/doctype/bank_guarantee/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
new file mode 100644
index 00000000000..499320223a7
--- /dev/null
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Bank Guarantee', {
+ refresh: function(frm) {
+ cur_frm.set_query("account", function() {
+ return {
+ "filters": {
+ "account_type": "Bank",
+ "is_group": 0
+ }
+ };
+ });
+ cur_frm.set_query("project", function() {
+ return {
+ "filters": {
+ "customer": cur_frm.doc.customer
+ }
+ };
+ });
+ },
+ start_date: function(frm) {
+ end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1);
+ cur_frm.set_value("end_date", end_date);
+ },
+ validity: function(frm) {
+ end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1);
+ cur_frm.set_value("end_date", end_date);
+ }
+});
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json
new file mode 100644
index 00000000000..807c544d873
--- /dev/null
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json
@@ -0,0 +1,448 @@
+{
+ "allow_copy": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "autoname": "BG-.#####",
+ "beta": 0,
+ "creation": "2016-12-17 10:43:35.731631",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Document",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "customer",
+ "fieldtype": "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": "Customer",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Customer",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 1,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "project",
+ "fieldtype": "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": "Project",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Project",
+ "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": "account",
+ "fieldtype": "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": "Bank Account",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Account",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Amount",
+ "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": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_6",
+ "fieldtype": "Column Break",
+ "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,
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "start_date",
+ "fieldtype": "Date",
+ "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": "Start Date",
+ "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": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "description": "",
+ "fieldname": "validity",
+ "fieldtype": "Int",
+ "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": "Validity in Days",
+ "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": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "end_date",
+ "fieldtype": "Date",
+ "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": "End Date",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "bank_guarantee_number",
+ "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": "Bank Guarantee Number",
+ "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": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 1
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 1,
+ "columns": 0,
+ "fieldname": "section_break_10",
+ "fieldtype": "Section Break",
+ "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": "More Information",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "more_information",
+ "fieldtype": "Text Editor",
+ "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": "Notes",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "amended_from",
+ "fieldtype": "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": "Amended From",
+ "length": 0,
+ "no_copy": 1,
+ "options": "Bank Guarantee",
+ "permlevel": 0,
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ }
+ ],
+ "has_web_view": 0,
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "is_submittable": 1,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "modified": "2017-04-25 13:31:49.627831",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Bank Guarantee",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
+ "cancel": 0,
+ "create": 1,
+ "delete": 0,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts User",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 1,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
+ "cancel": 1,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts Manager",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 1,
+ "write": 1
+ }
+ ],
+ "quick_entry": 1,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "search_fields": "customer",
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "title_field": "customer",
+ "track_changes": 0,
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
new file mode 100644
index 00000000000..71647b9e263
--- /dev/null
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class BankGuarantee(Document):
+ pass
diff --git a/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
new file mode 100644
index 00000000000..0e56991856f
--- /dev/null
+++ b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+# test_records = frappe.get_test_records('Bank Guarantee')
+
+class TestBankGuarantee(unittest.TestCase):
+ pass
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.js b/erpnext/accounts/report/balance_sheet/balance_sheet.js
index a20d47c7849..9cd92d43674 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.js
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.js
@@ -3,6 +3,12 @@
frappe.require("assets/erpnext/js/financial_statements.js", function() {
frappe.query_reports["Balance Sheet"] = erpnext.financial_statements;
+
+ frappe.query_reports["Balance Sheet"]["filters"].push({
+ "fieldname": "accumulated_values",
+ "label": __("Accumulated Values"),
+ "fieldtype": "Check"
+ });
});
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index 4325afcd291..9095d8619b6 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -8,11 +8,23 @@ from frappe.utils import flt, cint
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, filters.company)
+ period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
+ filters.periodicity, filters.accumulated_values, 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)
- equity = get_data(filters.company, "Equity", "Credit", period_list, only_current_fiscal_year=False)
+ asset = get_data(filters.company, "Asset", "Debit", period_list,
+ only_current_fiscal_year=False, filters=filters,
+ accumulated_values=filters.accumulated_values,
+ ignore_closing_entries=True, ignore_accumulated_values_for_fy=True)
+
+ liability = get_data(filters.company, "Liability", "Credit", period_list,
+ only_current_fiscal_year=False, filters=filters,
+ accumulated_values=filters.accumulated_values,
+ ignore_closing_entries=True, ignore_accumulated_values_for_fy=True)
+
+ equity = get_data(filters.company, "Equity", "Credit", period_list,
+ only_current_fiscal_year=False, filters=filters,
+ accumulated_values=filters.accumulated_values,
+ ignore_closing_entries=True, ignore_accumulated_values_for_fy=True)
provisional_profit_loss, total_credit = get_provisional_profit_loss(asset, liability, equity,
period_list, filters.company)
@@ -43,9 +55,9 @@ def execute(filters=None):
if total_credit:
data.append(total_credit)
- columns = get_columns(filters.periodicity, period_list, company=filters.company)
+ columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, company=filters.company)
- chart = get_chart_data(columns, asset, liability, equity)
+ chart = get_chart_data(filters, columns, asset, liability, equity)
return columns, data, message, chart
@@ -107,7 +119,7 @@ def check_opening_balance(asset, liability, equity):
return _("Previous Financial Year is not closed"),opening_balance
return None,None
-def get_chart_data(columns, asset, liability, equity):
+def get_chart_data(filters, columns, asset, liability, equity):
x_intervals = ['x'] + [d.get("label") for d in columns[2:]]
asset_data, liability_data, equity_data = [], [], []
@@ -128,9 +140,14 @@ def get_chart_data(columns, asset, liability, equity):
if equity_data:
columns.append(["Equity"] + equity_data)
- return {
+ chart = {
"data": {
'x': 'x',
'columns': columns
}
}
+
+ if not filters.accumulated_values:
+ chart["chart_type"] = "bar"
+
+ return chart
\ No newline at end of file
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.py b/erpnext/accounts/report/cash_flow/cash_flow.py
index d2c8c3e5f1c..f55d1927318 100644
--- a/erpnext/accounts/report/cash_flow/cash_flow.py
+++ b/erpnext/accounts/report/cash_flow/cash_flow.py
@@ -11,7 +11,7 @@ from erpnext.accounts.utils import get_fiscal_year
def execute(filters=None):
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
- filters.periodicity, filters.company)
+ filters.periodicity, filters.accumulated_values, filters.company)
operation_accounts = {
"section_name": "Operations",
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 80b0bf25587..9ba7711f0b5 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -4,9 +4,10 @@
from __future__ import unicode_literals
import frappe
from frappe import _
-from frappe.utils import flt, getdate, get_first_day, add_months, add_days, formatdate
+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, company):
+def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, accumulated_values=False, company=None):
"""Get a list of dict {"from_date": from_date, "to_date": to_date, "key": key, "label": label}
Periodicity can be (Yearly, Quarterly, Monthly)"""
@@ -58,11 +59,14 @@ def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, company):
# common processing
for opts in period_list:
key = opts["to_date"].strftime("%b_%Y").lower()
- if periodicity == "Monthly":
+ if periodicity == "Monthly" and not accumulated_values:
label = formatdate(opts["to_date"], "MMM YYYY")
else:
- label = get_label(periodicity, opts["from_date"], opts["to_date"])
-
+ if not accumulated_values:
+ label = get_label(periodicity, opts["from_date"], opts["to_date"])
+ else:
+ label = get_label(periodicity, period_list[0]["from_date"], opts["to_date"])
+
opts.update({
"key": key.replace(" ", "_").replace("-", "_"),
"label": label,
@@ -139,7 +143,8 @@ def calculate_values(accounts_by_name, gl_entries_by_account, period_list, accum
if entry.posting_date <= period.to_date:
if (accumulated_values or entry.posting_date >= period.from_date) and \
- (not ignore_accumulated_values_for_fy or entry.fiscal_year == period.to_date_fiscal_year):
+ (not ignore_accumulated_values_for_fy or
+ 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:
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 02dc8700356..95085b957ad 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
@@ -9,12 +9,15 @@ from erpnext.accounts.report.financial_statements import (get_period_list, get_c
def execute(filters=None):
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
- filters.periodicity, filters.company)
+ filters.periodicity, filters.accumulated_values, 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)
+ accumulated_values=filters.accumulated_values,
+ ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
+
expense = get_data(filters.company, "Expense", "Debit", period_list, filters=filters,
- accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
+ accumulated_values=filters.accumulated_values,
+ ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company)
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index d9faf6dd738..02aa14b1384 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -159,6 +159,11 @@ def get_data():
"is_query_report": True,
"doctype": "Journal Entry"
},
+ {
+ "type": "doctype",
+ "name": "Bank Guarantee",
+ "doctype": "Bank Guarantee"
+ },
]
},
{
diff --git a/erpnext/config/crm.py b/erpnext/config/crm.py
index 7a55cc606d7..e51275c260f 100644
--- a/erpnext/config/crm.py
+++ b/erpnext/config/crm.py
@@ -68,6 +68,18 @@ def get_data():
"name": "Inactive Customers",
"doctype": "Sales Order"
},
+ {
+ "type": "report",
+ "is_query_report": True,
+ "name": "Campaign Efficiency",
+ "doctype": "Lead"
+ },
+ {
+ "type": "report",
+ "is_query_report": True,
+ "name": "Lead Owner Efficiency",
+ "doctype": "Lead"
+ }
]
},
{
diff --git a/erpnext/crm/report/campaign_efficiency/__init__.py b/erpnext/crm/report/campaign_efficiency/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js
new file mode 100644
index 00000000000..2b25f1dfba2
--- /dev/null
+++ b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+frappe.query_reports["Campaign Efficiency"] = {
+ "filters": [
+ {
+ "fieldname": "from_date",
+ "label": __("From Date"),
+ "fieldtype": "Date",
+ "default": frappe.defaults.get_user_default("year_start_date"),
+ },
+ {
+ "fieldname": "to_date",
+ "label": __("To Date"),
+ "fieldtype": "Date",
+ "default": frappe.defaults.get_user_default("year_end_date"),
+ }
+ ]
+ };
+
diff --git a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.json b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.json
new file mode 100644
index 00000000000..986d9f35188
--- /dev/null
+++ b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.json
@@ -0,0 +1,30 @@
+{
+ "add_total_row": 0,
+ "apply_user_permissions": 1,
+ "creation": "2017-04-17 00:20:27.248275",
+ "disabled": 0,
+ "docstatus": 0,
+ "doctype": "Report",
+ "idx": 0,
+ "is_standard": "Yes",
+ "letter_head": "",
+ "modified": "2017-04-17 00:20:27.248275",
+ "modified_by": "Administrator",
+ "module": "CRM",
+ "name": "Campaign Efficiency",
+ "owner": "Administrator",
+ "ref_doctype": "Lead",
+ "report_name": "Campaign Efficiency",
+ "report_type": "Script Report",
+ "roles": [
+ {
+ "role": "Sales User"
+ },
+ {
+ "role": "Sales Manager"
+ },
+ {
+ "role": "System Manager"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
new file mode 100644
index 00000000000..b20fe15ce27
--- /dev/null
+++ b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
@@ -0,0 +1,89 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+
+def execute(filters=None):
+ columns, data = [], []
+ columns=get_columns()
+ data=get_lead_data(filters, "Campaign Name")
+ return columns, data
+
+def get_columns():
+ return [
+ _("Campaign Name") + ":data:130",
+ _("Lead Count") + ":Int:80",
+ _("Opp Count") + ":Int:80",
+ _("Quot Count") + ":Int:80",
+ _("Order Count") + ":Int:100",
+ _("Order Value") + ":Float:100",
+ _("Opp/Lead %") + ":Float:100",
+ _("Quot/Lead %") + ":Float:100",
+ _("Order/Quot %") + ":Float:100"
+ ]
+
+def get_lead_data(filters, based_on):
+ based_on_field = frappe.scrub(based_on)
+ conditions = get_filter_conditions(filters)
+
+ lead_details = frappe.db.sql("""
+ select {based_on_field}, name
+ from `tabLead`
+ where {based_on_field} is not null and {based_on_field} != '' {conditions}
+ """.format(based_on_field=based_on_field, conditions=conditions), filters, as_dict=1)
+
+ lead_map = frappe._dict()
+ for d in lead_details:
+ lead_map.setdefault(d.get(based_on_field), []).append(d.name)
+
+ data = []
+ for based_on_value, leads in lead_map.items():
+ row = {
+ based_on: based_on_value,
+ "Lead Count": len(leads)
+ }
+ row["Quot Count"]= get_lead_quotation_count(leads)
+ row["Opp Count"] = get_lead_opp_count(leads)
+ row["Order Count"] = get_quotation_ordered_count(leads)
+ row["Order Value"] = get_order_amount(leads)
+
+ row["Opp/Lead %"] = row["Opp Count"] / row["Lead Count"] * 100
+ row["Quot/Lead %"] = row["Quot Count"] / row["Lead Count"] * 100
+
+ row["Order/Quot %"] = row["Order Count"] / (row["Quot Count"] or 1) * 100
+
+ data.append(row)
+
+ return data
+
+def get_filter_conditions(filters):
+ conditions=""
+ if filters.from_date:
+ conditions += " and date(creation) >= %(from_date)s"
+ if filters.to_date:
+ conditions += " and date(creation) <= %(to_date)s"
+
+ return conditions
+
+def get_lead_quotation_count(leads):
+ return frappe.db.sql("""select count(name) from `tabQuotation`
+ where lead in (%s)""" % ', '.join(["%s"]*len(leads)), tuple(leads))[0][0]
+
+def get_lead_opp_count(leads):
+ return frappe.db.sql("""select count(name) from `tabOpportunity`
+ where lead in (%s)""" % ', '.join(["%s"]*len(leads)), tuple(leads))[0][0]
+
+def get_quotation_ordered_count(leads):
+ return frappe.db.sql("""select count(name)
+ from `tabQuotation` where status = 'Ordered'
+ and lead in (%s)""" % ', '.join(["%s"]*len(leads)), tuple(leads))[0][0]
+
+def get_order_amount(leads):
+ return frappe.db.sql("""select sum(base_net_amount)
+ from `tabSales Order Item`
+ where prevdoc_docname in (
+ select name from `tabQuotation` where status = 'Ordered'
+ and lead in (%s)
+ )""" % ', '.join(["%s"]*len(leads)), tuple(leads))[0][0]
\ No newline at end of file
diff --git a/erpnext/crm/report/lead_owner_efficiency/__init__.py b/erpnext/crm/report/lead_owner_efficiency/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.js b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.js
new file mode 100644
index 00000000000..bbfd6ac9ff7
--- /dev/null
+++ b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+ frappe.query_reports["Lead Owner Efficiency"] = {
+ "filters": [
+ {
+ "fieldname": "from_date",
+ "label": __("From Date"),
+ "fieldtype": "Date",
+ "default": frappe.defaults.get_user_default("year_start_date"),
+ },
+ {
+ "fieldname": "to_date",
+ "label": __("To Date"),
+ "fieldtype": "Date",
+ "default": frappe.defaults.get_user_default("year_end_date"),
+ }
+ ]};
diff --git a/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.json b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.json
new file mode 100644
index 00000000000..b6dadef4c4e
--- /dev/null
+++ b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.json
@@ -0,0 +1,30 @@
+{
+ "add_total_row": 0,
+ "apply_user_permissions": 1,
+ "creation": "2017-04-17 00:39:39.885905",
+ "disabled": 0,
+ "docstatus": 0,
+ "doctype": "Report",
+ "idx": 0,
+ "is_standard": "Yes",
+ "letter_head": "",
+ "modified": "2017-04-17 00:45:10.139004",
+ "modified_by": "Administrator",
+ "module": "CRM",
+ "name": "Lead Owner Efficiency",
+ "owner": "Administrator",
+ "ref_doctype": "Lead",
+ "report_name": "Lead Owner Efficiency",
+ "report_type": "Script Report",
+ "roles": [
+ {
+ "role": "Sales User"
+ },
+ {
+ "role": "Sales Manager"
+ },
+ {
+ "role": "System Manager"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py
new file mode 100644
index 00000000000..8134bc20032
--- /dev/null
+++ b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py
@@ -0,0 +1,26 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from erpnext.crm.report.campaign_efficiency.campaign_efficiency import get_lead_data
+
+def execute(filters=None):
+ columns, data = [], []
+ columns=get_columns()
+ data=get_lead_data(filters, "Lead Owner")
+ return columns, data
+
+def get_columns():
+ return [
+ _("Lead Owner") + ":Data:130",
+ _("Lead Count") + ":Int:80",
+ _("Opp Count") + ":Int:80",
+ _("Quot Count") + ":Int:80",
+ _("Order Count") + ":Int:100",
+ _("Order Value") + ":Float:100",
+ _("Opp/Lead %") + ":Float:100",
+ _("Quot/Lead %") + ":Float:100",
+ _("Order/Quot %") + ":Float:100"
+ ]
\ No newline at end of file
diff --git a/erpnext/docs/assets/img/accounts/bank-guarantee.png b/erpnext/docs/assets/img/accounts/bank-guarantee.png
new file mode 100644
index 00000000000..dda016acd54
Binary files /dev/null and b/erpnext/docs/assets/img/accounts/bank-guarantee.png differ
diff --git a/erpnext/docs/assets/img/accounts/exempted-item.png b/erpnext/docs/assets/img/accounts/exempted-item.png
new file mode 100644
index 00000000000..926806b5164
Binary files /dev/null and b/erpnext/docs/assets/img/accounts/exempted-item.png differ
diff --git a/erpnext/docs/assets/img/accounts/item-wise-tax.png b/erpnext/docs/assets/img/accounts/item-wise-tax.png
new file mode 100644
index 00000000000..9fe06ecc060
Binary files /dev/null and b/erpnext/docs/assets/img/accounts/item-wise-tax.png differ
diff --git a/erpnext/docs/assets/img/accounts/tax-calulation.png b/erpnext/docs/assets/img/accounts/tax-calulation.png
new file mode 100644
index 00000000000..f22d5d3cb06
Binary files /dev/null and b/erpnext/docs/assets/img/accounts/tax-calulation.png differ
diff --git a/erpnext/docs/assets/img/accounts/tax-master.png b/erpnext/docs/assets/img/accounts/tax-master.png
new file mode 100644
index 00000000000..c08439be082
Binary files /dev/null and b/erpnext/docs/assets/img/accounts/tax-master.png differ
diff --git a/erpnext/docs/assets/old_images/erpnext/item-wise-tax-calc.png b/erpnext/docs/assets/old_images/erpnext/item-wise-tax-calc.png
deleted file mode 100644
index cd3a08f10ed..00000000000
Binary files a/erpnext/docs/assets/old_images/erpnext/item-wise-tax-calc.png and /dev/null differ
diff --git a/erpnext/docs/assets/old_images/erpnext/item-wise-tax-master.png b/erpnext/docs/assets/old_images/erpnext/item-wise-tax-master.png
deleted file mode 100644
index 95983c57ea7..00000000000
Binary files a/erpnext/docs/assets/old_images/erpnext/item-wise-tax-master.png and /dev/null differ
diff --git a/erpnext/docs/assets/old_images/erpnext/item-wise-tax.png b/erpnext/docs/assets/old_images/erpnext/item-wise-tax.png
deleted file mode 100644
index 374fab69f90..00000000000
Binary files a/erpnext/docs/assets/old_images/erpnext/item-wise-tax.png and /dev/null differ
diff --git a/erpnext/docs/user/manual/en/accounts/bank-guarantee.md b/erpnext/docs/user/manual/en/accounts/bank-guarantee.md
new file mode 100644
index 00000000000..db60300e869
--- /dev/null
+++ b/erpnext/docs/user/manual/en/accounts/bank-guarantee.md
@@ -0,0 +1,9 @@
+A Bank Guarantee is a guarantee from a lending institution such as a bank ensuring the liabilities of a debtor will be met. In other words, if the debtor fails to settle a debt, the bank covers it. A Bank Guarantee enables the customer, or debtor, to acquire goods, buy equipment or draw down loans, and thereby expand business activity.
+
+A client may ask you to provide a Bank Guarantee from a third party such as a bank. This guarantee is for a specified amount, which is usually a percentage of the total value of the contract. The Bank Guarantee is valid for a specified duration after which it expires and must be returned to you by the client.
+
+This document allows you to track Bank Guarantees given to clients. You can set Email Alerts as the Bank Guarantee expiry date approaches to remind yourself to get the Bank Guarantee back from your client.
+
+
+
+{next}
diff --git a/erpnext/docs/user/manual/en/accounts/index.txt b/erpnext/docs/user/manual/en/accounts/index.txt
index 6ba93375871..6a0da3a8945 100644
--- a/erpnext/docs/user/manual/en/accounts/index.txt
+++ b/erpnext/docs/user/manual/en/accounts/index.txt
@@ -10,6 +10,7 @@ multi-currency-accounting
advance-payment-entry
payment-request
credit-limit
+bank-guarantee
accounting-reports
accounting-entries
managing-fixed-assets
diff --git a/erpnext/docs/user/manual/en/accounts/item-wise-taxation.md b/erpnext/docs/user/manual/en/accounts/item-wise-taxation.md
index bc51de9de92..1750f41ea09 100644
--- a/erpnext/docs/user/manual/en/accounts/item-wise-taxation.md
+++ b/erpnext/docs/user/manual/en/accounts/item-wise-taxation.md
@@ -1,29 +1,35 @@
-Taxes selected in the Tax and Other Charges in transactions are applied on all the items. If you need different taxes applied on items selected in the same transaction, you should setup you item and tax master as explained in the steps below.
+In the sales and purchase transactions, you can apply taxes and other charges on the items. For the ease of applying taxes, you can fetch values from the [Sales Taxes and Charges master](/contents//setting-up/setting-up-taxes). Taxes and charges are applied equally on all the items. For example, if tax GST 16% is added in the tax table, then it will be applied on all the items. However, if you need to have different tax rate applied on some of the items, following is how you should setup Items and Sales Taxes and Other Charges master in your ERPNext account.
+
+Let's assume that we are creating a Sales Order. We have Sales Taxes and Charges master for GST 16%. Out of all the Sales Items, on one item, only 12% GST will be applied, while one more item is exempted from the tax.
####Step 1: Mention Tax Applicable in the Item master
-Item master has tax table where you can list taxes which will be applied on it.
+Items on which differential tax rate is applied, you should mention tax rate for that item in the Item master itself. Item master has tax table where you can list taxes which will be applied on it.
-
+> Tax rate mentioned in the item master gets preference over tax rate entered in the transactions.
-Tax rate mentioned in the item master gets preference over tax rate entered in the transactions.
+Here is the example of Item on which 12% GST is applied only.
-For example, if you provide tax rate for VAT as 10% for item ABC, where for same VAT ledger 12% rate is entered in the Sales Order/Invoice, for item ABC, tax rate applied would be 10%, as mentioned in the item master.
+
+
+For the item which is exempted from GST totally, mention 0% as tax rate in the Item master.
+
+
####Step 2: Setup Taxes and Other Charges
-In Taxes and Other Charges master, you should select all the applicable taxes which could be applicable on item.
+In Sales Taxes and Other Charges master, select GST 16% account and mention Tax Rate as 16. This tax rate will be applied on all the Items selected in the Sales Order, unless specific Tax Rate is defined in the Item master.
-For example, if few items has VAT 5 applied on them, other has Service Tax applied, and some other has Excise Duty applicable, then you tax master should have all these taxes selected.
+
-
+
-
+Please note that item's tax rate will be pulled from the item master only if you have update same tax account (GST 16% in this case) in both Item master and tax master.
{next}
diff --git a/erpnext/docs/user/manual/en/setting-up/settings/module-settings.md b/erpnext/docs/user/manual/en/setting-up/settings/module-settings.md
index ecfb28213d4..3e2a109dada 100644
--- a/erpnext/docs/user/manual/en/setting-up/settings/module-settings.md
+++ b/erpnext/docs/user/manual/en/setting-up/settings/module-settings.md
@@ -2,7 +2,7 @@
You can globally switch off certain desktop module via:
-> Setup > Settings > Show or Hide Modules
+> Setup > Permissions > Show / Hide Modules
For example if you are in the services business, you want to hide the Manufacturing Module, you can do this via **Show or Hide Modules**
diff --git a/erpnext/patches/v8_0/update_status_as_paid_for_completed_expense_claim.py b/erpnext/patches/v8_0/update_status_as_paid_for_completed_expense_claim.py
index 644b8cd0350..19d27b206b1 100644
--- a/erpnext/patches/v8_0/update_status_as_paid_for_completed_expense_claim.py
+++ b/erpnext/patches/v8_0/update_status_as_paid_for_completed_expense_claim.py
@@ -7,6 +7,8 @@ import frappe
def execute():
""" set status as Paid in Expense Claim if total_sactioned_amount
and total_amount_reimbursed is equal """
+
+ frappe.reload_doctype('Expense Claim')
frappe.db.sql("""
update
@@ -14,4 +16,4 @@ def execute():
set status = 'Paid'
where
total_sanctioned_amount = total_amount_reimbursed
- """)
\ No newline at end of file
+ """)