Update Territory & Customer Group across all transaction (#13004)

* added method for update query based on changes

* patch added

* updated function, moved util function
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index e21da22..df795fc 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -490,3 +490,4 @@
 erpnext.patches.v10_0.update_sales_order_link_to_purchase_order
 erpnext.patches.v10_0.added_extra_gst_custom_field_in_gstr2 #2018-02-13
 erpnext.patches.v10_0.set_b2c_limit
+erpnext.patches.v10_0.update_territory_and_customer_group