Merge branch 'hotfix'

This commit is contained in:
Saurabh 2018-04-17 12:00:19 +05:30
commit c3fbc04aab
6 changed files with 31 additions and 21 deletions

View File

@ -5,7 +5,7 @@ import frappe
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'''

View File

@ -39,18 +39,20 @@ frappe.ui.form.on("Tax Rule", "customer", function(frm) {
});
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);
});
}
}
}
});
});
}
});

View File

@ -146,6 +146,7 @@ class PayrollEntry(Document):
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 @@ class PayrollEntry(Document):
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 @@ class PayrollEntry(Document):
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

View File

@ -411,7 +411,7 @@ class SalarySlip(TransactionBase):
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):

View File

@ -104,7 +104,7 @@ def get_stock_ledger_entries(filters, items):
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)
@ -205,7 +205,7 @@ def get_item_details(items, sle, filters):
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:
@ -219,7 +219,7 @@ def get_item_reorder_details(items):
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)

View File

@ -56,7 +56,7 @@ def get_stock_ledger_entries(filters, items):
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 @@ def get_item_details(items, sl_entries):
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