import frappe


def execute():
	"""Rename counterparty_type values from 'Kapital Bank Customer/Supplier' to 'Customer/Supplier'.
	The counterparty values (KB registry names) are no longer valid for the new Dynamic Link target,
	so they are cleared."""
	frappe.db.sql("""
		UPDATE `tabKapital Bank Transaction Mapping`
		SET counterparty_type = 'Customer', counterparty = NULL
		WHERE counterparty_type = 'Kapital Bank Customer'
	""")
	frappe.db.sql("""
		UPDATE `tabKapital Bank Transaction Mapping`
		SET counterparty_type = 'Supplier', counterparty = NULL
		WHERE counterparty_type = 'Kapital Bank Supplier'
	""")
	frappe.db.commit()
