Merge pull request #6873 from saurabh6790/integration_broker_fix
[fix] added hook call to create payment gateway account record
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index 5b1742a..4dc8f8c 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -21,7 +21,7 @@
invoice_income_map, income_accounts)
invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
- customer_map = get_customer_deatils(invoice_list)
+ customer_map = get_customer_details(invoice_list)
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
mode_of_payments = get_mode_of_payments([inv.name for inv in invoice_list])
@@ -184,7 +184,7 @@
return invoice_so_dn_map
-def get_customer_deatils(invoice_list):
+def get_customer_details(invoice_list):
customer_map = {}
customers = list(set([inv.customer for inv in invoice_list]))
for cust in frappe.db.sql("""select name, territory, customer_group from `tabCustomer`
@@ -204,4 +204,4 @@
for d in inv_mop:
mode_of_payments.setdefault(d.parent, []).append(d.mode_of_payment)
- return mode_of_payments
\ No newline at end of file
+ return mode_of_payments
diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js
index 33296ee..43bd6d4 100644
--- a/erpnext/stock/dashboard/item_dashboard.js
+++ b/erpnext/stock/dashboard/item_dashboard.js
@@ -46,6 +46,7 @@
args: {
item_code: this.item_code,
warehouse: this.warehouse,
+ item_group: this.item_group,
start: this.start,
sort_by: this.sort_by,
sort_order: this.sort_order,
diff --git a/erpnext/stock/dashboard/item_dashboard.py b/erpnext/stock/dashboard/item_dashboard.py
index 5a00b3d..28ea045 100644
--- a/erpnext/stock/dashboard/item_dashboard.py
+++ b/erpnext/stock/dashboard/item_dashboard.py
@@ -3,12 +3,38 @@
import frappe
@frappe.whitelist()
-def get_data(item_code=None, warehouse=None, start=0, sort_by='actual_qty', sort_order='desc'):
- filters = {}
+def get_data(item_code=None, warehouse=None, item_group=None,
+ start=0, sort_by='actual_qty', sort_order='desc'):
+ '''Return data to render the item dashboard'''
+ conditions = []
+ values = []
if item_code:
- filters['item_code'] = item_code
+ conditions.append('b.item_code=%s')
+ values.append(item_code)
if warehouse:
- filters['warehouse'] = warehouse
- return frappe.get_list("Bin", filters=filters, fields=['item_code', 'warehouse',
- 'projected_qty', 'reserved_qty', 'reserved_qty_for_production', 'actual_qty', 'valuation_rate'],
- order_by='{0} {1}'.format(sort_by, sort_order), start=start, page_length = 21)
\ No newline at end of file
+ conditions.append('b.warehouse=%s')
+ values.append(warehouse)
+ if item_group:
+ conditions.append('i.item_group=%s')
+ values.append(item_group)
+
+ if conditions:
+ conditions = ' and ' + ' and '.join(conditions)
+ else:
+ conditions = ''
+
+ return frappe.db.sql('''
+ select
+ b.item_code, b.warehouse, b.projected_qty, b.reserved_qty,
+ b.reserved_qty_for_production, b.actual_qty, b.valuation_rate, i.item_name
+ from
+ tabBin b, tabItem i
+ where
+ b.item_code = i.name
+ {conditions}
+ order by
+ {sort_by} {sort_order}
+ limit
+ {start}, 21
+ '''.format(conditions=conditions, sort_by=sort_by, sort_order=sort_order,
+ start=start), values, as_dict=True)
diff --git a/erpnext/stock/dashboard/item_dashboard_list.html b/erpnext/stock/dashboard/item_dashboard_list.html
index f9ffbb3..c1792a9 100644
--- a/erpnext/stock/dashboard/item_dashboard_list.html
+++ b/erpnext/stock/dashboard/item_dashboard_list.html
@@ -7,7 +7,9 @@
<div class="col-sm-3 small" style="margin-top: 8px;">
{% if show_item %}
<a data-type="item"
- data-name="{{ d.item_code }}">{{ d.item_code }}</a>
+ data-name="{{ d.item_code }}">{{ d.item_code }}
+ {% if d.item_name != d.item_code %}({{ d.item_name }}){% endif %}
+ </a>
{% endif %}
</div>
<div class="col-sm-4 small">
diff --git a/erpnext/stock/page/stock_balance/stock_balance.js b/erpnext/stock/page/stock_balance/stock_balance.js
index 9494045..3cf93fa 100644
--- a/erpnext/stock/page/stock_balance/stock_balance.js
+++ b/erpnext/stock/page/stock_balance/stock_balance.js
@@ -28,6 +28,17 @@
}
});
+ page.item_group_field = page.add_field({
+ fieldname: 'item_group',
+ label: __('Item Group'),
+ fieldtype:'Link',
+ options:'Item Group',
+ change: function() {
+ page.item_dashboard.start = 0;
+ page.item_dashboard.refresh();
+ }
+ });
+
page.sort_selector = new frappe.ui.SortSelector({
parent: page.wrapper.find('.page-form'),
args: {
@@ -58,6 +69,7 @@
page.item_dashboard.before_refresh = function() {
this.item_code = page.item_field.get_value();
this.warehouse = page.warehouse_field.get_value();
+ this.item_group = page.item_group_field.get_value();
}
page.item_dashboard.refresh();