From 5fe69fb5560766f744204f1d5c404c2de58a0879 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 5 Jun 2014 18:06:20 +0530 Subject: [PATCH] Fixes --- erpnext/hr/doctype/leave_application/leave_application.py | 7 ++++++- erpnext/patches/v4_0/customer_discount_to_pricing_rule.py | 3 +++ erpnext/templates/generators/item_group.py | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index 9ff02b2603..27833913e8 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -137,7 +137,12 @@ class LeaveApplication(Document): and (from_date between %(from_date)s and %(to_date)s or to_date between %(from_date)s and %(to_date)s or %(from_date)s between from_date and to_date) - and name != %(name)s""", self.as_dict(), as_dict = 1): + and name != %(name)s""", { + "employee": self.employee, + "from_date": self.from_date, + "to_date": self.to_date, + "name": self.name + }, as_dict = 1): frappe.msgprint(_("Employee {0} has already applied for {1} between {2} and {3}").format(self.employee, cstr(d['leave_type']), formatdate(d['from_date']), formatdate(d['to_date']))) diff --git a/erpnext/patches/v4_0/customer_discount_to_pricing_rule.py b/erpnext/patches/v4_0/customer_discount_to_pricing_rule.py index 5f9fc23da5..fa35898df3 100644 --- a/erpnext/patches/v4_0/customer_discount_to_pricing_rule.py +++ b/erpnext/patches/v4_0/customer_discount_to_pricing_rule.py @@ -14,6 +14,9 @@ def execute(): for d in frappe.db.sql("""select * from `tabCustomer Discount` where ifnull(parent, '') != ''""", as_dict=1): + if not d.discount: + continue + frappe.get_doc({ "doctype": "Pricing Rule", "apply_on": "Item Group", diff --git a/erpnext/templates/generators/item_group.py b/erpnext/templates/generators/item_group.py index fab581cd1c..8e09dbc35e 100644 --- a/erpnext/templates/generators/item_group.py +++ b/erpnext/templates/generators/item_group.py @@ -44,7 +44,7 @@ def get_child_groups(item_group_name): item_group = frappe.get_doc("Item Group", item_group_name) return frappe.db.sql("""select name from `tabItem Group` where lft>=%(lft)s and rgt<=%(rgt)s - and show_in_website = 1""", item_group.as_dict()) + and show_in_website = 1""", {"lft": item_group.lft, "rgt": item_group.rgt}) def get_item_for_list_in_html(context): return frappe.get_template("templates/includes/product_in_grid.html").render(context)