Merge branch 'master' into develop
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 94e291a..777b7bd 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
-__version__ = '10.1.22'
+__version__ = '10.1.23'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.js b/erpnext/accounts/doctype/tax_rule/tax_rule.js
index 16041a8..84c42a3 100644
--- a/erpnext/accounts/doctype/tax_rule/tax_rule.js
+++ b/erpnext/accounts/doctype/tax_rule/tax_rule.js
@@ -39,18 +39,20 @@
});
frappe.ui.form.on("Tax Rule", "supplier", function(frm) {
- frappe.call({
- method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
- args: {
- "party": frm.doc.supplier,
- "party_type": "supplier"
- },
- callback: function(r) {
- if(!r.exc) {
- $.each(r.message, function(k, v) {
- frm.set_value(k, v);
- });
+ if(frm.doc.supplier) {
+ frappe.call({
+ method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
+ args: {
+ "party": frm.doc.supplier,
+ "party_type": "supplier"
+ },
+ callback: function(r) {
+ if(!r.exc) {
+ $.each(r.message, function(k, v) {
+ frm.set_value(k, v);
+ });
+ }
}
- }
- });
+ });
+ }
});
diff --git a/erpnext/hr/doctype/payroll_entry/payroll_entry.py b/erpnext/hr/doctype/payroll_entry/payroll_entry.py
index 8437ec2..f4097b4 100644
--- a/erpnext/hr/doctype/payroll_entry/payroll_entry.py
+++ b/erpnext/hr/doctype/payroll_entry/payroll_entry.py
@@ -146,6 +146,7 @@
ss_list = self.get_sal_slip_list(ss_status=0)
submitted_ss = []
not_submitted_ss = []
+ frappe.flags.via_payroll_entry = True
for ss in ss_list:
ss_obj = frappe.get_doc("Salary Slip",ss[0])
ss_dict = {}
@@ -159,7 +160,7 @@
else:
try:
ss_obj.submit()
- submitted_ss.append(ss_dict)
+ submitted_ss.append(ss_obj)
except frappe.ValidationError:
not_submitted_ss.append(ss_dict)
@@ -168,8 +169,15 @@
frappe.msgprint(_("Salary Slip submitted for period from {0} to {1}")
.format(ss_obj.start_date, ss_obj.end_date))
+ self.email_salary_slip(submitted_ss)
+
return create_submit_log(submitted_ss, not_submitted_ss, jv_name)
+ def email_salary_slip(self, submitted_ss):
+ if frappe.db.get_single_value("HR Settings", "email_salary_slip_to_employee"):
+ for ss in submitted_ss:
+ ss.email_salary_slip()
+
def get_loan_details(self):
"""
Get loan details from submitted salary slip based on selected criteria
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index 7b36b51..71f06f2 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -410,7 +410,7 @@
else:
self.set_status()
self.update_status(self.name)
- if(frappe.db.get_single_value("HR Settings", "email_salary_slip_to_employee")):
+ if(frappe.db.get_single_value("HR Settings", "email_salary_slip_to_employee")) and not frappe.flags.via_payroll_entry:
self.email_salary_slip()
def on_cancel(self):
diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py
index 83e06dc..eed9f4a 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.py
+++ b/erpnext/stock/report/stock_balance/stock_balance.py
@@ -106,7 +106,7 @@
item_conditions_sql = ''
if items:
item_conditions_sql = ' and sle.item_code in ({})'\
- .format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items]))
+ .format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items]))
conditions = get_conditions(filters)
@@ -207,7 +207,7 @@
select name, item_name, description, item_group, brand, stock_uom
from `tabItem`
where name in ({0})
- """.format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items])), as_dict=1):
+ """.format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1):
item_details.setdefault(item.name, item)
if filters.get('show_variant_attributes', 0) == 1:
@@ -221,7 +221,7 @@
select parent, warehouse, warehouse_reorder_qty, warehouse_reorder_level
from `tabItem Reorder`
where parent in ({0})
- """.format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items])), as_dict=1)
+ """.format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1)
return dict((d.parent + d.warehouse, d) for d in item_reorder_details)
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index c9286a3..5e185e0 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -56,7 +56,7 @@
item_conditions_sql = ''
if items:
item_conditions_sql = 'and sle.item_code in ({})'\
- .format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items]))
+ .format(', '.join(['"' + frappe.db.escape(i,percent=False) + '"' for i in items]))
return frappe.db.sql("""select concat_ws(" ", posting_date, posting_time) as date,
item_code, warehouse, actual_qty, qty_after_transaction, incoming_rate, valuation_rate,
@@ -97,7 +97,7 @@
select name, item_name, description, item_group, brand, stock_uom
from `tabItem`
where name in ({0})
- """.format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items])), as_dict=1):
+ """.format(', '.join(['"' + frappe.db.escape(i,percent=False) + '"' for i in items])), as_dict=1):
item_details.setdefault(item.name, item)
return item_details