Merge pull request #6960 from KanchanChauhan/thumbnail-in-shoppingcart
[Fix]Product thumbnail in Shopping Cart
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 6da496b..98390ff 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -32,12 +32,13 @@
# searches for active employees
def employee_query(doctype, txt, searchfield, start, page_len, filters):
+ conditions = []
return frappe.db.sql("""select name, employee_name from `tabEmployee`
where status = 'Active'
and docstatus < 2
and ({key} like %(txt)s
or employee_name like %(txt)s)
- {mcond}
+ {fcond} {mcond}
order by
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
if(locate(%(_txt)s, employee_name), locate(%(_txt)s, employee_name), 99999),
@@ -45,6 +46,7 @@
name, employee_name
limit %(start)s, %(page_len)s""".format(**{
'key': searchfield,
+ 'fcond': get_filters_cond(doctype, filters, conditions),
'mcond': get_match_cond(doctype)
}), {
'txt': "%%%s%%" % txt,
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 68e9155..60cd68c 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -164,14 +164,18 @@
frappe.throw(_("Maxiumm discount for Item {0} is {1}%").format(d.item_code, discount))
def validate_selling_price(self):
+ def throw_message(item_name, rate, ref_rate_field):
+ frappe.throw(_("""Selling price for item {0} is lower than its {1}. Selling price should be atleast {2}""")
+ .format(item_name, ref_rate_field, rate))
+
if not frappe.db.get_single_value("Selling Settings", "validate_selling_price"):
return
for it in self.get("items"):
- last_purchase_rate, is_stock_item = frappe.db.get_value("Item", it.name, ["last_purchase_rate", "is_stock_item"])
+ last_purchase_rate, is_stock_item = frappe.db.get_value("Item", it.item_code, ["last_purchase_rate", "is_stock_item"])
if flt(it.base_rate) < flt(last_purchase_rate):
- throw(it.name, last_purchase_rate, "last purchase rate")
+ throw_message(it.item_name, last_purchase_rate, "last purchase rate")
last_valuation_rate = frappe.db.sql("""
SELECT valuation_rate FROM `tabStock Ledger Entry` WHERE item_code = %s
@@ -182,9 +186,6 @@
if is_stock_item and flt(it.base_rate) < flt(last_valuation_rate):
throw_message(it.name, last_valuation_rate, "valuation rate")
- def throw_message(item_name, rate, ref_rate_field):
- frappe.throw(_("""Selling price for item {0} is lower than its {1}. Selling price should be atleast {2}""")
- .format(item_name, ref_rate_field, rate))
def get_item_list(self):
il = []
diff --git a/erpnext/hr/doctype/process_payroll/process_payroll.py b/erpnext/hr/doctype/process_payroll/process_payroll.py
index 3554669..2077982 100644
--- a/erpnext/hr/doctype/process_payroll/process_payroll.py
+++ b/erpnext/hr/doctype/process_payroll/process_payroll.py
@@ -22,7 +22,7 @@
sal_struct = frappe.db.sql("""
select name from `tabSalary Structure`
- where docstatus != 2 and company = %(company)s and
+ where docstatus != 2 and is_active = 'Yes' and company = %(company)s and
ifnull(salary_slip_based_on_timesheet,0) = %(salary_slip_based_on_timesheet)s""",
{"company": self.company, "salary_slip_based_on_timesheet":self.salary_slip_based_on_timesheet})
@@ -51,8 +51,8 @@
def get_joining_releiving_condition(self):
cond = """
- and ifnull(t1.date_of_joining, '0000-00-00') <= '%(from_date)s'
- and ifnull(t1.relieving_date, '2199-12-31') >= '%(to_date)s'
+ and ifnull(t1.date_of_joining, '0000-00-00') <= '%(to_date)s'
+ and ifnull(t1.relieving_date, '2199-12-31') >= '%(from_date)s'
""" % {"from_date": self.from_date, "to_date": self.to_date}
return cond
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.js b/erpnext/hr/doctype/salary_structure/salary_structure.js
index 334e8a5..c5df2e6 100755
--- a/erpnext/hr/doctype/salary_structure/salary_structure.js
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.js
@@ -28,7 +28,15 @@
type: "deduction"
}
}
- })
+ });
+ frm.set_query("employee", "employees", function(doc) {
+ return {
+ query: "erpnext.controllers.queries.employee_query",
+ filters: {
+ company: doc.company
+ }
+ }
+ });
},
refresh: function(frm) {
@@ -182,11 +190,3 @@
calculate_totals(frm.doc);
}
})
-
-frappe.ui.form.on('Salary Structure Employee', {
- onload: function(frm) {
- frm.set_query("employee","employees", function(doc,cdt,cdn) {
- return{ query: "erpnext.controllers.queries.employee_query" }
- })
- }
-});