@ -14,10 +15,9 @@ class KilometerMapping(Document):
forxinself.get("config_kilometer"):
forxinself.get("config_kilometer"):
idx+=1
idx+=1
x.idx=idx
x.idx=idx
@frappe.whitelist()
@frappe.whitelist()
defget_system(doc):
defget_system(doc):
current_db_name=frappe.conf.get("db_name")
system_map=frappe.db.sql("""select name from {0}.`tabSystem Mapping` where variant_mapping='{1}'""".format(current_db_name,doc),as_dict=True)
system_map=frappe.db.sql("""select name from {0}.`tabSystem Mapping` where variant_mapping='{1}'""".format(current_db_name,doc),as_dict=True)
ifsystem_map:
ifsystem_map:
forsinsystem_map:
forsinsystem_map:
@ -36,6 +36,22 @@ def get_subsystem(doc):
returnsub_system
returnsub_system
@frappe.whitelist()
defupdate_duplicate_km(doc,kilometer):
km=frappe.get_doc("Kilometer Mapping",doc)
output=frappe.db.sql("""select kilometer,mat,sub_systems,row_name from `tabKilometer Mapping_Items` where parent = '{0}' and kilometer = '{1}' order by kilometer""".format(doc,kilometer),as_dict=True)
# def km_filter(parent = None , record = None, km = None):
# if record == "All":
# km_filters = frappe.db.sql(f"""select * from `tabKilometer Mapping_Items` where parent ="{parent}" order by length(kilometer),kilometer;""",as_dict = 1)
# else:
# km_filters =frappe.db.sql(f"""select * from `tabKilometer Mapping_Items` where parent ="{parent}" and kilometer ="{km}" order by length(kilometer),kilometer """,as_dict = 1)