diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index f9eb26911c..452b9e83fb 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
-__version__ = '8.0.47'
+__version__ = '8.0.48'
def get_default_company(user=None):
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
index ba847c0061..390bb27fd5 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
@@ -21,11 +21,13 @@
{%= __("Party") %} |
{%= __("Invoiced Amount") %} |
{%= __("Paid Amount") %} |
+ {%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %} |
{%= __("Outstanding Amount") %} |
{% } else { %}
{%= __("Party") %} |
{%= __("Total Invoiced Amount") %} |
{%= __("Total Paid Amount") %} |
+ {%= report.report_name === "Accounts Receivable Summary" ? __('Credit Note Amount') : __('Debit Note Amount') %} |
{%= __("Total Outstanding Amount") %} |
{% } %}
@@ -44,6 +46,8 @@
{%= format_currency(data[i]["Invoiced Amount"], data[i]["currency"]) %}
{%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %} |
+
+ {%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} |
{%= format_currency(data[i]["Outstanding Amount"], data[i]["currency"]) %} |
{% } else { %}
@@ -54,6 +58,7 @@
{%= format_currency(data[i]["Invoiced Amount"]) %}
{%= format_currency(data[i]["Paid Amount"]) %} |
+ {% report.report_name === "Accounts Receivable" ? format_currency(data[i][__("Credit Note Amt")]) : format_currency(data[i][__("Debit Note Amt")]) %} |
{%= format_currency(data[i]["Outstanding Amount"]) %} |
{% } %}
@@ -67,6 +72,7 @@
{% } %}
{%= format_currency(data[i][__("Total Invoiced Amt")]) %} |
{%= format_currency(data[i][__("Total Paid Amt")]) %} |
+ {%= report.report_name === "Accounts Receivable Summary" ? format_currency(data[i][__("Credit Note Amt")]) : format_currency(data[i][__("Debit Note Amt")]) %} |
{%= format_currency(data[i][__("Total Outstanding Amt")]) %} |
{% } %}
{% } %}
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 3502d63632..fbd04a141a 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -400,3 +400,4 @@ erpnext.patches.v8_0.set_sales_invoice_serial_number_from_delivery_note
erpnext.patches.v8_0.delete_schools_depricated_doctypes
erpnext.patches.v8_0.update_customer_pos_id
erpnext.patches.v8_0.rename_items_in_status_field_of_material_request
+erpnext.patches.v8_0.delete_bin_indexes
diff --git a/erpnext/patches/v8_0/delete_bin_indexes.py b/erpnext/patches/v8_0/delete_bin_indexes.py
new file mode 100644
index 0000000000..12cacdb952
--- /dev/null
+++ b/erpnext/patches/v8_0/delete_bin_indexes.py
@@ -0,0 +1,16 @@
+# Copyright (c) 2017, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+# -*- coding: utf-8 -*-
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ # delete bin indexes
+ unwanted_indexes = ["item_code", "warehouse"]
+
+ for k in unwanted_indexes:
+ try:
+ frappe.db.sql("drop index {0} on `tabBin`".format(k))
+ except:
+ pass
\ No newline at end of file
diff --git a/erpnext/stock/doctype/bin/bin.json b/erpnext/stock/doctype/bin/bin.json
index 0481cfc002..1f6e9e1785 100644
--- a/erpnext/stock/doctype/bin/bin.json
+++ b/erpnext/stock/doctype/bin/bin.json
@@ -1,5 +1,6 @@
{
"allow_copy": 0,
+ "allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "BIN/.#######",
@@ -12,6 +13,7 @@
"engine": "InnoDB",
"fields": [
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -22,6 +24,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
+ "in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Warehouse",
@@ -37,11 +40,12 @@
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
- "search_index": 1,
+ "search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -52,6 +56,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
+ "in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Item Code",
@@ -67,11 +72,12 @@
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
- "search_index": 1,
+ "search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -83,6 +89,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Reserved Quantity",
@@ -102,6 +109,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -113,6 +121,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
+ "in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Actual Quantity",
@@ -132,6 +141,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -143,6 +153,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Ordered Quantity",
@@ -162,6 +173,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -173,6 +185,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Requested Quantity",
@@ -192,6 +205,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -202,6 +216,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Planned Qty",
@@ -221,6 +236,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -231,6 +247,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Projected Qty",
@@ -250,6 +267,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -260,6 +278,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Reserved Qty for Production",
@@ -278,6 +297,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -288,6 +308,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Moving Average Rate",
@@ -307,6 +328,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -317,6 +339,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "UOM",
@@ -337,6 +360,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -347,6 +371,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "FCFS Rate",
@@ -366,6 +391,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -376,6 +402,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Valuation Rate",
@@ -395,6 +422,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -405,6 +433,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Stock Value",
@@ -424,17 +453,17 @@
"unique": 0
}
],
+ "has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 1,
"idx": 1,
"image_view": 0,
"in_create": 1,
- "in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-12-15 14:51:43.312590",
+ "modified": "2017-06-13 13:06:32.601505",
"modified_by": "Administrator",
"module": "Stock",
"name": "Bin",
@@ -450,7 +479,6 @@
"export": 0,
"if_owner": 0,
"import": 0,
- "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -471,7 +499,6 @@
"export": 0,
"if_owner": 0,
"import": 0,
- "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -492,7 +519,6 @@
"export": 0,
"if_owner": 0,
"import": 0,
- "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -508,6 +534,8 @@
"read_only": 0,
"read_only_onload": 0,
"search_fields": "item_code,warehouse",
+ "show_name_in_global_search": 0,
"sort_order": "ASC",
+ "track_changes": 0,
"track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py
index ece8220812..75510decd3 100644
--- a/erpnext/stock/doctype/bin/bin.py
+++ b/erpnext/stock/doctype/bin/bin.py
@@ -31,6 +31,7 @@ class Bin(Document):
is_group_warehouse(self.warehouse)
def update_stock(self, args, allow_negative_stock=False, via_landed_cost_voucher=False):
+ '''Called from erpnext.stock.utils.update_bin'''
self.update_qty(args)
if args.get("actual_qty") or args.get("voucher_type") == "Stock Reconciliation":
@@ -55,15 +56,6 @@ class Bin(Document):
if args.get("voucher_type")=="Stock Reconciliation":
if args.get('is_cancelled') == 'No':
self.actual_qty = args.get("qty_after_transaction")
- else:
- qty_after_transaction = frappe.db.get_value("""select qty_after_transaction
- from `tabStock Ledger Entry`
- where item_code=%s and warehouse=%s
- and not (voucher_type='Stock Reconciliation' and voucher_no=%s)
- order by posting_date desc limit 1""",
- (self.item_code, self.warehouse, args.get('voucher_no')))
-
- self.actual_qty = flt(qty_after_transaction[0][0]) if qty_after_transaction else 0.0
else:
self.actual_qty = flt(self.actual_qty) + flt(args.get("actual_qty"))
@@ -72,7 +64,8 @@ class Bin(Document):
self.indented_qty = flt(self.indented_qty) + flt(args.get("indented_qty"))
self.planned_qty = flt(self.planned_qty) + flt(args.get("planned_qty"))
- self.save()
+ self.set_projected_qty()
+ self.db_update()
def set_projected_qty(self):
self.projected_qty = (flt(self.actual_qty) + flt(self.ordered_qty)
@@ -111,3 +104,6 @@ def update_item_projected_qty(item_code):
frappe.db.sql('''update tabItem set
total_projected_qty = ifnull((select sum(projected_qty) from tabBin where item_code=%s), 0)
where name=%s''', (item_code, item_code))
+
+def on_doctype_update():
+ frappe.db.add_index("Bin", ["item_code", "warehouse"])
diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json
index f5aced3b7b..8275c84416 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json
+++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json
@@ -694,7 +694,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-12-15 14:45:07.733480",
+ "modified": "2017-06-09 14:45:07.888888",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Ledger Entry",
diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
index 55a307cd3e..b5d2e3f790 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
+++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
@@ -129,3 +129,5 @@ def on_doctype_update():
frappe.db.commit()
frappe.db.sql("""alter table `tabStock Ledger Entry`
add index posting_sort_index(posting_date, posting_time, name)""")
+
+ frappe.db.add_index("Stock Ledger Entry", ["voucher_no", "voucher_type"])