Browse Source

code formatting for fFeedback, installation, login, model download n model hit reports

master
administrator 11 months ago
parent
commit
19e2630899
  1. 49
      smart_service/add_ons/report/feedback_report/feedback_report.py
  2. 36
      smart_service/add_ons/report/installation_report/installation_report.py
  3. 63
      smart_service/add_ons/report/login_report/login_report.py
  4. 35
      smart_service/add_ons/report/model_download_report/model_download_report.py
  5. 62
      smart_service/add_ons/report/model_hit_report/model_hit_report.py

49
smart_service/add_ons/report/feedback_report/feedback_report.py

@ -3,7 +3,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cstr, cint, getdate
from frappe import msgprint, _ from frappe import msgprint, _
import sys import sys
sys.tracebacklimit = 0 sys.tracebacklimit = 0
@ -14,6 +13,7 @@ def execute(filters=None):
data = get_data(filters) data = get_data(filters)
return columns, data return columns, data
def get_data(filters): def get_data(filters):
current_db_name = frappe.conf.get("db_name") current_db_name = frappe.conf.get("db_name")
data = frappe.db.sql("""select uf.name,uf.date,uf.subject,uf.user_name,uf.status,uf.attachments,uf.closure_date,uf.closed_by, data = frappe.db.sql("""select uf.name,uf.date,uf.subject,uf.user_name,uf.status,uf.attachments,uf.closure_date,uf.closed_by,
@ -26,23 +26,38 @@ def get_data(filters):
else: else:
frappe.msgprint('No Data for Selected Filters.') frappe.msgprint('No Data for Selected Filters.')
def get_columns(): def get_columns():
columns = [ columns = [
{"label": _("<b>User ID</b>"), "fieldname": "user_id", "fieldtype":"Data","width": 100}, {"label": _("<b>User ID</b>"), "fieldname": "user_id",
{"label": _("<b>User Name</b>"), "fieldname": "user_name", "fieldtype": "Data", "width": 150}, "fieldtype": "Data", "width": 100},
{"label": _("<b>Date</b>"), "fieldname": "date", "fieldtype": "Date", "width": 100}, {"label": _("<b>User Name</b>"), "fieldname": "user_name",
{"label": _("<b>Feedback ID</b>"), "fieldname": "name", "fieldtype": "Link", "options":"User Feedback","width": 120}, "fieldtype": "Data", "width": 150},
{"label": _("<b>Feedback Type</b>"), "fieldname": "feedback_type", "fieldtype": "Data", "width": 120}, {"label": _("<b>Date</b>"), "fieldname": "date",
{"label": _("<b>Feedback Title</b>"), "fieldname": "subject", "fieldtype": "Data", "width": 120}, "fieldtype": "Date", "width": 100},
{"label": _("<b>Feedback Description</b>"), "fieldname": "description", "fieldtype": "Text Editor", "width": 250}, {"label": _("<b>Feedback ID</b>"), "fieldname": "name",
{"label": _("<b>Attachments</b>"), "fieldname": "attachments", "fieldtype": "Data", "width": 100}, "fieldtype": "Link", "options": "User Feedback", "width": 120},
{"label": _("<b>Feedback Status</b>"), "fieldname": "status", "fieldtype": "Data", "width": 100}, {"label": _("<b>Feedback Type</b>"), "fieldname": "feedback_type",
{"label": _("<b>Zone</b>"), "fieldname": "zone", "fieldtype": "Data", "width": 100}, "fieldtype": "Data", "width": 120},
{"label": _("<b>Area Office</b>"), "fieldname": "area", "fieldtype": "Data", "width": 140}, {"label": _("<b>Feedback Title</b>"), "fieldname": "subject",
{"label": _("<b>Dealer Code</b>"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 120}, "fieldtype": "Data", "width": 120},
{"label": _("<b>Dealer Name</b>"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 150}, {"label": _("<b>Feedback Description</b>"), "fieldname": "description",
{"label": _("<b>Closure Date</b>"), "fieldname": "closure_date", "fieldtype": "Data", "width": 150}, "fieldtype": "Text Editor", "width": 250},
{"label": _("<b>Closed By</b>"), "fieldname": "closed_by", "fieldtype": "Data", "width": 120} {"label": _("<b>Attachments</b>"), "fieldname": "attachments",
"fieldtype": "Data", "width": 100},
{"label": _("<b>Feedback Status</b>"), "fieldname": "status",
"fieldtype": "Data", "width": 100},
{"label": _("<b>Zone</b>"), "fieldname": "zone",
"fieldtype": "Data", "width": 100},
{"label": _("<b>Area Office</b>"), "fieldname": "area",
"fieldtype": "Data", "width": 140},
{"label": _("<b>Dealer Code</b>"), "fieldname": "dealer_code",
"fieldtype": "Data", "width": 120},
{"label": _("<b>Dealer Name</b>"), "fieldname": "dealer_name",
"fieldtype": "Data", "width": 150},
{"label": _("<b>Closure Date</b>"), "fieldname": "closure_date",
"fieldtype": "Data", "width": 150},
{"label": _("<b>Closed By</b>"), "fieldname": "closed_by",
"fieldtype": "Data", "width": 120}
] ]
return columns return columns

36
smart_service/add_ons/report/installation_report/installation_report.py

@ -5,15 +5,16 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cstr, cint, getdate
from frappe import msgprint, _ from frappe import msgprint, _
def execute(filters=None): def execute(filters=None):
columns, data = [], [] columns, data = [], []
columns = get_columns() columns = get_columns()
data = get_data(filters) data = get_data(filters)
return columns, data return columns, data
def get_data(filters): def get_data(filters):
current_db_name = frappe.conf.get("db_name") current_db_name = frappe.conf.get("db_name")
data = frappe.db.sql("""select dealer.zone,au.user_id,concat_ws(' ',au.first_name,au.last_name) as user_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version, data = frappe.db.sql("""select dealer.zone,au.user_id,concat_ws(' ',au.first_name,au.last_name) as user_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version,
@ -31,16 +32,27 @@ def get_data(filters):
def get_columns(): def get_columns():
columns = [ columns = [
{"label": _("<b>User ID</b>"), "fieldname": "user_id", "fieldtype": "Data", "width": 100}, {"label": _("<b>User ID</b>"), "fieldname": "user_id",
{"label": _("<b>User Name</b>"), "fieldname": "user_name", "fieldtype": "Data", "width": 150}, "fieldtype": "Data", "width": 100},
{"label": _("<b>Installation</b>"), "fieldname": "device", "fieldtype": "Data","width": 100}, {"label": _("<b>User Name</b>"), "fieldname": "user_name",
{"label": _("<b>App Version No</b>"), "fieldname": "app_current_version", "fieldtype": "Data", "width": 150}, "fieldtype": "Data", "width": 150},
{"label": _("<b>Activity Type</b>"), "fieldname": "type", "fieldtype": "Data","width": 150}, {"label": _("<b>Installation</b>"), "fieldname": "device",
{"label": _("<b>Device</b>"), "fieldname": "device_type", "fieldtype": "Data","width": 100}, "fieldtype": "Data", "width": 100},
{"label": _("<b>Device ID</b>"), "fieldname": "device_id", "fieldtype": "Data", "width": 150}, {"label": _("<b>App Version No</b>"), "fieldname": "app_current_version",
{"label": _("<b>Device OS</b>"), "fieldname": "os", "fieldtype": "Data", "width": 100}, "fieldtype": "Data", "width": 150},
{"label": _("<b>OS Version</b>"), "fieldname": "os_version", "fieldtype": "Data", "width": 100}, {"label": _("<b>Activity Type</b>"), "fieldname": "type",
{"label": _("<b>App Installation Date</b>"), "fieldname": "date_time_stamp", "fieldtype": "DateTime","width": 200}, "fieldtype": "Data", "width": 150},
{"label": _("<b>App Last Accessed Date</b>"), "fieldname": "date", "fieldtype": "DateTime","width": 200} {"label": _("<b>Device</b>"), "fieldname": "device_type",
"fieldtype": "Data", "width": 100},
{"label": _("<b>Device ID</b>"), "fieldname": "device_id",
"fieldtype": "Data", "width": 150},
{"label": _("<b>Device OS</b>"), "fieldname": "os",
"fieldtype": "Data", "width": 100},
{"label": _("<b>OS Version</b>"), "fieldname": "os_version",
"fieldtype": "Data", "width": 100},
{"label": _("<b>App Installation Date</b>"),
"fieldname": "date_time_stamp", "fieldtype": "DateTime", "width": 200},
{"label": _("<b>App Last Accessed Date</b>"),
"fieldname": "date", "fieldtype": "DateTime", "width": 200}
] ]
return columns return columns

63
smart_service/add_ons/report/login_report/login_report.py

@ -3,12 +3,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cstr, cint, getdate
from frappe import msgprint, _ from frappe import msgprint, _
from frappe.utils import cstr, flt, cint,TIME_FORMAT,DATE_FORMAT,DATETIME_FORMAT, now_datetime
from datetime import date, time, datetime, timedelta
from frappe.utils import now
import datetime
def execute(filters=None): def execute(filters=None):
columns, data = [], [] columns, data = [], []
@ -16,19 +12,11 @@ def execute(filters=None):
data = get_data(filters) data = get_data(filters)
return columns, data return columns, data
def get_data(filters): def get_data(filters):
current_db_name = frappe.conf.get("db_name") current_db_name = frappe.conf.get("db_name")
from_date = filters.get('from_date') from_date = filters.get('from_date')
to_date = filters.get('to_date') to_date = filters.get('to_date')
data_test = frappe.db.sql("""select count(al.name) as count,dealer.zone,au.user_id,concat_ws(' ',au.first_name,au.last_name) as user_name,
dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version,
ad.device_type,ad.device_id,ad.app_current_version,al.type,al.latitude,al.longitude,al.date_time_stamp,al.creation,
date(al.date_time_stamp) as date,time(ad.last_login) as time
from {0}.`tabApp Log` al,{0}.`tabApp Device` ad,{0}.`tabApp Users` au,{0}.`tabApp Dealer` dealer
where
al.device = ad.name and al.user = au.name and au.dealer = dealer.name and al.type = 'Logged in' and
(date(al.modified) between '{1}' and '{2}') group by al.user,ad.device_id,date(al.date_time_stamp)""".format(current_db_name,from_date,to_date), as_dict=1)
data = frappe.db.sql("""select dealer.zone,au.user_id,concat_ws(' ',au.first_name,au.last_name) as user_name, data = frappe.db.sql("""select dealer.zone,au.user_id,concat_ws(' ',au.first_name,au.last_name) as user_name,
dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version, dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version,
@ -47,35 +35,26 @@ def get_data(filters):
else: else:
frappe.msgprint('No Data for Selected Filters.') frappe.msgprint('No Data for Selected Filters.')
def get_columns(): def get_columns():
columns = [ columns = [
{"label": _("<b>User ID</b>"), "fieldname": "user_id", "fieldtype": "Data", "width": 150}, {"label": _("<b>User ID</b>"), "fieldname": "user_id",
{"label": _("<b>User Name</b>"), "fieldname": "user_name", "fieldtype": "Data", "width": 150}, "fieldtype": "Data", "width": 150},
{"label": _("<b>Date</b>"), "fieldname": "date", "fieldtype": "Date", "width": 100}, {"label": _("<b>User Name</b>"), "fieldname": "user_name",
{"label": _("<b>Time</b>"), "fieldname": "last_login_time", "fieldtype": "DateTime", "width": 130}, "fieldtype": "Data", "width": 150},
{"label": _("<b>Count</b>"), "fieldname": "count", "fieldtype": "Data", "width": 100}, {"label": _("<b>Date</b>"), "fieldname": "date",
{"label": _("<b>Device ID</b>"), "fieldname": "device_id", "fieldtype": "Data", "width": 100}, "fieldtype": "Date", "width": 100},
{"label": _("<b>Device</b>"), "fieldname": "device_type", "fieldtype": "Data", "width": 130}, {"label": _("<b>Time</b>"), "fieldname": "last_login_time",
{"label": _("<b>Latitude</b>"), "fieldname": "latitude", "fieldtype": "Data", "width": 100}, "fieldtype": "DateTime", "width": 130},
{"label": _("<b>Longitude</b>"), "fieldname": "longitude", "fieldtype": "Data", "width": 100} {"label": _("<b>Count</b>"), "fieldname": "count",
"fieldtype": "Data", "width": 100},
{"label": _("<b>Device ID</b>"), "fieldname": "device_id",
"fieldtype": "Data", "width": 100},
{"label": _("<b>Device</b>"), "fieldname": "device_type",
"fieldtype": "Data", "width": 130},
{"label": _("<b>Latitude</b>"), "fieldname": "latitude",
"fieldtype": "Data", "width": 100},
{"label": _("<b>Longitude</b>"), "fieldname": "longitude",
"fieldtype": "Data", "width": 100}
] ]
return columns return columns
# def get_columns():
# columns = [
# {"label": _("<b>Date</b>"), "fieldname": "date", "fieldtype": "Date", "width": 100},
# {"label": _("<b>Time</b>"), "fieldname": "last_login_time", "fieldtype": "DateTime", "width": 130},
# {"label": _("<b>Zone</b>"), "fieldname": "zone", "fieldtype": "Data", "width": 100},
# {"label": _("<b>Area Office</b>"), "fieldname": "area", "fieldtype": "Data", "width": 100},
# {"label": _("<b>Dealer Code</b>"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 150},
# {"label": _("<b>Dealer Name</b>"), "fieldname": "dealer_name", "fieldtype":"Data","width": 150},
# {"label": _("<b>Device</b>"), "fieldname": "device_type", "fieldtype": "Data", "width": 100},
# {"label": _("<b>Device ID</b>"), "fieldname": "device_id", "fieldtype": "Data", "width": 150},
# {"label": _("<b>User ID</b>"), "fieldname": "user_id", "fieldtype": "Data", "width": 150},
# {"label": _("<b>User Name</b>"), "fieldname": "user_name", "fieldtype": "Data", "width": 100},
# {"label": _("<b>Latitude</b>"), "fieldname": "latitude", "fieldtype": "Data", "width": 100},
# {"label": _("<b>Longitude</b>"), "fieldname": "longitude", "fieldtype": "Data", "width": 100},
# {"label": _("<b>Count</b>"), "fieldname": "count", "fieldtype": "Data", "width": 100},
# ]
# return columns

35
smart_service/add_ons/report/model_download_report/model_download_report.py

@ -3,12 +3,12 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cstr, cint, getdate
from frappe import msgprint, _ from frappe import msgprint, _
import datetime
current_db_name = frappe.conf.get("db_name") current_db_name = frappe.conf.get("db_name")
def execute(filters=None): def execute(filters=None):
columns, data = [], [] columns, data = [], []
columns = get_columns() columns = get_columns()
@ -34,7 +34,8 @@ def get_data(filters):
d['download_vehicle_id'] = modelfilter d['download_vehicle_id'] = modelfilter
if d['user_id']: if d['user_id']:
try: try:
dealer_info=frappe.db.sql("""SELECT dealer FROM {0}.`tabApp Users` where user_id='{1}';""".format(current_db_name, d['user_id']), as_dict=1) dealer_info = frappe.db.sql("""SELECT dealer FROM {0}.`tabApp Users` where user_id='{1}';""".format(
current_db_name, d['user_id']), as_dict=1)
dealer_info = dealer_info[-1]['dealer'] dealer_info = dealer_info[-1]['dealer']
dealer_details = frappe.db.sql("""SELECT dealer_name,dealer_code,area as location,zone FROM {0}.`tabApp Dealer` dealer_details = frappe.db.sql("""SELECT dealer_name,dealer_code,area as location,zone FROM {0}.`tabApp Dealer`
where name='{1}';""".format(current_db_name, dealer_info), as_dict=1) where name='{1}';""".format(current_db_name, dealer_info), as_dict=1)
@ -51,22 +52,30 @@ def get_data(filters):
frappe.msgprint('No Data for Selected Filters.') frappe.msgprint('No Data for Selected Filters.')
def get_columns(): def get_columns():
columns = [ columns = [
{"label": _("<b>Date</b>"), "fieldname": "date", "fieldtype": "Date", "width": 150}, {"label": _("<b>Date</b>"), "fieldname": "date",
{"label": _("<b>User ID</b>"), "fieldname": "login_name", "fieldtype": "Data", "width": 125}, "fieldtype": "Date", "width": 150},
{"label": _("<b>User Name</b>"), "fieldname": "user_name", "fieldtype": "Data", "width": 125}, {"label": _("<b>User ID</b>"), "fieldname": "login_name",
{"label": _("<b>Downloaded Vehicle</b>"), "fieldname": "download_vehicle_id", "fieldtype": "Data", "width": 150}, "fieldtype": "Data", "width": 125},
{"label": _("<b>Downloaded Language</b>"), "fieldname": "download_vehicle_language_id", "fieldtype": "Data", "width": 150}, {"label": _("<b>User Name</b>"), "fieldname": "user_name",
{"label": _("<b>Downloaded Version</b>"), "fieldname": "download_vehicle_current_version", "fieldtype": "Data", "width": 150}, "fieldtype": "Data", "width": 125},
{"label": _("<b>App Version</b>"), "fieldname": "app_version", "fieldtype": "Data", "width": 150}, {"label": _("<b>Downloaded Vehicle</b>"),
"fieldname": "download_vehicle_id", "fieldtype": "Data", "width": 150},
{"label": _("<b>Downloaded Language</b>"),
"fieldname": "download_vehicle_language_id", "fieldtype": "Data", "width": 150},
{"label": _("<b>Downloaded Version</b>"),
"fieldname": "download_vehicle_current_version", "fieldtype": "Data", "width": 150},
{"label": _("<b>App Version</b>"), "fieldname": "app_version",
"fieldtype": "Data", "width": 150},
# {"label": _("<b>Zone</b>"), "fieldname": "zone", "fieldtype": "Data", "width": 100}, # {"label": _("<b>Zone</b>"), "fieldname": "zone", "fieldtype": "Data", "width": 100},
# {"label": _("<b>Area Office</b>"), "fieldname": "area", "fieldtype": "Data", "width": 150}, # {"label": _("<b>Area Office</b>"), "fieldname": "area", "fieldtype": "Data", "width": 150},
# {"label": _("<b>Dealer Code</b>"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 150}, # {"label": _("<b>Dealer Code</b>"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 150},
# {"label": _("<b>Dealer Name</b>"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 150}, # {"label": _("<b>Dealer Name</b>"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 150},
{"label": _("<b>Device</b>"), "fieldname": "device_id", "fieldtype": "Data", "width": 150}, {"label": _("<b>Device</b>"), "fieldname": "device_id",
{"label": _("<b>Device Type</b>"), "fieldname": "device_type", "fieldtype": "Data", "width": 150} "fieldtype": "Data", "width": 150},
{"label": _("<b>Device Type</b>"), "fieldname": "device_type",
"fieldtype": "Data", "width": 150}
] ]
return columns return columns

62
smart_service/add_ons/report/model_hit_report/model_hit_report.py

@ -4,14 +4,13 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cstr, cint, getdate
from frappe import msgprint, _ from frappe import msgprint, _
import datetime import datetime
current_db_name = frappe.conf.get("db_name") current_db_name = frappe.conf.get("db_name")
def execute(filters=None): def execute(filters=None):
columns, data = [], [] columns, data = [], []
columns = get_columns() columns = get_columns()
@ -37,9 +36,11 @@ def get_data(filters):
for d in data: for d in data:
if d['user_id']: if d['user_id']:
try: try:
dealer_info=frappe.db.sql("""SELECT dealer FROM {0}.`tabApp Users` where user_id='{1}';""".format(current_db_name, d['user_id']), as_dict=1) dealer_info = frappe.db.sql("""SELECT dealer FROM {0}.`tabApp Users` where user_id='{1}';""".format(
current_db_name, d['user_id']), as_dict=1)
dealer_info = dealer_info[-1]['dealer'] dealer_info = dealer_info[-1]['dealer']
dealer_details=frappe.db.sql("""SELECT dealer_name,dealer_code,area as location,zone FROM {0}.`tabApp Dealer` where name='{1}';""".format(current_db_name, dealer_info), as_dict=1) dealer_details = frappe.db.sql("""SELECT dealer_name,dealer_code,area as location,zone FROM {0}.`tabApp Dealer` where name='{1}';""".format(
current_db_name, dealer_info), as_dict=1)
dealer_details = dealer_details[-1] dealer_details = dealer_details[-1]
d['dealer_code'] = dealer_details['dealer_code'] d['dealer_code'] = dealer_details['dealer_code']
d['dealer_name'] = dealer_details['dealer_name'] d['dealer_name'] = dealer_details['dealer_name']
@ -67,9 +68,11 @@ def get_data(filters):
for d in data: for d in data:
if d['user_id']: if d['user_id']:
try: try:
dealer_info=frappe.db.sql("""SELECT dealer FROM {0}.`tabApp Users` where user_id='{1}';""".format(current_db_name, d['user_id']), as_dict=1) dealer_info = frappe.db.sql("""SELECT dealer FROM {0}.`tabApp Users` where user_id='{1}';""".format(
current_db_name, d['user_id']), as_dict=1)
dealer_info = dealer_info[-1]['dealer'] dealer_info = dealer_info[-1]['dealer']
dealer_details=frappe.db.sql("""SELECT dealer_name,dealer_code,area as location,zone FROM {0}.`tabApp Dealer` where name='{1}';""".format(current_db_name, dealer_info), as_dict=1) dealer_details = frappe.db.sql("""SELECT dealer_name,dealer_code,area as location,zone FROM {0}.`tabApp Dealer` where name='{1}';""".format(
current_db_name, dealer_info), as_dict=1)
dealer_details = dealer_details[-1] dealer_details = dealer_details[-1]
d['dealer_code'] = dealer_details['dealer_code'] d['dealer_code'] = dealer_details['dealer_code']
d['dealer_name'] = dealer_details['dealer_name'] d['dealer_name'] = dealer_details['dealer_name']
@ -83,7 +86,6 @@ def get_data(filters):
else: else:
frappe.msgprint('No Data for Selected Filters.') frappe.msgprint('No Data for Selected Filters.')
elif filters.get('variant'): elif filters.get('variant'):
from_date = filters['from_date'] from_date = filters['from_date']
to_date = filters['to_date'] to_date = filters['to_date']
@ -102,7 +104,8 @@ def get_data(filters):
for d in data: for d in data:
if d['user_id']: if d['user_id']:
try: try:
dealer_info=frappe.db.sql("""SELECT dealer FROM {0}.`tabApp Users` where user_id='{1}';""".format(current_db_name, d['user_id']), as_dict=1) dealer_info = frappe.db.sql("""SELECT dealer FROM {0}.`tabApp Users` where user_id='{1}';""".format(
current_db_name, d['user_id']), as_dict=1)
dealer_info = dealer_info[-1]['dealer'] dealer_info = dealer_info[-1]['dealer']
dealer_details = frappe.db.sql("""SELECT dealer_name,dealer_code,area as location,zone FROM {0}.`tabApp Dealer` dealer_details = frappe.db.sql("""SELECT dealer_name,dealer_code,area as location,zone FROM {0}.`tabApp Dealer`
where name='{1}';""".format(current_db_name, dealer_info), as_dict=1) where name='{1}';""".format(current_db_name, dealer_info), as_dict=1)
@ -122,31 +125,46 @@ def get_data(filters):
def get_columns(): def get_columns():
columns = [ columns = [
{"label": _("<b>Date</b>"), "fieldname": "date", "fieldtype": "Date", "width": 150}, {"label": _("<b>Date</b>"), "fieldname": "date",
"fieldtype": "Date", "width": 150},
# {"label": _("<b>User ID</b>"), "fieldname": "login_name", "fieldtype": "Data", "width": 125}, # {"label": _("<b>User ID</b>"), "fieldname": "login_name", "fieldtype": "Data", "width": 125},
# {"label": _("<b>User Name</b>"), "fieldname": "user_name", "fieldtype": "Data", "width": 125}, # {"label": _("<b>User Name</b>"), "fieldname": "user_name", "fieldtype": "Data", "width": 125},
{"label": _("<b>Model</b>"), "fieldname": "vehicle_id", "fieldtype": "Data", "width": 150}, {"label": _("<b>Model</b>"), "fieldname": "vehicle_id",
{"label": _("<b>Variant Mapping</b>"), "fieldname": "variant_mapping_id", "fieldtype": "Data", "width": 150}, "fieldtype": "Data", "width": 150},
{"label": _("<b>Variant</b>"), "fieldname": "variant_id", "fieldtype": "Data", "width": 80}, {"label": _("<b>Variant Mapping</b>"), "fieldname": "variant_mapping_id",
{"label": _("<b>Module</b>"), "fieldname": "module_id", "fieldtype": "Data", "width": 150}, "fieldtype": "Data", "width": 150},
{"label": _("<b>System</b>"), "fieldname": "system_id", "fieldtype": "Data", "width": 150}, {"label": _("<b>Variant</b>"), "fieldname": "variant_id",
{"label": _("<b>Sub System</b>"), "fieldname": "sub_system_id", "fieldtype": "Data", "width": 150}, "fieldtype": "Data", "width": 80},
{"label": _("<b>Procedure</b>"), "fieldname": "procedure_id", "fieldtype": "Data", "width": 150}, {"label": _("<b>Module</b>"), "fieldname": "module_id",
{"label": _("<b>Steps</b>"), "fieldname": "steps_id", "fieldtype": "Data", "width": 150}, "fieldtype": "Data", "width": 150},
{"label": _("<b>Language</b>"), "fieldname": "language", "fieldtype": "Data", "width": 80}, {"label": _("<b>System</b>"), "fieldname": "system_id",
{"label": _("<b>Count</b>"), "fieldname": "count", "fieldtype": "Data", "width": 80}, "fieldtype": "Data", "width": 150},
{"label": _("<b>Sub System</b>"), "fieldname": "sub_system_id",
"fieldtype": "Data", "width": 150},
{"label": _("<b>Procedure</b>"), "fieldname": "procedure_id",
"fieldtype": "Data", "width": 150},
{"label": _("<b>Steps</b>"), "fieldname": "steps_id",
"fieldtype": "Data", "width": 150},
{"label": _("<b>Language</b>"), "fieldname": "language",
"fieldtype": "Data", "width": 80},
{"label": _("<b>Count</b>"), "fieldname": "count",
"fieldtype": "Data", "width": 80},
# {"label": _("<b>Zone</b>"), "fieldname": "zone", "fieldtype": "Data", "width": 150}, # {"label": _("<b>Zone</b>"), "fieldname": "zone", "fieldtype": "Data", "width": 150},
# {"label": _("<b>Area Office</b>"), "fieldname": "area", "fieldtype": "Data", "width": 150}, # {"label": _("<b>Area Office</b>"), "fieldname": "area", "fieldtype": "Data", "width": 150},
# {"label": _("<b>Dealer Code</b>"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 150}, # {"label": _("<b>Dealer Code</b>"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 150},
# {"label": _("<b>Dealer Name</b>"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 150}, # {"label": _("<b>Dealer Name</b>"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 150},
{"label": _("<b>Device</b>"), "fieldname": "device_id", "fieldtype": "Data", "width": 150}, {"label": _("<b>Device</b>"), "fieldname": "device_id",
{"label": _("<b>Device Type</b>"), "fieldname": "device_type", "fieldtype": "Data", "width": 150} "fieldtype": "Data", "width": 150},
{"label": _("<b>Device Type</b>"), "fieldname": "device_type",
"fieldtype": "Data", "width": 150}
] ]
return columns return columns
@frappe.whitelist() @frappe.whitelist()
def variant(doctype, txt, searchfield, start, page_len, filters): def variant(doctype, txt, searchfield, start, page_len, filters):
model = filters.get('name') model = filters.get('name')
variant = frappe.db.sql("""select name from `tabVariant` where name like %s""",model+'%',as_list=True) variant = frappe.db.sql(
"""select name from `tabVariant` where name like %s""", model+'%', as_list=True)
return variant return variant
Loading…
Cancel
Save