fix(patch): Delete all documents from Hub Node module

This commit is contained in:
Nabin Hait 2018-09-06 18:53:31 +05:30
parent b892cc8b02
commit 4fd1cebf95
4 changed files with 18 additions and 3 deletions

View File

@ -505,4 +505,4 @@ erpnext.patches.v10_0.update_status_in_purchase_receipt
erpnext.patches.v10_0.update_address_template_for_india erpnext.patches.v10_0.update_address_template_for_india
erpnext.patches.v10_0.set_discount_amount erpnext.patches.v10_0.set_discount_amount
erpnext.patches.v10_0.recalculate_gross_margin_for_project erpnext.patches.v10_0.recalculate_gross_margin_for_project
execute:frappe.delete_doc("Page", "hub", ignore_missing=True) erpnext.patches.v10_0.delete_hub_documents

View File

@ -0,0 +1,17 @@
import frappe
from frappe.model.utils.rename_field import rename_field
def execute():
for dt, dn in (("Page", "Hub"), ("DocType", "Hub Settings"), ("DocType", "Hub Category")):
frappe.delete_doc(dt, dn, ignore_missing=True)
data_migration_plans = frappe.get_all("Data Migration Plan", filters={"module": 'Hub Node'})
for plan in data_migration_plans:
plan_doc = frappe.get_doc("Data Migration Plan", plan.name)
for m in plan_doc.get("mappings"):
frappe.delete_doc("Data Migration Mapping", m.mapping, force=True)
frappe.delete_doc("Data Migration Plan", plan.name)
frappe.delete_doc("Module Def", "Hub Node", ignore_missing=True)

View File

@ -7,7 +7,6 @@ from erpnext.setup.doctype.company.company import install_country_fixtures
def execute(): def execute():
frappe.reload_doc("accounts", "doctype", "account") frappe.reload_doc("accounts", "doctype", "account")
frappe.reload_doc("hub_node", "doctype", "hub_category")
frappe.reload_doc("accounts", "doctype", "payment_schedule") frappe.reload_doc("accounts", "doctype", "payment_schedule")
for d in frappe.get_all('Company', for d in frappe.get_all('Company',
filters={'country': ('in', ['Saudi Arabia', 'United Arab Emirates'])}): filters={'country': ('in', ['Saudi Arabia', 'United Arab Emirates'])}):

View File

@ -4,7 +4,6 @@ from frappe.email import sendmail_to_system_managers
def execute(): def execute():
frappe.reload_doc('stock', 'doctype', 'item') frappe.reload_doc('stock', 'doctype', 'item')
frappe.reload_doc("stock", "doctype", "customs_tariff_number") frappe.reload_doc("stock", "doctype", "customs_tariff_number")
frappe.reload_doc("hub_node", "doctype", "hub_category")
frappe.reload_doc("accounts", "doctype", "payment_terms_template") frappe.reload_doc("accounts", "doctype", "payment_terms_template")
frappe.reload_doc("accounts", "doctype", "payment_schedule") frappe.reload_doc("accounts", "doctype", "payment_schedule")