# last_fullupdate_file = frappe.db.sql(""" SELECT vehicle,language,format(version,2) as version,modified,publish_type FROM tabPublish where vehicle = "{}"
# and publish_type = "Internal" AND `language` = "{}" order by modified desc limit 2 ;""".format(vehicle, language), as_dict=1)
data1_global=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
data1=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
data=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
publish_dec=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
# and publish_status='Published' and publish_type='Global' and vehicle_status='Active' and version = '{}' and publish_module='Automotive System'
# order by version ASC;'''.format(v_id, lang, data1_global[0]['version']), as_dict=1)
data=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and
publish_dec=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
'''SELECT publish_type FROM `tabApp Device` where name='{}';'''.format(iid),as_list=1)
ifpublish_type[0][0]isnotNone:
ifvehicle_data:
forvinvehicle_data:
v_id=v['Vehicle']
current_version=float(v[CUR_VERSION])
data1_global=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
data1=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
data=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
publish_dec=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
# and publish_status='Published' and publish_type='Global' and vehicle_status='Active' and version = '{}' and publish_module='Automotive System'
# order by version ASC;'''.format(v_id, lang, data1_global[0]['version']), as_dict=1)
# if current_version < float(data1[0]['version']):
# data = frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and
# language='{}' and publish_status='Published' and publish_type='{}' and vehicle_status='Active' and version > '{}' and publish_module='Automotive System'
# order by version ASC;'''.format(v_id, lang, publish_type[0][0], current_version), as_dict=1)
# publish_dec = frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
# and publish_status='Published' and publish_type='Global' and vehicle_status='Active' and version ='{}' and publish_module='Automotive System'
# order by version ASC;'''.format(v_id, lang, data1[0]['version']), as_dict=1)
# return data
data_append=[]
rd=[]
try:
fordindata:
d[UPDATE_AVAILABLE]='true'
d[CUR_VERSION]=float(
current_version)
data_append.append(d)
vehicle_req_list.append(data_append)
except:
pass
elifpublish_type[0][0]=="Internal":
frappe.log_error(str('check_ful_internal'))
ifcurrent_version==float(data1[0]['version']):
data1[0][UPDATE_AVAILABLE]="false"
vehicle_req_list.append(data1)
else:
ifcurrent_version<float(data1[0]['version']):
data=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
publish_dec=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
# and publish_status='Published' and publish_type='Internal' and vehicle_status='Active' and version = '{}' and publish_module='Automotive System'
# order by version ASC;'''.format(v_id, lang, data1_global[0]['version']), as_dict=1)
elifcurrent_version==float(data1[0]['version']):
ifcurrent_version<float(data1[0]['version']):
data=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and
publish_dec=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
data1_global=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language FROM `tabPublish` where vehicle='{}' and language='{}'
data1_global=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where
data=frappe.db.sql('''SELECT name as Name,format(max(version),2) as Version,vehicle_id as Vehicle,language as Language,release_description as description FROM `tabPublish`
data=frappe.db.sql('''SELECT name as Name,format(max(version),2) as Version,vehicle_id as Vehicle,language as Language,release_descriptionas description
data=frappe.db.sql('''SELECT name as Name,format(max(version),2) as Version,vehicle_id as Vehicle,language as Language,release_description as description FROM `tabPublish`
data=frappe.db.sql('''SELECT name as Name,format(max(version),2) as Version,vehicle_id as Vehicle,language as Language FROM `tabPublish`
frappe.log_error(str('internal update'))
data=frappe.db.sql('''SELECT name as Name,format(max(version),2) as Version,vehicle_id as Vehicle,language as Language,release_description as description FROM `tabPublish`
data1_global=frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where
data=frappe.db.sql('''SELECT name as Name,format(max(version),2) as Version,vehicle_id as Vehicle,language as Language,release_description as description FROM `tabPublish`
data=frappe.db.sql('''SELECT name as Name,format(max(version),2) as Version,vehicle_id as Vehicle,language as Language,release_description as description
data=frappe.db.sql('''SELECT name as Name,format(max(version),2) as Version,vehicle_id as Vehicle,language as Language,release_description as description FROM `tabPublish`
data=frappe.db.sql('''SELECT name as Name,format(max(version),2) as Version,vehicle_id as Vehicle,language as Language,release_description as description FROM `tabPublish`
# if(d.step_name and (d.content_type == 'Heading' or d.content_type == 'Description' or d.content_type == 'Caution' or d.content_type == 'Warning' or d.content_type == 'Notice')):
ifnotd.content:
frappe.throw("Content should not be empty"+str(d.content_type))
frappe.throw(str(d.content_type)+"Content should not be empty")
sub_system=frappe.db.sql("""select sub_systems,mat,idx from {0}.`tabSystem Mapping_Sub System` where parent = '{1}' and procedure_is_published = '0'""".format(current_db_name,s.name),as_dict=True)
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)
ver=frappe.db.sql("""select max(version) from {0}.tabPublish where vehicle = "{1}" and language = "{2}";""".format(
ver=frappe.db.sql("""select max(version) from {0}.tabPublish where vehicle = "{1}" and language = "{2}" and publish_module = "Automotive System";""".format(