diff --git a/erpnext/patches.txt b/erpnext/patches.txt index f522b18de6..ac5e5ca5eb 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -237,5 +237,5 @@ erpnext.patches.v6_10.fix_ordered_received_billed erpnext.patches.v6_10.fix_jv_total_amount #2015-11-30 erpnext.patches.v6_10.email_digest_default_quote erpnext.patches.v6_10.fix_billed_amount_in_drop_ship_po -erpnext.patches.v6_10.fix_delivery_status_of_drop_ship_item +erpnext.patches.v6_10.fix_delivery_status_of_drop_ship_item #2015-12-08 erpnext.patches.v5_8.tax_rule #2015-12-08 diff --git a/erpnext/patches/v5_8/tax_rule.py b/erpnext/patches/v5_8/tax_rule.py index 4a62501d09..8da28ba4c9 100644 --- a/erpnext/patches/v5_8/tax_rule.py +++ b/erpnext/patches/v5_8/tax_rule.py @@ -11,7 +11,7 @@ def execute(): ifnull(default_taxes_and_charges, '') != '' """, as_dict=1) for d in customers: - if not frappe.db.exists({"doctype": "Tax Rule", "customer": d.name}): + if not frappe.db.sql("select name from `tabTax Rule` where customer=%s", d.name): tr = frappe.new_doc("Tax Rule") tr.tax_type = "Sales" tr.customer = d.name @@ -23,7 +23,7 @@ def execute(): ifnull(default_taxes_and_charges, '') != '' """, as_dict=1) for d in suppliers: - if not frappe.db.exists({"doctype": "Tax Rule", "supplier": d.name}): + if not frappe.db.sql("select name from `tabTax Rule` where supplier=%s", d.name): tr = frappe.new_doc("Tax Rule") tr.tax_type = "Purchase" tr.supplier = d.name diff --git a/erpnext/patches/v6_10/fix_delivery_status_of_drop_ship_item.py b/erpnext/patches/v6_10/fix_delivery_status_of_drop_ship_item.py index a54d0ab389..23de9d0520 100644 --- a/erpnext/patches/v6_10/fix_delivery_status_of_drop_ship_item.py +++ b/erpnext/patches/v6_10/fix_delivery_status_of_drop_ship_item.py @@ -2,16 +2,8 @@ from __future__ import unicode_literals import frappe def execute(): - sales_orders_to_update = [] - - for item in frappe.get_all("Purchase Order Item", filters={"delivered_by_supplier": 1}, - fields=["prevdoc_doctype", "prevdoc_docname"]): - - if item.prevdoc_doctype == "Sales Order": - if item.prevdoc_docname not in sales_orders_to_update: - sales_orders_to_update.append(item.prevdoc_docname) - - for so_name in sales_orders_to_update: - so = frappe.get_doc("Sales Order", so_name) + for so_name in frappe.db.sql("""select distinct parent from `tabSales Order Item` + where delivered_by_supplier=1 and docstatus=1"""): + so = frappe.get_doc("Sales Order", so_name[0]) so.update_delivery_status() so.set_status(update=True, update_modified=False) \ No newline at end of file