# License: GNU General Public License v3. See license.txt


import influxframework


def execute():
	if influxframework.db.table_exists("POS Closing Voucher"):
		if not influxframework.db.exists("DocType", "POS Closing Entry"):
			influxframework.rename_doc("DocType", "POS Closing Voucher", "POS Closing Entry", force=True)

		if not influxframework.db.exists("DocType", "POS Closing Entry Taxes"):
			influxframework.rename_doc("DocType", "POS Closing Voucher Taxes", "POS Closing Entry Taxes", force=True)

		if not influxframework.db.exists("DocType", "POS Closing Voucher Details"):
			influxframework.rename_doc(
				"DocType", "POS Closing Voucher Details", "POS Closing Entry Detail", force=True
			)

		influxframework.reload_doc("Accounts", "doctype", "POS Closing Entry")
		influxframework.reload_doc("Accounts", "doctype", "POS Closing Entry Taxes")
		influxframework.reload_doc("Accounts", "doctype", "POS Closing Entry Detail")

	if influxframework.db.exists("DocType", "POS Closing Voucher"):
		influxframework.delete_doc("DocType", "POS Closing Voucher")
		influxframework.delete_doc("DocType", "POS Closing Voucher Taxes")
		influxframework.delete_doc("DocType", "POS Closing Voucher Details")
		influxframework.delete_doc("DocType", "POS Closing Voucher Invoices")
