[patch][fix] Fixed drop ship status and tax rule patch

This commit is contained in:
Nabin Hait 2015-12-08 16:50:20 +05:30
parent aa99fe2c4e
commit 4ad0963ee8
3 changed files with 6 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -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)