2015-09-17 12:59:44 +00:00
|
|
|
import frappe
|
|
|
|
|
|
|
|
def execute():
|
2015-09-24 09:31:27 +00:00
|
|
|
frappe.reload_doc("stock", "doctype", "price_list_country")
|
2015-09-24 09:52:12 +00:00
|
|
|
frappe.reload_doc("accounts", "doctype", "shipping_rule_country")
|
2015-09-24 09:29:06 +00:00
|
|
|
frappe.reload_doctype("Price List")
|
|
|
|
frappe.reload_doctype("Shipping Rule")
|
2016-09-20 11:18:05 +00:00
|
|
|
frappe.reload_doctype("shopping_cart", "doctype", "shopping_cart_settings")
|
2015-09-24 09:29:06 +00:00
|
|
|
|
2015-09-17 12:59:44 +00:00
|
|
|
# for price list
|
|
|
|
countries = frappe.db.sql_list("select name from tabCountry")
|
|
|
|
|
|
|
|
for doctype in ("Price List", "Shipping Rule"):
|
|
|
|
for at in frappe.db.sql("""select name, parent, territory from `tabApplicable Territory` where
|
|
|
|
parenttype = %s """, doctype, as_dict=True):
|
|
|
|
if at.territory in countries:
|
|
|
|
parent = frappe.get_doc(doctype, at.parent)
|
|
|
|
if not parent.countries:
|
|
|
|
parent.append("countries", {"country": at.territory})
|
|
|
|
parent.save()
|
|
|
|
|
|
|
|
|
|
|
|
frappe.delete_doc("DocType", "Applicable Territory")
|