Browse Source

kilometer mapping duplicate values restricted

master
Ubuntu 3 years ago
parent
commit
b80b7e8973
  1. 4
      smart_service/apis/publish_api.py
  2. 8
      smart_service/fixtures/client_script.json
  3. 8
      smart_service/masters/doctype/transmission/transmission.py
  4. 8
      smart_service/masters/doctype/vehicle/vehicle.py
  5. 19
      smart_service/transactions/doctype/kilometer_mapping_items/kilometer_mapping_items.json

4
smart_service/apis/publish_api.py

@ -154,10 +154,10 @@ def json_grouping(args, language):
proc_details = frappe.db.sql('''select procedure_name, step_name, content_type, GROUP_CONCAT(content) as content, GROUP_CONCAT(file) as file,GROUP_CONCAT(DISTINCT idx order by idx) as display_order, idx from {}.tabProcedure_Details
where parent ='{}' group by procedure_name,step_name,content_type,content order by idx asc; '''.format(
current_db_name, k['procedure_link']), as_dict=True)
temp_data = get_parent_map(
proc_data = get_parent_map(
proc_details, 'procedure_name')
k['Procedure_details'] = temp_data
k['Procedure_details'] = proc_data
subsys['procedure_status'] = k['procedure_status']
subsys['procedure_link'] = k['procedure_link']
subsys['Procedure_details'] = k['Procedure_details']

8
smart_service/fixtures/client_script.json

File diff suppressed because one or more lines are too long

8
smart_service/masters/doctype/transmission/transmission.py

@ -1,8 +1,14 @@
# Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors
# For license information, please see license.txt
# import frappe
import frappe
from frappe.model.document import Document
class Transmission(Document):
pass
@frappe.whitelist()
def validate_text(language,source_text,translated_text):
current_db_name = frappe.conf.get("db_name")
tr_record = frappe.db.sql("""select name from {0}.`tabTranslation` where language = '{1}' and source_text = '{2}' and translated_text = '{3}'""".format(current_db_name,language,source_text,translated_text))
if tr_record:
return tr_record

8
smart_service/masters/doctype/vehicle/vehicle.py

@ -27,7 +27,7 @@ def update_km_mapping(doc,vehicle,type,skm_initial):
sub_systems.kilometer = str(skm_initial)
sub_systems.mat = sub_system.mat
sub_systems.sub_systems = sub_system.sub_systems
sub_systems.applicable = "1"
# sub_systems.applicable = "1"
kilometer_mapping.save()
###Delete kilometer mapping item depends on kilometer and mat
if type == "Deleted":
@ -35,8 +35,10 @@ def update_km_mapping(doc,vehicle,type,skm_initial):
if system_mapping_name:
system_mapping = frappe.get_doc("System Mapping",system_mapping_name)
if system_mapping:
for sub_system in system_mapping.get("system_sub_systems"):
frappe.db.sql("""delete from `tabKilometer Mapping_Items` where parent = %s and sub_systems=%s and mat=%s and kilometer=%s""",(kilometer_mapping.name,str(sub_system.sub_systems),str(sub_system.mat),str(skm_initial)),as_dict=True)
kilometer_mapping = frappe.get_doc("Kilometer Mapping",system_mapping.kilometer_mapping)
if kilometer_mapping:
for sub_system in system_mapping.get("system_sub_systems"):
frappe.db.sql("""delete from `tabKilometer Mapping_Items` where parent = %s and sub_systems=%s and mat=%s and kilometer=%s""",(kilometer_mapping.name,str(sub_system.sub_systems),str(sub_system.mat),str(skm_initial)),as_dict=True)
@frappe.whitelist()
def vehicle_filter(doctype, txt, searchfield, start, page_len, filters):

19
smart_service/transactions/doctype/kilometer_mapping_items/kilometer_mapping_items.json

@ -7,8 +7,10 @@
"field_order": [
"kilometer",
"mat",
"systems",
"sub_systems",
"applicable"
"applicable",
"row_name"
],
"fields": [
{
@ -39,12 +41,25 @@
"fieldtype": "Check",
"in_list_view": 1,
"label": "Applicable "
},
{
"fieldname": "systems",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Systems",
"read_only": 1
},
{
"fieldname": "row_name",
"fieldtype": "Data",
"hidden": 1,
"label": "Row Name"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2022-03-01 12:45:05.104388",
"modified": "2022-04-23 10:15:25.073732",
"modified_by": "Administrator",
"module": "Transactions",
"name": "Kilometer Mapping_Items",

Loading…
Cancel
Save