Browse Source

internal publish,display order update

master
Ubuntu 3 years ago
parent
commit
2d272b715f
  1. 15
      smart_service/apis/update_validation.py
  2. 2
      smart_service/masters/doctype/vehicle/vehicle.js
  3. 2
      smart_service/masters/doctype/vehicle_segment/vehicle_segment.js

15
smart_service/apis/update_validation.py

@ -3,6 +3,7 @@ from frappe.model.document import Document
import json
import os
from frappe.utils import cstr
import time
current_db_name = frappe.conf.get("db_name")
site_name = cstr(frappe.local.site)
@ -86,6 +87,7 @@ def check_all_vehicle_updates(vehicle_list=None):
@frappe.whitelist()
def check_vehicle_update(vehicle_list=None):
t1 = time.time()
if vehicle_list == None:
return {"status": 0, "error": "Parameter missing: Vehicle List"}
if vehicle_list:
@ -114,11 +116,11 @@ def check_vehicle_update(vehicle_list=None):
current_version = v['CurrentVersion']
if publish_type == 'Internal':
publish_data = frappe.db.sql('''select name,CAST(version AS DECIMAL(10,2)) as version from {}.tabPublish where vehicle= '{}'
and language='{}' and publish_type = '{}' and version > {} and vehicle_status = 'Active';
'''.format(current_db_name, vehicle, l_id, publish_type, current_version), as_dict=True)
and language='{}' and version > {} and vehicle_status = 'Active';
'''.format(current_db_name, vehicle, l_id, current_version), as_dict=True)
else:
publish_data = frappe.db.sql('''select name,version,release_description as description from {}.tabPublish where vehicle= '{}'
and language='{}' and publish_type= '{}' and version > {} and vehicle_status = 'Active'; '''.format(
and language='{}' and publish_type = '{}' and version > {} and vehicle_status = 'Active'; '''.format(
current_db_name, vehicle, l_id, publish_type,
current_version), as_dict=True)
@ -310,10 +312,13 @@ def check_vehicle_update(vehicle_list=None):
outfile.write(json.dumps(dicfinal))
file_size = os.path.getsize(base_url + file_name)
res['JsonURL'] = file_name
res['FileSize'] = file_size
res['Error'] = None
t2 = time.time()
res['time'] = t2-t1
except:
res['JsonURL'] = None
res['FileSize'] = None
@ -324,6 +329,8 @@ def check_vehicle_update(vehicle_list=None):
Vehicle_req_list.append(
{'Language': l_id, 'IsUpdateAvailable': 'false', 'CurrentVersion': float(current_version)})
response['Vehicle'] = vehicle
response['VehicleReqList'] = Vehicle_req_list
return response

2
smart_service/masters/doctype/vehicle/vehicle.js

@ -102,7 +102,7 @@ frappe.ui.form.on('Vehicle', {
}
}
if (frm.doc.display_order && frm.doc.vehicle && frm.doc.vehicle_segment) {
if (frm.doc.display_order && frm.doc.vehicle && frm.doc.vehicle_segment && !frm.is_new()) {
//*** check if there is same display_order
frappe.db.get_list('Vehicle', {
fields: ['display_order', 'name'],

2
smart_service/masters/doctype/vehicle_segment/vehicle_segment.js

@ -61,7 +61,7 @@ frappe.ui.form.on('Vehicle Segment', {
}
}
}
if (frm.doc.display_order && frm.doc.vehicle_segment){
if (frm.doc.display_order && frm.doc.vehicle_segment && !frm.is_new()){
//***check if there is same display_order
frappe.db.get_list('Vehicle Segment', {
fields: ['display_order', 'name'],

Loading…
Cancel
Save