hns
3 years ago
156 changed files with 1922 additions and 2492 deletions
Binary file not shown.
Binary file not shown.
@ -1,8 +1,14 @@ |
|||||
# Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors |
# Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors |
||||
# For license information, please see license.txt |
# For license information, please see license.txt |
||||
|
|
||||
# import frappe |
import frappe |
||||
from frappe.model.document import Document |
from frappe.model.document import Document |
||||
|
|
||||
class UserFeedback(Document): |
class UserFeedback(Document): |
||||
pass |
def validate(self): |
||||
|
pass |
||||
|
def onload(self): |
||||
|
attach = frappe.db.sql("""select count(name) as count from `tabFile` where attached_to_name = %s""",self.name,as_dict=True) |
||||
|
for x in attach: |
||||
|
frappe.db.sql("""update `tabUser Feedback` set attachments = %s where name = %s""",(x.count,self.name),as_dict=True) |
||||
|
frappe.db.commit() |
||||
|
Binary file not shown.
Binary file not shown.
@ -1,8 +1,47 @@ |
|||||
# Copyright (c) 2022, Hard n Soft Technologies Pvt Ltd and contributors |
# Copyright (c) 2013, Hard n Soft Technologies Pvt Ltd and contributors |
||||
# For license information, please see license.txt |
# For license information, please see license.txt |
||||
|
|
||||
# import frappe |
from __future__ import unicode_literals |
||||
|
import frappe |
||||
|
from frappe.utils import cstr, cint, getdate |
||||
|
from frappe import msgprint, _ |
||||
|
|
||||
def execute(filters=None): |
def execute(filters=None): |
||||
columns, data = [], [] |
columns, data = [], [] |
||||
|
columns = get_columns() |
||||
|
data = get_data(filters) |
||||
return columns, data |
return columns, data |
||||
|
|
||||
|
def get_data(filters): |
||||
|
data = frappe.db.sql("""select uf.name,uf.date,uf.subject,uf.user_name,uf.status,uf.attachments,uf.closure_date,uf.closed_by, |
||||
|
uf.description,uf.feedback_type,dealer.dealer_code,dealer.zone,dealer.dealer_name,uf.closure_date,uf.closed_by, |
||||
|
dealer.area,au.user_id,au.first_name from `tabUser Feedback` uf,`tabApp Dealer` dealer,`tabApp Users` au |
||||
|
where uf.user_name = au.name and |
||||
|
(uf.modified between %s and %s) group by uf.name""",(filters.get('from_date'), filters.get('to_date')), as_dict=1) |
||||
|
#frappe.throw("DATA" + str(data)) |
||||
|
if data: |
||||
|
return data |
||||
|
else: |
||||
|
frappe.msgprint('No Data for Selected Filters.') |
||||
|
|
||||
|
def get_columns(): |
||||
|
columns = [ |
||||
|
{"label": _("Date"), "fieldname": "date", "fieldtype": "Date", "width": 100}, |
||||
|
{"label": _("Feedback ID"), "fieldname": "name", "fieldtype": "Link", "options":"User Feedback","width": 120}, |
||||
|
{"label": _("Feedback Type"), "fieldname": "feedback_type", "fieldtype": "Data", "width": 120}, |
||||
|
{"label": _("Feedback Title"), "fieldname": "subject", "fieldtype": "Data", "width": 120}, |
||||
|
{"label": _("Feedback Description"), "fieldname": "description", "fieldtype": "Text Editor", "width": 250}, |
||||
|
{"label": _("Attachments"), "fieldname": "attachments", "fieldtype": "Data", "width": 100}, |
||||
|
{"label": _("Feedback Status"), "fieldname": "status", "fieldtype": "Data", "width": 100}, |
||||
|
{"label": _("User ID"), "fieldname": "user_id", "fieldtype":"Data","width": 100}, |
||||
|
{"label": _("User Name"), "fieldname": "first_name", "fieldtype": "Data", "width": 150}, |
||||
|
{"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100}, |
||||
|
{"label": _("Dealer Location"), "fieldname": "area", "fieldtype": "Data", "width": 140}, |
||||
|
{"label": _("Dealer Code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 120}, |
||||
|
{"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 150}, |
||||
|
{"label": _("Closure Date"), "fieldname": "closure_date", "fieldtype": "Data", "width": 150}, |
||||
|
{"label": _("Closed By"), "fieldname": "closed_by", "fieldtype": "Data", "width": 120} |
||||
|
|
||||
|
] |
||||
|
return columns |
||||
|
|
||||
|
Binary file not shown.
@ -1,8 +1,67 @@ |
|||||
# Copyright (c) 2022, Hard n Soft Technologies Pvt Ltd and contributors |
# Copyright (c) 2022, Hard n Soft Technologies Pvt Ltd and contributors |
||||
# For license information, please see license.txt |
# For license information, please see license.txt |
||||
|
|
||||
# import frappe |
from __future__ import unicode_literals |
||||
|
import frappe |
||||
|
from frappe.utils import cstr, cint, getdate |
||||
|
from frappe import msgprint, _ |
||||
|
import datetime |
||||
|
|
||||
|
current_db_name = frappe.conf.get("db_name") |
||||
|
|
||||
def execute(filters=None): |
def execute(filters=None): |
||||
columns, data = [], [] |
columns, data = [], [] |
||||
|
columns = get_columns() |
||||
|
data = get_data(filters) |
||||
return columns, data |
return columns, data |
||||
|
|
||||
|
|
||||
|
def get_data(filters): |
||||
|
if filters.get('model'): |
||||
|
from_date=filters['from_date'] |
||||
|
to_date=filters['to_date'] |
||||
|
modelfilter=filters['model'] |
||||
|
try: |
||||
|
vId=frappe.db.sql("""SELECT myid FROM _d6463952657fa86c.tabVehicle where vehicle='{0}';""".format(modelfilter), as_dict=1) |
||||
|
vId=vId[-1] |
||||
|
vId=vId['myid'] |
||||
|
except: |
||||
|
frappe.msgprint('Vehicle ID Mismatching.') |
||||
|
data = frappe.db.sql("""SELECT date(date) as date, device_id, app_version, download_vehicle_id, download_vehicle_version, download_vehicle_date, download_vehicle_language_id, download_vehicle_current_version, user_id |
||||
|
FROM {0}.`tabModel Hit` WHERE download_vehicle_id='{1}' and (date(date) between '{2}' and '{3}');""".format(current_db_name, vId, from_date, to_date), as_dict=1) |
||||
|
for d in data: |
||||
|
d['download_vehicle_id']=modelfilter |
||||
|
if d['user_id']: |
||||
|
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=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=dealer_details[-1] |
||||
|
d['dealer_code']=dealer_details['dealer_code'] |
||||
|
d['dealer_name']=dealer_details['dealer_name'] |
||||
|
d['area']=dealer_details['location'] |
||||
|
d['zone']=dealer_details['zone'] |
||||
|
except: |
||||
|
pass |
||||
|
if data: |
||||
|
return data |
||||
|
else: |
||||
|
frappe.msgprint('No Data for Selected Filters.') |
||||
|
|
||||
|
|
||||
|
|
||||
|
def get_columns(): |
||||
|
columns = [ |
||||
|
{"label": _("Date"), "fieldname": "date", "fieldtype": "Date", "width": 100}, |
||||
|
{"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100}, |
||||
|
{"label": _("Dealer Location"), "fieldname": "area", "fieldtype": "Data", "width": 150}, |
||||
|
{"label": _("Dealer Code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 150}, |
||||
|
{"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 150}, |
||||
|
{"label": _("Device"), "fieldname": "device_id", "fieldtype": "Data", "width": 100}, |
||||
|
{"label": _("Downloaded Vehicle"), "fieldname": "download_vehicle_id", "fieldtype": "Data", "width": 170}, |
||||
|
{"label": _("Downloaded Version"), "fieldname": "download_vehicle_current_version", "fieldtype": "Data", "width": 250}, |
||||
|
{"label": _("Downloaded Language"), "fieldname": "download_vehicle_language_id", "fieldtype": "Data", "width": 250}, |
||||
|
{"label": _("App Version"), "fieldname": "app_version", "fieldtype": "Data", "width": 150} |
||||
|
|
||||
|
] |
||||
|
return columns |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,41 +0,0 @@ |
|||||
import frappe |
|
||||
from frappe.model.document import Document |
|
||||
import json |
|
||||
import os |
|
||||
|
|
||||
current_db_name = frappe.conf.get("db_name") |
|
||||
|
|
||||
@frappe.whitelist() |
|
||||
def check_vehicle_update(vehicle_list): |
|
||||
Vehicle_req_list = [] |
|
||||
response = {} |
|
||||
v_list = json.loads(vehicle_list) |
|
||||
vehi = v_list['Vehicle'] |
|
||||
iid = v_list['InstallationId'] |
|
||||
vehicle_data = v_list['VehicleReqList'] |
|
||||
publish_type = frappe.db.sql( |
|
||||
'''SELECT publish_type FROM {}.`tabApp Device` where name='{}';'''.format(current_db_name,iid), as_list=True) |
|
||||
|
|
||||
creation_times = [] |
|
||||
publish_list = [] |
|
||||
|
|
||||
if publish_type[0][0] != None: |
|
||||
publish_type = publish_type[0][0] |
|
||||
for v in vehicle_data: |
|
||||
l_id = v['LanguageID'] |
|
||||
current_version = v['CurrentVersion'] |
|
||||
# version_creation_time = frappe.db.sql(''' select creation FROM {}.tabPublish where version = '{}' and language= '{}';'''.format(current_db_name,current_version,l_id)) |
|
||||
# publish_data = frappe.db.sql('''select name,version from {}.tabPublish where vehicle= '{}' and language='{}' and version > {} and publish_type= '{}' and vehicle_status = 'Active';''' |
|
||||
# .format(current_db_name,v,l_id,current_version,l_id),as_dict=True) |
|
||||
|
|
||||
publish_data = frappe.db.sql(''' select name,version from {}.tabPublish where vehicle= '{}' and language='{}' and version > {} and publish_type= '{}' and vehicle_status = 'Active'; |
|
||||
'''.format(current_db_name,vehi,l_id,current_version,publish_type),as_dict= True) |
|
||||
# for d in publish_data: |
|
||||
|
|
||||
publish_list.append(publish_data) |
|
||||
|
|
||||
|
|
||||
return publish_list |
|
||||
|
|
||||
|
|
||||
|
|
@ -1,24 +1,24 @@ |
|||||
import frappe |
import frappe |
||||
from frappe.model.document import Document |
from frappe.model.document import Document |
||||
import json |
import json |
||||
|
import os |
||||
|
from frappe.utils import cstr |
||||
|
|
||||
current_db_name = frappe.conf.get("db_name") |
current_db_name = frappe.conf.get("db_name") |
||||
|
|
||||
|
site_name = cstr(frappe.local.site) |
||||
|
base_url = os.path.expanduser("~") + "/frappe-bench/sites/"+site_name+"/public" |
||||
|
|
||||
|
|
||||
@frappe.whitelist() |
@frappe.whitelist() |
||||
def get_technical_manual(args): |
def get_technical_manual(args): |
||||
# request = json.loads(args) |
|
||||
# vehicle=request["Vehicle"] |
|
||||
# variant = request["Variant"] |
|
||||
# fuel = request["Fuel"] |
|
||||
# transmission = request["Transmission"] |
|
||||
# drive = request["Drive"] |
|
||||
# key_dict = frappe.db.sql('''SELECT name as variantkey, vehicle, variant, fuel, transmission, drive FROM _d6463952657fa86c.`tabVariant Mapping` where vehicle='{0}' and variant='{1}' and fuel='{2}' and transmission='{3}' and drive='{4}';'''.format(vehicle,variant,fuel,transmission,drive), as_dict=True) |
|
||||
# key_dict=key_dict[0] |
|
||||
# variantkey=key_dict['variantkey'] |
|
||||
manual_out=frappe.db.sql('''SELECT parent as variant, language, attach_file as file, active_status FROM {1}.`tabVariant Mapping_Assets` where parent='{0}' and category='Technical Manual' and parentfield = 'assets';'''.format(args,current_db_name), as_dict=True) |
manual_out=frappe.db.sql('''SELECT parent as variant, language, attach_file as file, active_status FROM {1}.`tabVariant Mapping_Assets` where parent='{0}' and category='Technical Manual' and parentfield = 'assets';'''.format(args,current_db_name), as_dict=True) |
||||
|
|
||||
for i in manual_out: |
for i in manual_out: |
||||
if i["active_status"] == "Active": |
file_size = os.path.getsize(base_url+i['file']) |
||||
i["active_status"] = True |
i['file_size']=file_size |
||||
else: |
if i["active_status"] == "Active": |
||||
i["active_status"] = False |
i["active_status"] = True |
||||
|
else: |
||||
|
i["active_status"] = False |
||||
return manual_out |
return manual_out |
@ -0,0 +1,43 @@ |
|||||
|
[ |
||||
|
{ |
||||
|
|
||||
|
"allow_on_submit": 0, |
||||
|
"bold": 0, |
||||
|
"collapsible": 0, |
||||
|
"collapsible_depends_on": null, |
||||
|
"columns": 0, |
||||
|
"default": null, |
||||
|
"depends_on": null, |
||||
|
"description": null, |
||||
|
"docstatus": 0, |
||||
|
"doctype": "Custom Field", |
||||
|
"dt": "User", |
||||
|
"fetch_from": null, |
||||
|
"fieldname": "pwd", |
||||
|
"fieldtype": "Data", |
||||
|
"hidden": 0, |
||||
|
"ignore_user_permissions": 0, |
||||
|
"ignore_xss_filter": 0, |
||||
|
"in_global_search": 0, |
||||
|
"in_list_view": 0, |
||||
|
"in_standard_filter": 0, |
||||
|
"insert_after": "new_password", |
||||
|
"label": "PWD", |
||||
|
"name": "User-pwd", |
||||
|
"no_copy": 0, |
||||
|
"options": "", |
||||
|
"permlevel": 0, |
||||
|
"precision": "", |
||||
|
"print_hide": 0, |
||||
|
"print_hide_if_no_value": 0, |
||||
|
"print_width": null, |
||||
|
"read_only": 0, |
||||
|
"report_hide": 0, |
||||
|
"reqd": 0, |
||||
|
"search_index": 0, |
||||
|
"translatable": 0, |
||||
|
"unique": 0, |
||||
|
"width": null |
||||
|
|
||||
|
} |
||||
|
] |
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue