Browse Source

System mapping special character issue fix

master
venkataakhil 1 year ago
parent
commit
4c2863b65d
  1. 35
      smart_service/transactions/doctype/system_mapping/system_mapping.py

35
smart_service/transactions/doctype/system_mapping/system_mapping.py

@ -6,7 +6,7 @@ from frappe.model.document import Document
current_db_name = frappe.conf.get("db_name")
import sys
sys.tracebacklimit=0
import re
class SystemMapping(Document):
@ -38,6 +38,39 @@ class SystemMapping(Document):
# self.km_active_status = status.active_status
def validate(self):
if self.system_sub_systems:
for x in self.get("system_sub_systems"):
if x.procedure:
res_str = re.sub("–", "", x.procedure)
res_str = re.sub("–", "", x.procedure)
res_str = re.sub("—", "", res_str)
res_str = re.sub("‘", "", res_str)
res_str = re.sub("’", "", res_str)
res_str = re.sub("“", "", res_str)
res_str = re.sub("”", "", res_str)
res_str = re.sub("Â", "", res_str)
x.procedure = res_str
if x.systems:
res_str = re.sub("–", "", x.systems)
res_str = re.sub("—", "", res_str)
res_str = re.sub("‘", "", res_str)
res_str = re.sub("’", "", res_str)
res_str = re.sub("“", "", res_str)
res_str = re.sub("”", "", res_str)
res_str = re.sub("Â", "", res_str)
x.systems = res_str
if x.sub_systems:
res_str = re.sub("–", "", x.sub_systems)
res_str = re.sub("—", "", res_str)
res_str = re.sub("‘", "", res_str)
res_str = re.sub("’", "", res_str)
res_str = re.sub("“", "", res_str)
res_str = re.sub("”", "", res_str)
res_str = re.sub("Â", "", res_str)
x.sub_systems = res_str
###On creation of System Mapping to create Kilometer Mapping record
km = frappe.db.sql("""select name from {0}.`tabKilometer Mapping` where variant_mapping = "{1}" and language = "{2}";""".format(current_db_name,self.variant_mapping,self.language),as_list=True)

Loading…
Cancel
Save