Browse Source

saftyupdate

master
hns 3 years ago
parent
commit
c36a822056
  1. BIN
      smart_service/__pycache__/hooks.cpython-38.pyc
  2. 13
      smart_service/add_ons/doctype/app_dealer/app_dealer.json
  3. 13
      smart_service/add_ons/doctype/app_device/app_device.json
  4. 13
      smart_service/add_ons/doctype/app_log/app_log.json
  5. 13
      smart_service/add_ons/doctype/app_preference/app_preference.json
  6. 43
      smart_service/add_ons/doctype/app_users/app_users.json
  7. 13
      smart_service/add_ons/doctype/application_menu/application_menu.json
  8. 42
      smart_service/add_ons/doctype/bookmark/bookmark.json
  9. 13
      smart_service/add_ons/doctype/circular/circular.json
  10. 13
      smart_service/add_ons/doctype/model_hit/model_hit.json
  11. 27
      smart_service/add_ons/doctype/model_usage/model_usage.json
  12. 13
      smart_service/add_ons/doctype/teknet_group/teknet_group.json
  13. 13
      smart_service/add_ons/doctype/teknet_module/teknet_module.json
  14. BIN
      smart_service/add_ons/doctype/user_feedback/__pycache__/user_feedback.cpython-38.pyc
  15. 12
      smart_service/add_ons/doctype/user_feedback/user_feedback.js
  16. 59
      smart_service/add_ons/doctype/user_feedback/user_feedback.json
  17. 10
      smart_service/add_ons/doctype/user_feedback/user_feedback.py
  18. 13
      smart_service/add_ons/doctype/user_feedback_types/user_feedback_types.json
  19. 11
      smart_service/add_ons/doctype/user_manual/user_manual.json
  20. 5
      smart_service/add_ons/report/_test/_test.json
  21. BIN
      smart_service/add_ons/report/feedback_report/__pycache__/__init__.cpython-38.pyc
  22. BIN
      smart_service/add_ons/report/feedback_report/__pycache__/feedback_report.cpython-38.pyc
  23. 18
      smart_service/add_ons/report/feedback_report/feedback_report.js
  24. 5
      smart_service/add_ons/report/feedback_report/feedback_report.json
  25. 43
      smart_service/add_ons/report/feedback_report/feedback_report.py
  26. BIN
      smart_service/add_ons/report/model_download_report/__pycache__/model_download_report.cpython-38.pyc
  27. 22
      smart_service/add_ons/report/model_download_report/model_download_report.js
  28. 5
      smart_service/add_ons/report/model_download_report/model_download_report.json
  29. 61
      smart_service/add_ons/report/model_download_report/model_download_report.py
  30. BIN
      smart_service/add_ons/report/model_hit_report/__pycache__/model_hit_report.cpython-38.pyc
  31. 25
      smart_service/add_ons/report/model_hit_report/model_hit_report.js
  32. 5
      smart_service/add_ons/report/model_hit_report/model_hit_report.json
  33. 102
      smart_service/add_ons/report/model_hit_report/model_hit_report.py
  34. BIN
      smart_service/add_ons/report/release_report/__pycache__/__init__.cpython-38.pyc
  35. BIN
      smart_service/add_ons/report/release_report/__pycache__/release_report.cpython-38.pyc
  36. BIN
      smart_service/apis/__pycache__/addon_api.cpython-38.pyc
  37. BIN
      smart_service/apis/__pycache__/app_user_login.cpython-38.pyc
  38. BIN
      smart_service/apis/__pycache__/master_api.cpython-38.pyc
  39. BIN
      smart_service/apis/__pycache__/publish_api.cpython-38.pyc
  40. BIN
      smart_service/apis/__pycache__/testPublish.cpython-38.pyc
  41. BIN
      smart_service/apis/__pycache__/transaction_api.cpython-38.pyc
  42. BIN
      smart_service/apis/__pycache__/update_validation.cpython-38.pyc
  43. 185
      smart_service/apis/addon_api.py
  44. 105
      smart_service/apis/app_user_login.py
  45. 21
      smart_service/apis/master_api.py
  46. 174
      smart_service/apis/publish_api.py
  47. 41
      smart_service/apis/testPublish.py
  48. 26
      smart_service/apis/transaction_api.py
  49. 316
      smart_service/apis/update_validation.py
  50. 43
      smart_service/fixtures/custom_field.json
  51. 29
      smart_service/hooks.py
  52. 2
      smart_service/mahindra_smart_service/doctype/release/release.js
  53. 4
      smart_service/mahindra_smart_service/doctype/release/release.py
  54. 1
      smart_service/mahindra_smart_service/report/_applog_translation/_applog_translation.js
  55. 5
      smart_service/mahindra_smart_service/report/_applog_translation/_applog_translation.json
  56. 5
      smart_service/mahindra_smart_service/report/_drive_translation/_drive_translation.js
  57. 8
      smart_service/mahindra_smart_service/report/_drive_translation/_drive_translation.json
  58. 81
      smart_service/mahindra_smart_service/report/_drive_translation/_drive_translation.py
  59. BIN
      smart_service/mahindra_smart_service/report/_file_structure/__pycache__/_file_structure.cpython-38.pyc
  60. 8
      smart_service/mahindra_smart_service/report/_file_structure/_file_structure.js
  61. 40
      smart_service/mahindra_smart_service/report/_file_structure/_file_structure.py
  62. BIN
      smart_service/mahindra_smart_service/report/_fuel_translation/__pycache__/_fuel_translation.cpython-38.pyc
  63. 4
      smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.js
  64. 5
      smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.json
  65. 74
      smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.py
  66. BIN
      smart_service/mahindra_smart_service/report/_procedure_report/__pycache__/_procedure_report.cpython-38.pyc
  67. 75
      smart_service/mahindra_smart_service/report/_procedure_report/_procedure_report.js
  68. 140
      smart_service/mahindra_smart_service/report/_procedure_report/_procedure_report.py
  69. BIN
      smart_service/mahindra_smart_service/report/_sub_systems_translation/__pycache__/_sub_systems_translation.cpython-38.pyc
  70. 3
      smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.js
  71. 5
      smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.json
  72. 78
      smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.py
  73. BIN
      smart_service/mahindra_smart_service/report/_systems_translation/__pycache__/_systems_translation.cpython-38.pyc
  74. 3
      smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.js
  75. 5
      smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.json
  76. 82
      smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.py
  77. BIN
      smart_service/mahindra_smart_service/report/_transmission_translation/__pycache__/_transmission_translation.cpython-38.pyc
  78. 3
      smart_service/mahindra_smart_service/report/_transmission_translation/_transmission_translation.js
  79. 8
      smart_service/mahindra_smart_service/report/_transmission_translation/_transmission_translation.json
  80. 81
      smart_service/mahindra_smart_service/report/_transmission_translation/_transmission_translation.py
  81. BIN
      smart_service/mahindra_smart_service/report/_variant_translation/__pycache__/_variant_translation.cpython-38.pyc
  82. 8
      smart_service/mahindra_smart_service/report/_variant_translation/_variant_translation.json
  83. 80
      smart_service/mahindra_smart_service/report/_variant_translation/_variant_translation.py
  84. BIN
      smart_service/mahindra_smart_service/report/_vehicle_segment_translation/__pycache__/_vehicle_segment_translation.cpython-38.pyc
  85. 5
      smart_service/mahindra_smart_service/report/_vehicle_segment_translation/_vehicle_segment_translation.json
  86. 78
      smart_service/mahindra_smart_service/report/_vehicle_segment_translation/_vehicle_segment_translation.py
  87. BIN
      smart_service/mahindra_smart_service/report/_vehicle_translation/__pycache__/_vehicle_translation.cpython-38.pyc
  88. 3
      smart_service/mahindra_smart_service/report/_vehicle_translation/_vehicle_translation.js
  89. 5
      smart_service/mahindra_smart_service/report/_vehicle_translation/_vehicle_translation.json
  90. 81
      smart_service/mahindra_smart_service/report/_vehicle_translation/_vehicle_translation.py
  91. BIN
      smart_service/mahindra_smart_service/report/installation_report/__pycache__/installation_report.cpython-38.pyc
  92. 16
      smart_service/mahindra_smart_service/report/installation_report/installation_report.js
  93. 5
      smart_service/mahindra_smart_service/report/installation_report/installation_report.json
  94. 58
      smart_service/mahindra_smart_service/report/installation_report/installation_report.py
  95. BIN
      smart_service/mahindra_smart_service/report/login_report/__pycache__/login_report.cpython-38.pyc
  96. 16
      smart_service/mahindra_smart_service/report/login_report/login_report.js
  97. 5
      smart_service/mahindra_smart_service/report/login_report/login_report.json
  98. 53
      smart_service/mahindra_smart_service/report/login_report/login_report.py
  99. 16
      smart_service/masters/doctype/drive/drive.json
  100. 16
      smart_service/masters/doctype/fuel/fuel.json

BIN
smart_service/__pycache__/hooks.cpython-38.pyc

Binary file not shown.

13
smart_service/add_ons/doctype/app_dealer/app_dealer.json

@ -42,7 +42,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-07 15:24:29.839700", "modified": "2022-01-28 12:57:33.359666",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "App Dealer", "name": "App Dealer",
@ -59,17 +59,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

13
smart_service/add_ons/doctype/app_device/app_device.json

@ -70,7 +70,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-07 15:21:49.906593", "modified": "2022-01-28 12:56:52.746692",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "App Device", "name": "App Device",
@ -87,17 +87,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

13
smart_service/add_ons/doctype/app_log/app_log.json

@ -56,7 +56,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-13 12:56:37.716178", "modified": "2022-01-28 12:57:26.348409",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "App Log", "name": "App Log",
@ -73,17 +73,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

13
smart_service/add_ons/doctype/app_preference/app_preference.json

@ -91,7 +91,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-11 11:57:35.291012", "modified": "2022-01-28 12:43:00.846057",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "App Preference", "name": "App Preference",
@ -108,17 +108,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

43
smart_service/add_ons/doctype/app_users/app_users.json

@ -24,22 +24,26 @@
"fieldname": "dealer", "fieldname": "dealer",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Dealer", "label": "Dealer",
"options": "App Dealer" "options": "App Dealer",
"set_only_once": 1
}, },
{ {
"fieldname": "user_id", "fieldname": "user_id",
"fieldtype": "Data", "fieldtype": "Data",
"label": "User ID" "label": "User ID",
"set_only_once": 1
}, },
{ {
"fieldname": "login_name", "fieldname": "login_name",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Login Name" "label": "Login Name",
"set_only_once": 1
}, },
{ {
"fieldname": "user_type", "fieldname": "user_type",
"fieldtype": "Data", "fieldtype": "Data",
"label": "User Type" "label": "User Type",
"set_only_once": 1
}, },
{ {
"fieldname": "column_break_5", "fieldname": "column_break_5",
@ -48,37 +52,43 @@
{ {
"fieldname": "first_name", "fieldname": "first_name",
"fieldtype": "Data", "fieldtype": "Data",
"label": "First Name" "label": "First Name",
"set_only_once": 1
}, },
{ {
"fieldname": "last_name", "fieldname": "last_name",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Last Name" "label": "Last Name",
"set_only_once": 1
}, },
{ {
"fieldname": "skill_id", "fieldname": "skill_id",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Skill ID" "label": "Skill ID",
"set_only_once": 1
}, },
{ {
"fieldname": "skill_name", "fieldname": "skill_name",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Skill Name" "label": "Skill Name",
"set_only_once": 1
}, },
{ {
"fieldname": "email_id", "fieldname": "email_id",
"fieldtype": "Data", "fieldtype": "Data",
"label": "email ID" "label": "email ID",
"set_only_once": 1
}, },
{ {
"fieldname": "active_status", "fieldname": "active_status",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Active Status" "label": "Active Status",
"set_only_once": 1
} }
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-07 15:21:14.132692", "modified": "2022-01-28 12:56:59.183998",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "App Users", "name": "App Users",
@ -95,17 +105,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

13
smart_service/add_ons/doctype/application_menu/application_menu.json

@ -38,7 +38,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-10 17:17:13.447747", "modified": "2022-01-28 12:58:40.400099",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "Application Menu", "name": "Application Menu",
@ -55,17 +55,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

42
smart_service/add_ons/doctype/bookmark/bookmark.json

@ -20,53 +20,62 @@
{ {
"fieldname": "user_id", "fieldname": "user_id",
"fieldtype": "Data", "fieldtype": "Data",
"label": "User ID" "label": "User ID",
"set_only_once": 1
}, },
{ {
"fieldname": "active_status", "fieldname": "active_status",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Active Status", "label": "Active Status",
"options": "Active\nInactive" "options": "Active\nInactive",
"set_only_once": 1
}, },
{ {
"fieldname": "vehicle_segment_id", "fieldname": "vehicle_segment_id",
"fieldtype": "Int", "fieldtype": "Int",
"label": "Vehicle Segment ID" "label": "Vehicle Segment ID",
"set_only_once": 1
}, },
{ {
"fieldname": "vehicle_id", "fieldname": "vehicle_id",
"fieldtype": "Int", "fieldtype": "Int",
"label": "Vehicle ID" "label": "Vehicle ID",
"set_only_once": 1
}, },
{ {
"fieldname": "system_id", "fieldname": "system_id",
"fieldtype": "Int", "fieldtype": "Int",
"label": "System ID" "label": "System ID",
"set_only_once": 1
}, },
{ {
"fieldname": "sub_system_id", "fieldname": "sub_system_id",
"fieldtype": "Int", "fieldtype": "Int",
"label": "Sub System ID" "label": "Sub System ID",
"set_only_once": 1
}, },
{ {
"fieldname": "menu_id", "fieldname": "menu_id",
"fieldtype": "Int", "fieldtype": "Int",
"label": "Menu ID" "label": "Menu ID",
"set_only_once": 1
}, },
{ {
"fieldname": "km_details", "fieldname": "km_details",
"fieldtype": "Data", "fieldtype": "Data",
"label": "KM Details" "label": "KM Details",
"set_only_once": 1
}, },
{ {
"fieldname": "variant_mapping_id", "fieldname": "variant_mapping_id",
"fieldtype": "Int", "fieldtype": "Data",
"label": "Variant Mapping ID" "label": "Variant Mapping ID",
"set_only_once": 1
} }
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-10 15:51:38.605212", "modified": "2022-01-28 12:58:27.121914",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "Bookmark", "name": "Bookmark",
@ -83,17 +92,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

13
smart_service/add_ons/doctype/circular/circular.json

@ -63,7 +63,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2021-11-17 12:44:50.899725", "modified": "2022-01-28 12:44:24.971752",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "Circular", "name": "Circular",
@ -80,17 +80,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Author",
"share": 1,
"write": 1
} }
], ],
"search_fields": "description, status", "search_fields": "description, status",

13
smart_service/add_ons/doctype/model_hit/model_hit.json

@ -65,7 +65,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-13 16:05:28.254820", "modified": "2022-01-28 12:58:06.556118",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "Model Hit", "name": "Model Hit",
@ -82,17 +82,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

27
smart_service/add_ons/doctype/model_usage/model_usage.json

@ -17,7 +17,9 @@
"system_id", "system_id",
"sub_system_id", "sub_system_id",
"procedure_id", "procedure_id",
"steps_id" "steps_id",
"menu_id",
"language"
], ],
"fields": [ "fields": [
{ {
@ -79,11 +81,21 @@
"fieldname": "steps_id", "fieldname": "steps_id",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Steps ID" "label": "Steps ID"
},
{
"fieldname": "menu_id",
"fieldtype": "Data",
"label": "Menu ID"
},
{
"fieldname": "language",
"fieldtype": "Data",
"label": "Language"
} }
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-13 16:07:52.464530", "modified": "2022-01-28 12:58:08.631540",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "Model Usage", "name": "Model Usage",
@ -100,17 +112,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

13
smart_service/add_ons/doctype/teknet_group/teknet_group.json

@ -35,7 +35,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-07 14:16:08.204900", "modified": "2022-01-28 12:56:24.520618",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "Teknet Group", "name": "Teknet Group",
@ -52,17 +52,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

13
smart_service/add_ons/doctype/teknet_module/teknet_module.json

@ -24,7 +24,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-07 14:16:01.110723", "modified": "2022-01-28 12:56:14.758742",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "Teknet Module", "name": "Teknet Module",
@ -41,17 +41,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

BIN
smart_service/add_ons/doctype/user_feedback/__pycache__/user_feedback.cpython-38.pyc

Binary file not shown.

12
smart_service/add_ons/doctype/user_feedback/user_feedback.js

@ -2,7 +2,13 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('User Feedback', { frappe.ui.form.on('User Feedback', {
// refresh: function(frm) { validate: function(frm) {
if(frm.doc.status == "Closed"){
// } frappe.db.get_value('User', {name: frm.doc.modified_by}, 'username' , (r) =>{
cur_frm.set_value("closed_by",r.username);
cur_frm.set_value("closure_date",frm.doc.modified);
cur_frm.refresh_fields();
})
}
}
}); });

59
smart_service/add_ons/doctype/user_feedback/user_feedback.json

@ -1,6 +1,6 @@
{ {
"actions": [], "actions": [],
"autoname": "format:{subject}-{creation}", "autoname": "UF-.#####",
"creation": "2021-11-08 16:59:12.277597", "creation": "2021-11-08 16:59:12.277597",
"doctype": "DocType", "doctype": "DocType",
"editable_grid": 1, "editable_grid": 1,
@ -8,13 +8,15 @@
"field_order": [ "field_order": [
"subject", "subject",
"feedback_type", "feedback_type",
"attachment", "attachments",
"column_break_2", "column_break_2",
"user_name", "user_name",
"status", "status",
"date", "date",
"section_break_8", "section_break_8",
"description" "description",
"closure_date",
"closed_by"
], ],
"fields": [ "fields": [
{ {
@ -22,7 +24,8 @@
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Subject", "label": "Subject",
"reqd": 1 "reqd": 1,
"set_only_once": 1
}, },
{ {
"fieldname": "column_break_2", "fieldname": "column_break_2",
@ -33,7 +36,8 @@
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
"label": "User Name", "label": "User Name",
"options": "App Users" "options": "App Users",
"set_only_once": 1
}, },
{ {
"fieldname": "feedback_type", "fieldname": "feedback_type",
@ -42,7 +46,8 @@
"in_standard_filter": 1, "in_standard_filter": 1,
"label": "Feedback Type", "label": "Feedback Type",
"options": "User Feedback_Types", "options": "User Feedback_Types",
"reqd": 1 "reqd": 1,
"set_only_once": 1
}, },
{ {
"fieldname": "status", "fieldname": "status",
@ -53,11 +58,6 @@
"options": "Open\nClosed\nReopened", "options": "Open\nClosed\nReopened",
"reqd": 1 "reqd": 1
}, },
{
"fieldname": "attachment",
"fieldtype": "Attach",
"label": "Attachment"
},
{ {
"fieldname": "section_break_8", "fieldname": "section_break_8",
"fieldtype": "Section Break" "fieldtype": "Section Break"
@ -65,7 +65,8 @@
{ {
"fieldname": "description", "fieldname": "description",
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"label": "Description" "label": "Description",
"set_only_once": 1
}, },
{ {
"fieldname": "date", "fieldname": "date",
@ -73,12 +74,31 @@
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 1, "in_standard_filter": 1,
"label": "Date", "label": "Date",
"reqd": 1 "reqd": 1,
"set_only_once": 1
},
{
"fieldname": "attachments",
"fieldtype": "Int",
"label": "Attachments",
"read_only": 1
},
{
"fieldname": "closure_date",
"fieldtype": "Datetime",
"label": "Closure Date",
"read_only": 1
},
{
"fieldname": "closed_by",
"fieldtype": "Data",
"label": "Closed By",
"read_only": 1
} }
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-11 18:40:02.666060", "modified": "2022-01-28 12:48:03.045078",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "User Feedback", "name": "User Feedback",
@ -95,17 +115,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Author",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

10
smart_service/add_ons/doctype/user_feedback/user_feedback.py

@ -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()

13
smart_service/add_ons/doctype/user_feedback_types/user_feedback_types.json

@ -27,7 +27,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2021-11-08 17:10:06.584852", "modified": "2022-01-28 12:49:56.113178",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "User Feedback_Types", "name": "User Feedback_Types",
@ -44,17 +44,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Author",
"share": 1,
"write": 1
} }
], ],
"search_fields": "status", "search_fields": "status",

11
smart_service/add_ons/doctype/user_manual/user_manual.json

@ -34,7 +34,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"issingle": 1, "issingle": 1,
"links": [], "links": [],
"modified": "2022-01-07 15:25:49.893509", "modified": "2022-01-28 12:51:43.149442",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "User Manual", "name": "User Manual",
@ -49,15 +49,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"print": 1,
"read": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"sort_field": "modified", "sort_field": "modified",

5
smart_service/add_ons/report/_test/_test.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2022-01-11 21:25:08.833206", "modified": "2022-01-28 15:24:20.212174",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "_Test", "name": "_Test",
@ -21,9 +21,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Admin"
} }
] ]
} }

BIN
smart_service/add_ons/report/feedback_report/__pycache__/__init__.cpython-38.pyc

Binary file not shown.

BIN
smart_service/add_ons/report/feedback_report/__pycache__/feedback_report.cpython-38.pyc

Binary file not shown.

18
smart_service/add_ons/report/feedback_report/feedback_report.js

@ -4,6 +4,24 @@
frappe.query_reports["Feedback Report"] = { frappe.query_reports["Feedback Report"] = {
"filters": [ "filters": [
{
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
default: frappe.datetime.year_start(),
"reqd": 0
},
{
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
default: frappe.datetime.year_end(),
"reqd": 0
},
] ]
}; };

5
smart_service/add_ons/report/feedback_report/feedback_report.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2022-01-18 14:38:51.113640", "modified": "2022-01-28 15:22:37.473617",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "Feedback Report", "name": "Feedback Report",
@ -19,9 +19,6 @@
"report_name": "Feedback Report", "report_name": "Feedback Report",
"report_type": "Script Report", "report_type": "Script Report",
"roles": [ "roles": [
{
"role": "_Admin"
},
{ {
"role": "System Manager" "role": "System Manager"
} }

43
smart_service/add_ons/report/feedback_report/feedback_report.py

@ -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

BIN
smart_service/add_ons/report/model_download_report/__pycache__/model_download_report.cpython-38.pyc

Binary file not shown.

22
smart_service/add_ons/report/model_download_report/model_download_report.js

@ -4,6 +4,28 @@
frappe.query_reports["Model Download Report"] = { frappe.query_reports["Model Download Report"] = {
"filters": [ "filters": [
{
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
default: frappe.datetime.year_start(),
"reqd": 0
},
{
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
default: frappe.datetime.year_end(),
"reqd": 0
},
{
"fieldname":"model",
"label": __("Model"),
"fieldtype": "Link",
"options" : "Vehicle",
"reqd": 0
}
] ]
}; };

5
smart_service/add_ons/report/model_download_report/model_download_report.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2022-01-18 14:37:03.336454", "modified": "2022-01-28 15:22:50.511522",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "Model Download Report", "name": "Model Download Report",
@ -21,9 +21,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Admin"
} }
] ]
} }

61
smart_service/add_ons/report/model_download_report/model_download_report.py

@ -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

BIN
smart_service/add_ons/report/model_hit_report/__pycache__/model_hit_report.cpython-38.pyc

Binary file not shown.

25
smart_service/add_ons/report/model_hit_report/model_hit_report.js

@ -19,19 +19,28 @@ frappe.query_reports["Model Hit Report"] = {
default: frappe.datetime.year_end(), default: frappe.datetime.year_end(),
"reqd": 0 "reqd": 0
}, },
// { {
// "fieldname":"model", "fieldname":"model",
// "label": __("Model"), "label": __("Model"),
// "fieldtype": "Link", "fieldtype": "Link",
// "options" : "Vehicle", "options" : "Vehicle",
// "reqd": 0 "reqd": 0
// }, },
{ {
"fieldname":"variant", "fieldname":"variant",
"label": __("Variant"), "label": __("Variant"),
"fieldtype": "Link", "fieldtype": "Link",
"options" : "Variant", "options" : "Variant",
"reqd": 0 "reqd": 0,
get_query: function(){
var model = frappe.query_report.get_filter_value('model');
return{
"query": "smart_service.add_ons.report.model_hit_report.model_hit_report.variant",
"filters":{
name: model,
}
}
}
} }
] ]

5
smart_service/add_ons/report/model_hit_report/model_hit_report.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2022-01-18 14:36:07.869475", "modified": "2022-01-28 15:23:04.344843",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Add Ons", "module": "Add Ons",
"name": "Model Hit Report", "name": "Model Hit Report",
@ -21,9 +21,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Admin"
} }
] ]
} }

102
smart_service/add_ons/report/model_hit_report/model_hit_report.py

@ -8,6 +8,8 @@ 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):
@ -18,28 +20,101 @@ def execute(filters=None):
def get_data(filters): def get_data(filters):
variantfilter=filters['variant'] if filters.get('variant') and filters.get('model'):
from_date=filters['from_date']
to_date=filters['to_date']
modelfilter=filters['model']
variantfilter=filters['variant']
variantfilter=variantfilter.split(".")
data = frappe.db.sql("""SELECT date as date, device_id, module_id, vehicle_id, variant_id, system_id, sub_system_id, procedure_id, steps_id, count(*) as count, user_id, language
FROM {0}.`tabModel Usage` WHERE vehicle_id='{1}' and variant_id='{2}' and (date(date) between '{3}' and '{4}')
GROUP BY date, user_id, module_id, device_id, vehicle_id, variant_id, variant_mapping_id, system_id, sub_system_id, procedure_id, steps_id, language;""".format(current_db_name, modelfilter, variantfilter[1], from_date, to_date), as_dict=1)
for d in data:
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.')
elif filters.get('model'):
from_date=filters['from_date']
to_date=filters['to_date']
modelfilter=filters['model']
data = frappe.db.sql("""SELECT date as date, device_id, module_id, vehicle_id, variant_id, system_id, sub_system_id, procedure_id, steps_id, count(*) as count, user_id, language
FROM {0}.`tabModel Usage` WHERE vehicle_id='{1}' and (date(date) between '{2}' and '{3}')
GROUP BY date, user_id, module_id, device_id, vehicle_id, variant_id, variant_mapping_id, system_id, sub_system_id, procedure_id, steps_id, language;""".format(current_db_name, modelfilter, from_date, to_date), as_dict=1)
if filters.get('variant'): for d in data:
data = frappe.db.sql("""SELECT date(date) as date, device_id, module_id, vehicle_id, variant_id, system_id, sub_system_id, procedure_id, steps_id, count(*) as count if d['user_id']:
FROM {0}.`tabModel Usage` try:
GROUP BY user_id, device_id, vehicle_id, variant_id, variant_mapping_id, system_id, sub_system_id, procedure_id, steps_id;""".format(current_db_name), 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)
frappe.msgprint(str(filters)) 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: if data:
return data return data
else: else:
frappe.throw('No Data for Selected Filters.') frappe.msgprint('No Data for Selected Filters.')
elif filters.get('variant'):
from_date=filters['from_date']
to_date=filters['to_date']
variantfilter=filters['variant']
variantfilter=variantfilter.split(".")
data = frappe.db.sql("""SELECT date as date, device_id, module_id, vehicle_id, variant_id, system_id, sub_system_id, procedure_id, steps_id, count(*) as count, user_id, language
FROM {0}.`tabModel Usage` WHERE vehicle_id='{1}' and variant_id='{2}' and (date(date) between '{3}' and '{4}')
GROUP BY date, user_id, module_id, device_id, vehicle_id, variant_id, variant_mapping_id, system_id, sub_system_id, procedure_id, steps_id, language;""".format(current_db_name, variantfilter[0], variantfilter[1], from_date, to_date), as_dict=1)
for d in data:
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(): def get_columns():
columns = [ columns = [
{"label": _("Date"), "fieldname": "date", "fieldtype": "Date", "width": 100}, {"label": _("Date"), "fieldname": "date", "fieldtype": "Date", "width": 100},
{"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100},
{"label": _("Dealer Location"), "fieldname": "area", "fieldtype": "Data", "width": 100},
{"label": _("Dealer Code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 100}, {"label": _("Dealer Code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 100},
{"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 100}, {"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 100},
{"label": _("Dealer Location"), "fieldname": "area", "fieldtype": "Data", "width": 100},
{"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100},
{"label": _("Device"), "fieldname": "device_id", "fieldtype": "Data", "width": 100}, {"label": _("Device"), "fieldname": "device_id", "fieldtype": "Data", "width": 100},
{"label": _("Module"), "fieldname": "module_id", "fieldtype": "Data", "width": 150}, {"label": _("Module"), "fieldname": "module_id", "fieldtype": "Data", "width": 150},
{"label": _("Model"), "fieldname": "vehicle_id", "fieldtype": "Data", "width": 100}, {"label": _("Model"), "fieldname": "vehicle_id", "fieldtype": "Data", "width": 100},
@ -48,6 +123,13 @@ def get_columns():
{"label": _("Sub System"), "fieldname": "sub_system_id", "fieldtype": "Data", "width": 100}, {"label": _("Sub System"), "fieldname": "sub_system_id", "fieldtype": "Data", "width": 100},
{"label": _("Procedure"), "fieldname": "procedure_id", "fieldtype": "Data", "width": 100}, {"label": _("Procedure"), "fieldname": "procedure_id", "fieldtype": "Data", "width": 100},
{"label": _("Steps"), "fieldname": "steps_id", "fieldtype": "Data", "width": 100}, {"label": _("Steps"), "fieldname": "steps_id", "fieldtype": "Data", "width": 100},
{"label": _("Language"), "fieldname": "language", "fieldtype": "Data", "width": 100},
{"label": _("Count"), "fieldname": "count", "fieldtype": "Data", "width": 100} {"label": _("Count"), "fieldname": "count", "fieldtype": "Data", "width": 100}
] ]
return columns return columns
@frappe.whitelist()
def variant(doctype,txt,searchfield,start,page_len,filters):
model = filters.get('name')
variant = frappe.db.sql("""select name from `tabVariant` where name like %s""",model+'%',as_list=True)
return variant

BIN
smart_service/add_ons/report/release_report/__pycache__/__init__.cpython-38.pyc

Binary file not shown.

BIN
smart_service/add_ons/report/release_report/__pycache__/release_report.cpython-38.pyc

Binary file not shown.

BIN
smart_service/apis/__pycache__/addon_api.cpython-38.pyc

Binary file not shown.

BIN
smart_service/apis/__pycache__/app_user_login.cpython-38.pyc

Binary file not shown.

BIN
smart_service/apis/__pycache__/master_api.cpython-38.pyc

Binary file not shown.

BIN
smart_service/apis/__pycache__/publish_api.cpython-38.pyc

Binary file not shown.

BIN
smart_service/apis/__pycache__/testPublish.cpython-38.pyc

Binary file not shown.

BIN
smart_service/apis/__pycache__/transaction_api.cpython-38.pyc

Binary file not shown.

BIN
smart_service/apis/__pycache__/update_validation.cpython-38.pyc

Binary file not shown.

185
smart_service/apis/addon_api.py

@ -4,6 +4,7 @@ import json
current_db_name = frappe.conf.get("db_name") current_db_name = frappe.conf.get("db_name")
@frappe.whitelist() @frappe.whitelist()
def addon(args): def addon(args):
if args == "circular": if args == "circular":
@ -24,92 +25,96 @@ def addon(args):
i["status"] = True i["status"] = True
else: else:
i["status"] = False i["status"] = False
elif args == "teknet_group": elif args == "teknet_group":
api = frappe.db.get_list( api = frappe.db.get_list(
"Teknet Group", "Teknet Group",
fields=["name","teknet_group_code", "teknet_group_description", "active_status"], fields=["name", "teknet_group_code",
"teknet_group_description", "active_status"],
) )
for i in api: for i in api:
if i["active_status"] == "Active": if i["active_status"] == "Active":
i["active_status"] = True i["active_status"] = True
else: else:
i["active_status"] = False i["active_status"] = False
elif args == "teknet_module": elif args == "teknet_module":
api = frappe.db.get_list( api = frappe.db.get_list(
"Teknet Module", "Teknet Module",
fields=["name","teknet_module_name", "active_status"], fields=["name", "teknet_module_name", "active_status"],
) )
for i in api: for i in api:
if i["active_status"] == "Active": if i["active_status"] == "Active":
i["active_status"] = True i["active_status"] = True
else: else:
i["active_status"] = False i["active_status"] = False
elif args == "user_manual": elif args == "user_manual":
api = frappe.get_doc('User Manual') api = frappe.get_doc('User Manual')
else: else:
api = "Not found" api = "Not found"
return api return api
@frappe.whitelist() @frappe.whitelist()
def bookmark(args,request): def bookmark(args, request):
if args == "get_bookmark": if args == "get_bookmark":
request = json.loads(request) request = json.loads(request)
usrid = request["UserID"] usrid = request["UserID"]
lsd = request["LSD"] lsd = request["LSD"]
api = frappe.db.get_list( api = frappe.db.get_list(
"Bookmark", "Bookmark",
fields=["name","vehicle_segment_id", "vehicle_id","system_id","sub_system_id","menu_id","km_details","variant_mapping_id"], fields=["name", "vehicle_segment_id", "vehicle_id", "system_id",
filters={"modified": [">", lsd],"user_id":["=",usrid]} "sub_system_id", "menu_id", "km_details", "variant_mapping_id"],
) filters={"modified": [">", lsd], "user_id": ["=", usrid]}
# )
return api return api
if args == "update_bookmark": if args == "update_bookmark":
request = json.loads(request) try:
usrid = request["UserID"] request = json.loads(request)
req = request["Bookmarkdetails"] usrid = request["UserID"]
# bookmark_count=0 req = request["Bookmarkdetails"]
for i in req: # bookmark_count=0
vehicle_seg_id = i["VehicleSegmentID"] for i in req:
vehicle_id = i["VehicleID"] vehicle_seg_id = i["vehicle_segment_id"]
variant_mapping_id = i["VariantMappingID"] vehicle_id = i["vehicle_id"]
system_id = i["SystemID"] variant_mapping_id = i["variant_mapping_id"]
sub_system_id = i["SubSystemID"] system_id = i["system_id"]
menu_id = i["MenuID"] sub_system_id = i["sub_system_id"]
kilometer_details = i["KmDetails"] menu_id = i["menu_id"]
is_deleted = i["IsDeleted"] kilometer_details = i["km_details"]
if is_deleted == False: is_deleted = i["IsDeleted"]
data = frappe.new_doc('Bookmark') if is_deleted == False:
data.user_id=usrid data = frappe.new_doc('Bookmark')
data.active_status='Active' data.user_id = usrid
data.vehicle_segment_id=vehicle_seg_id data.active_status = 'Active'
data.vehicle_id=vehicle_id data.vehicle_segment_id = vehicle_seg_id
data.system_id=system_id data.vehicle_id = vehicle_id
data.sub_system_id=sub_system_id data.system_id = system_id
data.menu_id=menu_id data.sub_system_id = sub_system_id
data.km_details=kilometer_details data.menu_id = menu_id
data.variant_mapping_id=variant_mapping_id data.km_details = kilometer_details
data.insert(ignore_if_duplicate=True) data.variant_mapping_id = variant_mapping_id
data.insert(ignore_if_duplicate=True)
# bookmark_count=bookmark_count+1 elif is_deleted == True:
return "Updated" frappe.delete_doc('Bookmark', i['name'])
# bookmark_count=bookmark_count+1
api = {"isSuccessful": True}
except:
api = {"isSuccessful": False}
return api
@frappe.whitelist()
def feedback(args,request):
@frappe.whitelist()
def feedback(args, request):
if args == "get_user_feedback": if args == "get_user_feedback":
api = frappe.db.get_list( api = frappe.db.get_list(
"User Feedback", "User Feedback",
fields=["name", "status", "feedback_type", "date", "user_name","attachment","description","date"], fields=["name", "status", "feedback_type", "date",
"user_name", "attachment", "description", "date"],
) )
for i in api: for i in api:
if i["status"] == "Active": if i["status"] == "Active":
@ -117,70 +122,72 @@ def feedback(args,request):
else: else:
i["status"] = False i["status"] = False
return api return api
elif args == "post_user_feedback": elif args == "post_user_feedback":
request = json.loads(request) request = json.loads(request)
usr_fdbk = frappe.new_doc('User Feedback') usr_fdbk = frappe.new_doc('User Feedback')
usr_fdbk.subject = request["Subject"] usr_fdbk.subject = request["Subject"]
usr_fdbk.feedback_type= request["FeedbackType"] usr_fdbk.feedback_type = request["FeedbackType"]
user_name = request["UserName"] user_name = request["UserName"]
usr_id = frappe.db.get_value('App Users', {'user_id': user_name }, ['name']) usr_id = frappe.db.get_value(
'App Users', {'user_id': user_name}, ['name'])
usr_fdbk.user_name = usr_id usr_fdbk.user_name = usr_id
usr_fdbk.status = "Open" usr_fdbk.status = "Open"
usr_fdbk.description = request["Description"] usr_fdbk.description = request["Description"]
usr_fdbk.date = request["Date"] usr_fdbk.date = request["Date"]
usr_fdbk.save() usr_fdbk.save()
return usr_fdbk.name return usr_fdbk.name
@frappe.whitelist() @frappe.whitelist()
def model_hit(args,request): def model_hit(args, request):
if args == "model_hit": if args == "model_hit":
try: try:
request=json.loads(request) request = json.loads(request)
UserID=request["UserID"] UserID = request["UserID"]
AppVersion=request["AppVersion"] AppVersion = request["AppVersion"]
DeviceID=request["DeviceID"] DeviceID = request["DeviceID"]
for i in request['VehicleDownloadhits']: for i in request['VehicleDownloadhits']:
model_hit=frappe.new_doc('Model Hit') model_hit = frappe.new_doc('Model Hit')
model_hit.user_id=UserID model_hit.user_id = UserID
model_hit.app_version=AppVersion model_hit.app_version = AppVersion
model_hit.device_id=DeviceID model_hit.device_id = DeviceID
model_hit.date=i['Date'] model_hit.date = i['Date']
model_hit.download_vehicle_id=i['DownloadVehicleID'] model_hit.download_vehicle_id = i['DownloadVehicleID']
model_hit.download_vehicle_version=i['DownloadVehicleVersion'] model_hit.download_vehicle_version = i['DownloadVehicleVersion']
model_hit.download_vehicle_date=i['DownloadVehicleDate'] model_hit.download_vehicle_date = i['DownloadVehicleDate']
model_hit.download_vehicle_language_id=i['DownloadVehicleLanguageID'] model_hit.download_vehicle_language_id = i['DownloadVehicleLanguageID']
model_hit.download_vehicle_current_version=i['DownloadVehicleCurrentVersion'] model_hit.download_vehicle_current_version = i['DownloadVehicleCurrentVersion']
model_hit.save() model_hit.save()
return {"isSuccessful":True} return {"isSuccessful": True}
except: except:
return {"isSuccessful":False} return {"isSuccessful": False}
@frappe.whitelist() @frappe.whitelist()
def model_usage(args,request): def model_usage(args, request):
if args == "model_usage": if args == "model_usage":
try: try:
request=json.loads(request) request = json.loads(request)
UserID=request["UserID"] UserID = request["UserID"]
AppVersion=request["AppVersion"] AppVersion = request["AppVersion"]
DeviceID=request["DeviceID"] DeviceID = request["DeviceID"]
for i in request['ModuleUsagehits']: for i in request['ModuleUsagehits']:
model_usage=frappe.new_doc('Model Usage') model_usage = frappe.new_doc('Model Usage')
model_usage.user_id=UserID model_usage.user_id = UserID
model_usage.app_version=AppVersion model_usage.app_version = AppVersion
model_usage.device_id=DeviceID model_usage.device_id = DeviceID
model_usage.date=i['Date'] model_usage.date = i['Date']
model_usage.module_id=i['ModuleID'] model_usage.module_id = i['ModuleID']
model_usage.vehicle_id=i['VehicleID'] model_usage.vehicle_id = i['VehicleID']
model_usage.variant_id=i['VariantID'] model_usage.variant_id = i['VariantID']
model_usage.variant_mapping_id=i['VariantMappingID'] model_usage.variant_mapping_id = i['VariantMappingID']
model_usage.system_id=i['SystemID'] model_usage.system_id = i['SystemID']
model_usage.sub_system_id=i['SubSystemID'] model_usage.sub_system_id = i['SubSystemID']
model_usage.procedure_id=i['ProcedureID'] model_usage.procedure_id = i['ProcedureID']
model_usage.steps_id=i['StepsID'] model_usage.steps_id = i['StepsID']
model_usage.save() model_usage.menu_id = i['MenuID']
return {"isSuccessful":True} model_usage.language = i['Language']
model_usage.insert(ignore_if_duplicate=True, ignore_mandatory=True)
return {"isSuccessful": True}
except: except:
return {"isSuccessful":False} return {"isSuccessful":False}
# return request

105
smart_service/apis/app_user_login.py

@ -14,7 +14,6 @@ def app_user_validation(usr, pwd):
preference=frappe.get_last_doc('App Preference') preference=frappe.get_last_doc('App Preference')
mahindra_login=preference.mahindra_login_api mahindra_login=preference.mahindra_login_api
technician_login=preference.technician_login_api technician_login=preference.technician_login_api
# return preference
data = {'LoginID': usr, 'Password': pwd} data = {'LoginID': usr, 'Password': pwd}
headers = {"Content-Type": "application/x-www-form-urlencoded"} headers = {"Content-Type": "application/x-www-form-urlencoded"}
if technician_login==1 and mahindra_login==0: if technician_login==1 and mahindra_login==0:
@ -30,10 +29,12 @@ def app_user_validation(usr, pwd):
doc = frappe.get_doc("Fish", None) doc = frappe.get_doc("Fish", None)
tok = doc.apple tok = doc.apple
dicData['token'] = tok dicData['token'] = tok
dicData['status']=1
# return decoded1 # return decoded1
return dicData return dicData
else: else:
return "Invalid Credentials" message_to_send={'status':0,'error':'Invalid Credentials'}
return message_to_send
elif technician_login==0 and mahindra_login==1: elif technician_login==0 and mahindra_login==1:
response1 = requests.post("http://www.mahindramile.com/WindowAuth/Service.asmx/ValidateCredential", data=data, headers=headers) response1 = requests.post("http://www.mahindramile.com/WindowAuth/Service.asmx/ValidateCredential", data=data, headers=headers)
decoded1 = response1.content.decode('utf-8') decoded1 = response1.content.decode('utf-8')
@ -66,38 +67,19 @@ def app_user_validation(usr, pwd):
user_name = None user_name = None
msgDic = {} msgDic = {}
# try:
# success_msg = dictValue['children']['IsSuccessfull']['text']
# user_name = dictValue['children']['UserName']['text']
# except:
# success_msg = node.text
# if success_msg == 1:
# msgDic.update({'UserName': user_name})
# dicdata['FirstName']= user_name
# msgDic.update({'IsSuccessfull': success_msg})
# doc = frappe.get_doc("Fish", None)
# tok = doc.apple
# dicData['token'] = tok
# return dicData
# else:
# msgDic.update({'IsSuccessfull': success_msg})
# return "Invalid Credentials"
# data = {'LoginID': 'klincy-cont', 'Password': 'SmFuIU1haGlAMjI='}
# msgDic = {}
try: try:
msgDic['UserName'] = dictValue['children']['UserName']['text'] msgDic['UserName'] = dictValue['children']['UserName']['text']
msgDic['IsSuccessfull'] = dictValue['children']['IsSuccessfull']['text'] msgDic['IsSuccessfull'] = dictValue['children']['IsSuccessfull']['text']
doc = frappe.get_doc("Fish", None) doc = frappe.get_doc("Fish", None)
tok = doc.apple tok = doc.apple
dicData['token'] = tok dicData['token'] = tok
dicData['status']=1
return dicData return dicData
except: except:
msgDic['IsSuccessfull'] = node.text msgDic['IsSuccessfull'] = node.text
return "Invalid Credentials" message_to_send={'status':0,'error':'Invalid Credentials'}
return message_to_send
elif technician_login==1 and mahindra_login==1: elif technician_login==1 and mahindra_login==1:
response = requests.post( response = requests.post(
@ -112,23 +94,22 @@ def app_user_validation(usr, pwd):
dicData={ dicData={
"ID": "", "ID": "",
"LoginName": usr, "LoginName": usr,
"FirstName": "", "FirstName": usr,
"LastName": "", "LastName": "",
"IsActive": "True", "IsActive": "True",
"UserType": "", "UserType": "Mahindra User",
"SkillID": "", "SkillID": "",
"SkillName": "", "SkillName": "",
"UserTypeDesc": "", "UserTypeDesc": "",
"PasswordChanged": "", "PasswordChanged": "",
"AreaName": "", "AreaName": "Mahindra",
"Zone": "", "Zone": "MAhindra",
"Code": "", "LocationName": "Mahindra",
"LocationName": "",
"ChannelNo": "", "ChannelNo": "",
"ServerDate": "", "ServerDate": "",
"ServerTime": "", "ServerTime": "",
"DealerName": "", "DealerName": "Mahindra",
"EmailId": "{}@email.com".format(usr), "EmailId": "{}@mahindraemail.com".format(usr),
"isLDAPAuthenticated": ""} "isLDAPAuthenticated": ""}
success_msg = None success_msg = None
@ -143,6 +124,7 @@ def app_user_validation(usr, pwd):
doc = frappe.get_doc("Fish", None) doc = frappe.get_doc("Fish", None)
tok = doc.apple tok = doc.apple
dicData['token'] = tok dicData['token'] = tok
dicData['status']=1
return dicData return dicData
else: else:
@ -152,11 +134,14 @@ def app_user_validation(usr, pwd):
doc = frappe.get_doc("Fish", None) doc = frappe.get_doc("Fish", None)
tok = doc.apple tok = doc.apple
dicData['token'] = tok dicData['token'] = tok
dicData['status']=1
return dicData return dicData
except: except:
return "Invalid Credentials" message_to_send={'status':0,'error':'Invalid Credentials'}
return message_to_send
else: else:
return "Login Blocked" message_to_send={'status':0,'error':'Login Blocked'}
return message_to_send
def xml_to_dict(node): def xml_to_dict(node):
@ -167,10 +152,6 @@ def xml_to_dict(node):
@frappe.whitelist() @frappe.whitelist()
def grant_user_access(userdata,iid): def grant_user_access(userdata,iid):
# app_preference=frappe.db.get_last_doc("App Preference", filters={'active':'Active'})
# app_preference=frappe.db.get_list("App Preference", filters={'active':'Active'},fields=['name','application_server_url','update_server_url','asset_url','mahindra_login_api','technician_login_api','remarks','active'])
user_details = {} user_details = {}
userdata = json.loads(userdata) userdata = json.loads(userdata)
user_id=userdata['ID'] user_id=userdata['ID']
@ -233,19 +214,16 @@ def grant_user_access(userdata,iid):
app_user.save() app_user.save()
'''Inserting Device data''' '''Inserting Device data'''
# if frappe.db.exists({'doctype':'App Device','device_id' : device_id}):
if iid=='None' or iid=='null': if iid=='None' or iid=='null':
app_device = frappe.new_doc('App Device') app_device = frappe.new_doc('App Device')
app_device.device_id = device_id app_device.device_id = device_id
app_device.publish_type="Global" app_device.publish_type="Global"
# app_device.user_name = email
# app_device.user_type = user_type_desc
app_device.device_type = device_type app_device.device_type = device_type
app_device.os = os app_device.os = os
app_device.os_version = os_version app_device.os_version = os_version
app_device.app_current_version = app_current_version app_device.app_current_version = app_current_version
app_device.last_login = now() app_device.last_login = now()
app_device.insert(ignore_mandatory=True) app_device.insert(ignore_if_duplicate=True)
if frappe.db.exists({'doctype':'App Device','device_id' : device_id}): if frappe.db.exists({'doctype':'App Device','device_id' : device_id}):
app_user1=frappe.get_last_doc('App Users', filters={"email_id": email}) app_user1=frappe.get_last_doc('App Users', filters={"email_id": email})
@ -257,8 +235,8 @@ def grant_user_access(userdata,iid):
app_logs.latitude = latitude app_logs.latitude = latitude
app_logs.longitude = longitude app_logs.longitude = longitude
app_logs.date_time_stamp = now() app_logs.date_time_stamp = now()
app_logs.save() app_logs.insert()
# return app_user1.name
else: else:
app_user1=frappe.get_last_doc('App Users', filters={"email_id": email}) app_user1=frappe.get_last_doc('App Users', filters={"email_id": email})
app_device1=frappe.get_last_doc('App Device', filters={"device_id": device_id}) app_device1=frappe.get_last_doc('App Device', filters={"device_id": device_id})
@ -270,16 +248,15 @@ def grant_user_access(userdata,iid):
app_logs.longitude = longitude app_logs.longitude = longitude
app_logs.date_time_stamp = now() app_logs.date_time_stamp = now()
app_logs.save() app_logs.save()
# return app_user1.name
else : else :
# app_device = frappe.get_doc('App Device', iid)
frappe.db.sql('''UPDATE {4}.`tabApp Device` set last_logged_in= '{0}', user_name = '{2}', device_type = '{3}' where name = "{1}";'''.format(now(),iid,email,user_type_desc,current_db_name)) frappe.db.sql('''UPDATE {4}.`tabApp Device` set last_logged_in= '{0}', user_name = '{2}', device_type = '{3}' where name = "{1}";'''.format(now(),iid,email,user_type_desc,current_db_name))
frappe.db.commit() frappe.db.commit()
app_user2=frappe.get_last_doc('App Users', filters={"email_id": email})
app_logs = frappe.new_doc('App Log') app_logs = frappe.new_doc('App Log')
app_logs.user = app_user.name app_logs.user = app_user2.name
app_logs.device = iid app_logs.device = iid
app_logs.type = 'Logged in' app_logs.type = 'Logged in'
app_logs.latitude = latitude app_logs.latitude = latitude
@ -289,10 +266,10 @@ def grant_user_access(userdata,iid):
''' create user with role system manager ''' ''' create user with role system manager '''
if frappe.db.exists('User', email): if frappe.db.exists('User', email):
user = frappe.get_doc('User', email) # user = frappe.get_doc('User', email)
token = generate_keys(email) docu = frappe.get_doc("Fish", None)
token = docu.apple
user_details['token'] = token user_details['token'] = token
# user_details['Installation ID'] = frappe.get_doc({'doctype':'App Device','device_id' : device_id}).name
lst= frappe.db.sql('''SELECT name FROM {}.`tabApp Device` where device_id = "{}";'''.format(current_db_name,device_id), as_list=True) lst= frappe.db.sql('''SELECT name FROM {}.`tabApp Device` where device_id = "{}";'''.format(current_db_name,device_id), as_list=True)
lst1= frappe.db.sql('''SELECT name FROM {}.`tabApp Users` where email_id = "{}";'''.format(current_db_name,email), as_list=True) lst1= frappe.db.sql('''SELECT name FROM {}.`tabApp Users` where email_id = "{}";'''.format(current_db_name,email), as_list=True)
try: try:
@ -303,15 +280,16 @@ def grant_user_access(userdata,iid):
return "Login Failure" return "Login Failure"
else: else:
user = frappe.new_doc('User') # user = frappe.new_doc('User')
user.email = email # user.email = email
user.first_name = first_name # user.first_name = first_name
user.send_welcome_email = 0 # user.send_welcome_email = 0
user.user_type = 'Website User' # user.user_type = 'Website User'
user.add_roles('_Admin') # user.add_roles('_AppUser')
user.save() # user.save()
token = generate_keys(email) docu = frappe.get_doc("Fish", None)
token = docu.apple
user_details['token'] = token user_details['token'] = token
lst= frappe.db.sql('''SELECT name FROM {}.`tabApp Device` where device_id = "{}";'''.format(current_db_name,device_id), as_list=True) lst= frappe.db.sql('''SELECT name FROM {}.`tabApp Device` where device_id = "{}";'''.format(current_db_name,device_id), as_list=True)
lst1= frappe.db.sql('''SELECT name FROM {}.`tabApp Users` where email_id = "{}";'''.format(current_db_name,email), as_list=True) lst1= frappe.db.sql('''SELECT name FROM {}.`tabApp Users` where email_id = "{}";'''.format(current_db_name,email), as_list=True)
@ -332,3 +310,12 @@ def generate_keys(user):
user_details.save() user_details.save()
token = user_details.api_key+':'+api_secret token = user_details.api_key+':'+api_secret
return token return token
@frappe.whitelist()
def login_generate_token(doc=None,method=None):
new_tok = generate_keys('cms@guidedsmartservice.com')
water = frappe.get_doc("Fish", None)
water.apple = new_tok
water.save()
return water.apple

21
smart_service/apis/master_api.py

@ -217,6 +217,9 @@ def masters(args, LSD):
elif args == "baseurl": elif args == "baseurl":
api = frappe.utils.get_url() api = frappe.utils.get_url()
else:
api='No such function. Check argument: args'
return api return api
@ -227,24 +230,6 @@ def labels_json():
"""SELECT `tabApp Labels`.name as name,`tabApp Labels`.page_name as menu_type, `tabApp Labels`.english_label as element, `tabApp Labels`.language as lang, `tabApp Labels`.label as label, `tabApp Labels`.parent_app_labels as parent FROM {0}.`tabApp Labels` order by name asc""".format(current_db_name), """SELECT `tabApp Labels`.name as name,`tabApp Labels`.page_name as menu_type, `tabApp Labels`.english_label as element, `tabApp Labels`.language as lang, `tabApp Labels`.label as label, `tabApp Labels`.parent_app_labels as parent FROM {0}.`tabApp Labels` order by name asc""".format(current_db_name),
as_dict=1, as_dict=1,
) )
# final = []
# labels = set()
# for i in labels_lst:
# if i['name'] != None:
# labels.add(i['element'])
# for j in labels:
# temp_lst = []
# temp_dict = []
# for k in labels_lst:
# if j == k['element'] and k['lang'] == 'en':
# temp = k
# elif j == k['element'] and k['lang'] != 'en':
# temp_lst.append(k)
# temp['Translations'] = temp_lst
# temp_dict.append(temp)
# final.append(temp)
# # x = json.dumps(final)
# # frappe.msgprint(str(final))
return labels_lst return labels_lst

174
smart_service/apis/publish_api.py

@ -1,17 +1,19 @@
# Copyright (c) 2021, Hard n Soft Technologies Pvt Ltd and contributors from traceback import FrameSummary
# For license information, please see license.txt
import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document
import json import json
import frappe.utils import frappe.utils
import os
from frappe.utils import cstr
current_db_name = frappe.conf.get("db_name") current_db_name = frappe.conf.get("db_name")
class Publish(Document): class Publish(Document):
pass pass
site_name = cstr(frappe.local.site)
base_url = os.path.expanduser("~") + "/frappe-bench/sites/"+site_name+"/public"
list1 = [] list1 = []
@ -26,29 +28,33 @@ def get_parent_map(input_list, parameter):
for i in parentChildMap[p]: for i in parentChildMap[p]:
del i['procedure_name'] del i['procedure_name']
del i['idx'] del i['idx']
# if i['content_type'] == 'File':
# i['content'] = list(i['content'].split(','))
# i['file'] = [f for f in i['file'].split(',')]
# i['display_order'] = [int(n) for n in i['display_order'].split(',')]
return list1 return list1
@frappe.whitelist() @frappe.whitelist()
def api_procedure(args, vehicle, language, version): def api_procedure(args, vehicle, language, version):
x = json_grouping(args, language) x = json_grouping(args, language)
with open(base_url + "/files/json_files/%s-%s_v%s.json" % (vehicle, language, version), 'w') as f:
# base_url = '/home/frappe_srv_01/frappe-bench/sites/ss.hnsonline.com/public/files' json.dump(x, f)
# with open(base_url + "json_files/%s-%s_v%s.json" % (vehicle, language, version), 'w') as f:
# json.dump(x, f) list1 = frappe.db.sql(
return json.dumps(x) '''SELECT procedure_link, system, sub_system FROM %s.`tabPublish_Docs` WHERE parent='%s'; ''' % (current_db_name, args),
as_dict=True)
for d in list1:
frappe.db.sql(
"""UPDATE %s.`tabSystem Mapping_Sub System` SET procedure_status = '%s', procedure_is_published='1' where procedure_status = '%s' and `tabSystem Mapping_Sub System`.procedure='%s' and systems='%s' and sub_systems='%s' """ % (
current_db_name, 'Published', 'Publish Ready', d['procedure_link'], d['system'], d['sub_system']))
frappe.db.commit()
file_name = "/public/files/json_files/%s-%s_v%s.json" % (vehicle, language, version)
return file_name
def json_grouping(args, language): def json_grouping(args, language):
docs_child = frappe.db.get_list('Publish_Docs', filters={'parent': args, 'procedure_status': 'Publish Ready'}, fields=[ docs_child = frappe.db.get_list('Publish_Docs', filters={'parent': args},
'variant_mapping', 'system', 'sub_system', 'procedure_status', 'procedure_link']) fields=['variant_mapping', 'system', 'sub_system', 'procedure_status','procedure_link'])
# lang = frappe.db.get_list('Publish', filters={'name': args}, fields=['language'])
lang = {'language': language} lang = {'language': language}
variant = set() variant = set()
system = {} system = {}
@ -75,24 +81,23 @@ def json_grouping(args, language):
subsystem[i] = temp_set subsystem[i] = temp_set
final = [] final = []
final_count = {}
count = 0 count = 0
active_status_case = "CASE WHEN active_status = 'Active' THEN 'True' ELSE 'False' END AS active_status" active_status_case = "CASE WHEN active_status = 'Active' THEN 'True' ELSE 'False' END AS active_status"
for d in variant: for d in variant:
variant_out = {} variant_out = {}
# vari = frappe.db.get_list('Variant Mapping', filters={'name': d}, fields=[
# 'name', 'variant', 'vehicle', 'family_code', 'vehicle_segment', 'active_status', 'fuel', 'transmission', 'drive'])
vari = frappe.db.sql('''SELECT name,variant, vehicle,family_code,vehicle_segment,fuel,transmission,drive, active_status vari = frappe.db.sql('''SELECT name,variant, vehicle,family_code,vehicle_segment,fuel,transmission,drive, active_status
FROM %s.`tabVariant Mapping` WHERE name ='%s' ; ''' % (current_db_name,d), as_dict=True) FROM %s.`tabVariant Mapping` WHERE name ='%s' ; ''' % (current_db_name, d),
as_dict=True)
var_asset = frappe.db.sql('''SELECT category, attach_file as file, %s FROM %s.`tabVariant Mapping_Assets` where category<>'Technical Manual' and parent='%s' and language='%s';''' % ( var_asset = frappe.db.sql(
active_status_case, current_db_name, d, lang['language']), as_dict=True) '''SELECT category, attach_file as file, %s FROM %s.`tabVariant Mapping_Assets` where category<>'Technical Manual' and parent='%s' and language='%s';''' % (
active_status_case, current_db_name, d, lang['language']), as_dict=True)
vari = vari[0] vari = vari[0]
if vari['active_status'] == 'Active': if vari['active_status'] == 'Active':
vari['active_status'] = True vari['active_status'] = True
else: else:
vari['active_status'] = False vari['active_status'] = False
@ -102,62 +107,67 @@ def json_grouping(args, language):
for i in system[d]: for i in system[d]:
sys = frappe.db.sql('''SELECT min(`tabSystem Mapping_Sub System`.idx) as systemdisplayorder,tabSystems.system_name,tabSystems.icon_file,tabSystems.myid,tabSystems.active_status sys = frappe.db.sql('''SELECT min(`tabSystem Mapping_Sub System`.idx) as systemdisplayorder,tabSystems.system_name,tabSystems.icon_file,tabSystems.myid,tabSystems.active_status
FROM %s.tabSystems FROM %s.tabSystems
inner join %s.`tabSystem Mapping_Sub System` on tabSystems.system_name = `tabSystem Mapping_Sub System`.systems where system_name = '%s' group by system_name ;''' %(current_db_name,current_db_name,i), as_dict=True) inner join %s.`tabSystem Mapping_Sub System` on tabSystems.system_name = `tabSystem Mapping_Sub System`.systems where system_name = '%s' group by system_name ;''' % (
current_db_name, current_db_name, i), as_dict=True)
sys = sys[0]
if sys['active_status'] == 'Active': if len(sys)>0:
sys['active_status'] = True sys = sys[0]
else: if sys['active_status'] == 'Active':
sys['active_status'] = False sys['active_status'] = True
sysassets = frappe.db.sql('''SELECT idx as systemdisplayorder, system_asset FROM {3}.`tabSystem Mapping_System Assets` where parent like '{0}%' and language='{1}' and systems='{2}';''' .format(
d, lang['language'], i, current_db_name), as_dict=True)
sys['Assets'] = sysassets
subsystem_out = []
for j in subsystem[d][i]:
subsys = frappe.db.sql('''select `tabSystem Mapping_Sub System`.idx as subSystemdisplayorder, systems,sub_systems, symptom, component, estimated_time, rts, mat, cover_image, `tabSub Systems`.myid,
`tabSystem Mapping_Sub System`.active_status
from {4}.`tabSystem Mapping_Sub System` inner join {4}.`tabSub Systems` on `tabSystem Mapping_Sub System`.sub_systems = `tabSub Systems`.name
where `tabSystem Mapping_Sub System`.parent like '{0}-{3}%' and systems='{1}' and sub_systems='{2}';'''.format(d, i, j, lang['language'], current_db_name), as_dict=True)
subsys = subsys[0]
if subsys['active_status'] == 'Active':
subsys['active_status'] = True
else: else:
subsys['active_status'] = False sys['active_status'] = False
kms = frappe.db.sql( sysassets = frappe.db.sql(
'''SELECT kilometer as kilometer_name, idx as kilometer_IDX, applicable as kilometers_applicable FROM %s.`tabKilometer Mapping_Items` where sub_systems='%s' order by kilometer_IDX;''' %(current_db_name,j), as_dict=True) '''SELECT idx as systemdisplayorder, system_asset FROM {3}.`tabSystem Mapping_System Assets` where parent like '{0}%' and language='{1}' and systems='{2}';'''.format(
d, lang['language'], i, current_db_name), as_dict=True)
subsys['Config Kilometer'] = kms sys['Assets'] = sysassets
for k in docs_child: subsystem_out = []
if k['variant_mapping'] == d and k['system'] == i and k['sub_system'] == j:
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 for j in subsystem[d][i]:
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) subsys = frappe.db.sql('''select `tabSystem Mapping_Sub System`.idx as subSystemdisplayorder, systems,sub_systems, symptom, component, estimated_time, rts, mat, cover_image, `tabSub Systems`.myid,
temp_data = get_parent_map( `tabSystem Mapping_Sub System`.active_status,`tabSystem Mapping_Sub System`.cover_image
proc_details, 'procedure_name') from {4}.`tabSystem Mapping_Sub System` inner join {4}.`tabSub Systems` on `tabSystem Mapping_Sub System`.sub_systems = `tabSub Systems`.name
where `tabSystem Mapping_Sub System`.parent like '{0}-{3}%' and systems='{1}' and sub_systems='{2}';'''.format(
k['Procedure_details'] = temp_data d, i, j, lang['language'], current_db_name), as_dict=True)
subsys['procedure_status'] = k['procedure_status'] subsys = subsys[0]
subsys['procedure_link'] = k['procedure_link']
subsys['Procedure_details'] = k['Procedure_details'] if subsys['active_status'] == 'Active':
subsys['active_status'] = True
stepcount = frappe.db.sql( else:
'''SELECT count(*) as Stepcount FROM {1}.tabProcedure_Details where parent='{0}';'''.format(k['procedure_link'],current_db_name), as_dict=True) subsys['active_status'] = False
stepcount = stepcount[0]
count = count+int(stepcount['Stepcount']) kms = frappe.db.sql(
'''SELECT kilometer as kilometer_name, idx as kilometer_IDX, applicable as kilometers_applicable FROM %s.`tabKilometer Mapping_Items` where sub_systems='%s' order by kilometer_IDX;''' % (
subsystem_out.append(subsys) current_db_name, j), as_dict=True)
sys['Subsystems'] = subsystem_out
system_out.append(sys) subsys['Config Kilometer'] = kms
variant_out['StepCount'] = count for k in docs_child:
variant_out['Variant']['Systems'] = system_out if k['variant_mapping'] == d and k['system'] == i and k['sub_system'] == j:
final.append(variant_out) 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(
# final_count['StepCount'] = count current_db_name, k['procedure_link']), as_dict=True)
# final.append(final_count) temp_data = get_parent_map(
frappe.db.sql(""" UPDATE %s.tabPublish SET publish_status = '%s' where name = '%s' """ % ( proc_details, 'procedure_name')
current_db_name,'Published', args))
frappe.db.commit() k['Procedure_details'] = temp_data
return final subsys['procedure_status'] = k['procedure_status']
subsys['procedure_link'] = k['procedure_link']
subsys['Procedure_details'] = k['Procedure_details']
stepcount = frappe.db.sql(
'''SELECT count(*) as Stepcount FROM {1}.tabProcedure_Details where parent='{0}';'''.format(
k['procedure_link'], current_db_name), as_dict=True)
stepcount = stepcount[0]
count = count + int(stepcount['Stepcount'])
subsystem_out.append(subsys)
sys['Subsystems'] = subsystem_out
system_out.append(sys)
variant_out['StepCount'] = count
variant_out['Variant']['Systems'] = system_out
final.append(variant_out)
frappe.db.sql(""" UPDATE %s.tabPublish SET publish_status = '%s' where name = '%s' """ % (
current_db_name, 'Published', args))
frappe.db.commit()
return final

41
smart_service/apis/testPublish.py

@ -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

26
smart_service/apis/transaction_api.py

@ -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

316
smart_service/apis/update_validation.py

@ -2,9 +2,14 @@ import frappe
from frappe.model.document import Document from frappe.model.document import Document
import json import json
import os 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 check_all_vehicle_updates(vehicle_list): def check_all_vehicle_updates(vehicle_list):
Vehicle_req_list = [] Vehicle_req_list = []
@ -14,20 +19,23 @@ def check_all_vehicle_updates(vehicle_list):
iid = v_list['InstallationId'] iid = v_list['InstallationId']
vehicle_data = v_list['VehicleReqList'] vehicle_data = v_list['VehicleReqList']
publish_type = frappe.db.sql( publish_type = frappe.db.sql(
'''SELECT publish_type FROM {}.`tabApp Device` where name='{}';'''.format(current_db_name,iid), as_list=True) '''SELECT publish_type FROM {}.`tabApp Device` where name='{}';'''.format(current_db_name, iid), as_list=True)
if publish_type[0][0] != None: if publish_type[0][0] != None:
for v in vehicle_data: for v in vehicle_data:
v_id = v['Vehicle'] v_id = v['Vehicle']
current_version = float(v['CurrentVersion']) current_version = float(v['CurrentVersion'])
data1 = frappe.db.sql('''SELECT name,max(version) as version,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published' data1 = frappe.db.sql('''SELECT name,max(version) as version,vehicle_id,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
and publish_type='{}' and vehicle_status='Active' order by version ASC;'''.format(current_db_name,v_id, lang, publish_type[0][0]), as_dict=True) and publish_type='{}' and vehicle_status='Active' order by version ASC;'''.format(current_db_name, v_id,
lang, publish_type[0][0]),
as_dict=True)
if data1[0]['version'] != None: if data1[0]['version'] != None:
if current_version == float(data1[0]['version']): if current_version == float(data1[0]['version']):
data1[0]['IsUpdateAvailable'] = "false" data1[0]['IsUpdateAvailable'] = "false"
Vehicle_req_list.append(data1) Vehicle_req_list.append(data1)
else: else:
data = frappe.db.sql('''SELECT name,CAST(version AS DECIMAL(10,2)) as version,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published' data = frappe.db.sql('''SELECT name,CAST(version AS DECIMAL(10,2)) as version,vehicle_id,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
and publish_type='{}' and vehicle_status='Active' and version > '{}' order by version ASC;'''.format(current_db_name,v_id, lang, publish_type[0][0], current_version), as_dict=True) and publish_type='{}' and vehicle_status='Active' and version > '{}' order by version ASC;'''.format(
current_db_name, v_id, lang, publish_type[0][0], current_version), as_dict=True)
data_append = [] data_append = []
for d in data: for d in data:
d['IsUpdateAvailable'] = 'true' d['IsUpdateAvailable'] = 'true'
@ -35,8 +43,6 @@ def check_all_vehicle_updates(vehicle_list):
data_append.append(d) data_append.append(d)
Vehicle_req_list.append(data_append) Vehicle_req_list.append(data_append)
response['LanguageID'] = lang response['LanguageID'] = lang
# response['VehicleReqList'] = Vehicle_req_list[0]
# return response
if len(Vehicle_req_list) != 0: if len(Vehicle_req_list) != 0:
response['VehicleReqList'] = Vehicle_req_list[0] response['VehicleReqList'] = Vehicle_req_list[0]
return response return response
@ -46,79 +52,235 @@ def check_all_vehicle_updates(vehicle_list):
return 'Invalid Publish Details' return 'Invalid Publish Details'
def get_parent_map(input_list, parameter):
parentChildMap = {}
for b in input_list:
parentChildMap.setdefault(b[parameter] or None, []).append(b)
list1 = []
for p in parentChildMap:
da = {"procedure_name": p, 'steps': parentChildMap[p]}
list1.append(da)
for i in parentChildMap[p]:
del i['procedure_name']
del i['idx']
return list1
@frappe.whitelist() @frappe.whitelist()
def check_vehicle_update(vehicle_list): def check_vehicle_update(vehicle_list):
Vehicle_req_list = [] try:
response = {} response = {}
v_list = json.loads(vehicle_list) req_list = json.loads(vehicle_list)
vehi = v_list['Vehicle'] vehicle = req_list['Vehicle']
iid = v_list['InstallationId'] iid = req_list['InstallationId']
vehicle_data = v_list['VehicleReqList'] vehicle_data = req_list['VehicleReqList']
publish_type = frappe.db.sql( publish_type = frappe.db.get_list('App Device', filters={'name': iid}, fields='publish_type')
'''SELECT publish_type FROM {}.`tabApp Device` where name='{}';'''.format(current_db_name,iid), as_list=True)
if len(publish_type) > 0:
publish_type = publish_type[0]['publish_type']
Vehicle_req_list = []
for v in vehicle_data:
appendList = []
appendDict = {}
variant = set()
system = {}
subsystem = {}
procedure = {}
list1 = []
list2 = []
if publish_type[0][0] != None: l_id = v['LanguageID']
for v in vehicle_data: current_version = v['CurrentVersion']
l_id = v['LanguageID'] if publish_type == 'Internal':
current_version = float(v['CurrentVersion']) 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';
data1 = frappe.db.sql('''SELECT name,max(version) as version,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published' '''.format(current_db_name, vehicle, l_id, publish_type, current_version), as_dict=True)
and publish_type='{}' and vehicle_status='Active' order by version ASC;'''.format(current_db_name,vehi, l_id, publish_type[0][0]), as_dict=True) else:
publish_data = frappe.db.sql('''select name,version from {}.tabPublish where vehicle= '{}' and language='{}' and publish_type= '{}' and version > {} and vehicle_status = 'Active';
if data1[0]['name'] != None: '''.format(current_db_name, vehicle, l_id, publish_type, current_version), as_dict=True)
if data1[0]['version'] != None:
if current_version == float(data1[0]['version']):
data1[0]['IsUpdateAvailable'] = "false" if len(publish_data) > 0:
Vehicle_req_list.append(data1) update_version = publish_data[-1]['version']
for d in publish_data:
else: publish_docs = frappe.db.get_list('Publish_Docs', filters={'parent': d['name']},
if publish_type[0][0] == 'Internal': fields=['variant_mapping', 'system', 'sub_system',
data = frappe.db.sql('''SELECT name,CAST(version AS DECIMAL(10,2)) as version,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published' 'procedure_link', 'procedure_status'])
and publish_type='{}' and vehicle_status='Active' and version > '{}' order by version ASC;'''.format(current_db_name,vehi, l_id, publish_type[0][0], current_version), as_dict=True)
if publish_docs != None:
list1.append(publish_docs)
for d in list1:
for f in d:
list2.append(f)
# Sort data according to variant, system and sub system
for d in list2:
variant.add(d['variant_mapping'])
for d in variant:
temp = set()
for j in list2:
if j['variant_mapping'] == d:
temp.add(j['system'])
system[d] = temp
for d in variant:
temp_set = {}
for j in system[d]:
temp = set()
for k in list2:
if d == k['variant_mapping'] and j == k['system']:
temp.add(k['sub_system'])
temp_set[j] = temp
subsystem[d] = temp_set
for d in variant:
temp_set = {}
for i in system[d]:
temp_dict = {}
for j in subsystem[d][i]:
temp_sub = set()
for k in list2:
if k['variant_mapping'] == d and k['system'] == i and k['sub_system'] == j:
temp_sub.add(k['procedure_link'])
temp_dict[j] = temp_sub
temp_set[i] = temp_dict
procedure[d] = temp_set
appendList.append(procedure)
for g in appendList:
for f in g.keys():
appendDict[f] = (g[f])
final = []
count = 0
active_status_case = "CASE WHEN active_status = 'Active' THEN 'True' ELSE 'False' END AS active_status"
for d in appendDict:
variant_out = {}
# Variant data
vari = frappe.db.sql('''SELECT name,variant, vehicle,family_code,vehicle_segment,fuel,transmission,drive, active_status
FROM %s.`tabVariant Mapping` WHERE name ='%s' ; ''' % (
current_db_name, d), as_dict=True)
var_asset = frappe.db.sql(
'''SELECT category, attach_file as file, %s FROM %s.`tabVariant Mapping_Assets` where category<>'Technical Manual' and parent='%s' and language='%s';''' % (
active_status_case, current_db_name, d, l_id), as_dict=True)
vari = vari[0]
if vari['active_status'] == 'Active':
vari['active_status'] = True
else: else:
data = frappe.db.sql('''SELECT name,version,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published' vari['active_status'] = False
and publish_type='{}' and vehicle_status='Active' and version > '{}' order by version ASC;'''.format(current_db_name,vehi, l_id, publish_type[0][0], current_version), as_dict=True)
vari['Assets'] = var_asset
list1 = [] variant_out['Variant'] = vari
dict1 = {} # System data
system_out = []
base_url = '/home/frappe_srv_01/frappe-bench/sites/ss.hnsonline.com/public' for i in appendDict[d]:
for d in data: sys = frappe.db.sql('''SELECT min(`tabSystem Mapping_Sub System`.idx) as systemdisplayorder,tabSystems.system_name,tabSystems.icon_file,tabSystems.myid,tabSystems.active_status
ver = str(d['version']) FROM {0}.tabSystems inner join {0}.`tabSystem Mapping_Sub System` on tabSystems.system_name = `tabSystem Mapping_Sub System`.systems where system_name = '{1}' group by system_name ;'''
file_name = 'files/json_files/'+vehi + "-" + \ .format(current_db_name, i), as_dict=True)
d['language'] + '_v' + ver + '.json'
json_data = json.load( if len(sys) > 0:
open(os.path.join(base_url, file_name))) sys = sys[0]
json_data[0]['version'] = ver if sys['active_status'] == 'Active':
list1.append(json_data[0]) sys['active_status'] = True
else:
dict1['JSON'] = list1 sys['active_status'] = False
# System Assets
f_name = "/files/json_files/temp/%s-%s_%s.json" % ( sysassets = frappe.db.sql(
iid, vehi, l_id) '''SELECT idx as systemdisplayorder, system_asset FROM {3}.`tabSystem Mapping_System Assets` where parent like '{0}%' and language='{1}' and systems='{2}';'''.format(
with open(base_url+f_name, 'w') as outfile: d, l_id, i, current_db_name), as_dict=True)
outfile.write(json.dumps(dict1)) sys['Assets'] = sysassets
# res = {} # Sub system
# res['Name'] = '%s-%s_%s' % (iid, vehi, l_id) subsystem_out = []
# res['Language'] = l_id for j in appendDict[d][i]:
# res['IsUpdateAvailable'] = 'true' subsys = frappe.db.sql('''select `tabSystem Mapping_Sub System`.idx as subSystemdisplayorder, systems,sub_systems, symptom, component, estimated_time, rts, mat, cover_image, `tabSub Systems`.myid,
# res['CurrentVersion'] = float(current_version) `tabSystem Mapping_Sub System`.active_status,`tabSystem Mapping_Sub System`.cover_image
# res['Version'] = float(data1[0]['version']) from {4}.`tabSystem Mapping_Sub System` inner join {4}.`tabSub Systems` on `tabSystem Mapping_Sub System`.sub_systems = `tabSub Systems`.name
# res['JsonURL'] = f_name where `tabSystem Mapping_Sub System`.parent like '{0}-{3}%' and systems='{1}' and sub_systems='{2}';'''.format(
d, i, j, l_id, current_db_name), as_dict=True)
res = {'Name': '%s-%s_%s' % (iid, vehi, l_id), 'Language': l_id, 'IsUpdateAvailable': 'true',
'CurrentVersion': float(current_version), 'Version': float(data1[0]['version']), if len(subsys) > 0:
'JsonURL': f_name} subsys = subsys[0]
Vehicle_req_list.append(res) if subsys['active_status'] == 'Active':
else: subsys['active_status'] = True
# res = {'Language': l_id, 'IsUpdateAvailable': 'false', 'CurrentVersion': float(current_version)} else:
Vehicle_req_list.append({'Language': l_id, 'IsUpdateAvailable': 'false', 'CurrentVersion': float(current_version)}) subsys['active_status'] = False
response['Vehicle'] = vehi kms = frappe.db.sql(
response['VehicleReqList'] = Vehicle_req_list '''SELECT kilometer as kilometer_name, idx as kilometer_IDX, applicable as kilometers_applicable FROM %s.`tabKilometer Mapping_Items` where sub_systems='%s' order by kilometer_IDX;''' % (
current_db_name, j), as_dict=True)
subsys['Config Kilometer'] = kms
for k in appendDict[d][i][j]:
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), as_dict=True)
temp_data = get_parent_map(proc_details, 'procedure_name')
procedure_status = frappe.db.sql(
'''SELECT workflow_state FROM {1}.tabProcedure where name='{0}';'''.format(
k, current_db_name))
procedure_status = procedure_status[0][0]
subsys['procedure_link'] = k
subsys['procedure_status'] = procedure_status
subsys['Procedure_details'] = temp_data
stepcount = frappe.db.sql(
'''SELECT count(*) as Stepcount FROM {1}.tabProcedure_Details where parent='{0}';'''.format(
k, current_db_name), as_dict=True)
stepcount = stepcount[0]
count = count + int(stepcount['Stepcount'])
subsystem_out.append(subsys)
sys['Subsystems'] = subsystem_out
system_out.append(sys)
variant_out['StepCount'] = count
variant_out['Variant']['Systems'] = system_out
final.append(variant_out)
res = {'Name': '%s-%s_%s' % (iid, vehicle, l_id), 'Language': l_id, 'IsUpdateAvailable': 'true',
'CurrentVersion': float(current_version), 'Version': float(update_version)}
try:
file_name = "/files/json_files/temp/%s-%s_%s.json" % (iid, vehicle, l_id)
dicfinal = {'JSON': final}
with open(base_url + file_name, 'w') as outfile:
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
except:
res['JsonURL'] = None
res['FileSize'] = None
res['Error'] = 'File failed to save'
Vehicle_req_list.append(res)
else:
Vehicle_req_list.append(
{'Language': l_id, 'IsUpdateAvailable': 'false', 'CurrentVersion': float(current_version)})
response['Vehicle'] = vehicle
response['VehicleReqList'] = Vehicle_req_list
return response
else:
response['JSON']="Error"
return response
except:
response['JSON'] = {"Error":"Input Error"}
return response return response
else: @frappe.whitelist()
Vehicle_req_list.append({'Error': 'Publish type error'}) def update_completed(FileName):
return Vehicle_req_list try:
os.remove(base_url+ FileName)
return {'isSuccessful':True}
except:
return {'isSuccessful':True}

43
smart_service/fixtures/custom_field.json

@ -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
}
]

29
smart_service/hooks.py

@ -43,6 +43,7 @@ website_context = {
# page_js = {"page" : "public/js/file.js"} # page_js = {"page" : "public/js/file.js"}
# include js in doctype views # include js in doctype views
# doctype_js = {"doctype" : "public/js/doctype.js"} # doctype_js = {"doctype" : "public/js/doctype.js"}
# doctype_list_js = {"doctype" : "public/js/doctype_list.js"} # doctype_list_js = {"doctype" : "public/js/doctype_list.js"}
# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
@ -93,42 +94,48 @@ website_context = {
# --------------- # ---------------
# Override standard doctype classes # Override standard doctype classes
# override_doctype_class = { override_doctype_class = {
# "ToDo": "custom_app.overrides.CustomToDo" # "ToDo": "custom_app.overrides.CustomToDo"
# } }
# Document Events # Document Events
# --------------- # ---------------
# Hook on document methods and events # Hook on document methods and events
# doc_events = { doc_events = {
"User":{
# "onload":"smart_service.masters.doctype.vehicle.vehicle.test"
}
# "*": { # "*": {
# "on_update": "method", # "on_update": "method",
# "on_cancel": "method", # "on_cancel": "method",
# "on_trash": "method" # "on_trash": "method"
# } # }
# } }
# Scheduled Tasks # Scheduled Tasks
# --------------- # ---------------
# scheduler_events = { scheduler_events = {
# "all": [ # "all": [
# "smart_service.tasks.all" # "smart_service.tasks.all"
# ], # ],
# "daily": [ # "daily": [
# "smart_service.tasks.daily" # "smart_service.tasks.daily"
# ], # ],
# "hourly": [ "hourly": [
# "smart_service.tasks.hourly" #"smart_service.tasks.hourly"
# ], "smart_service.masters.doctype.vehicle.vehicle.test"
#"smart_service.apis.app_user_login.login_generate_token"
#"frappe.website.doctype.web_page.web_page.login"
]
# "weekly": [ # "weekly": [
# "smart_service.tasks.weekly" # "smart_service.tasks.weekly"
# ] # ]
# "monthly": [ # "monthly": [
# "smart_service.tasks.monthly" # "smart_service.tasks.monthly"
# ] # ]
# } }
# Testing # Testing
# ------- # -------
@ -184,4 +191,8 @@ user_data_fields = [
# auth_hooks = [ # auth_hooks = [
# "smart_service.auth.validate" # "smart_service.auth.validate"
# ] # ]
fixtures = [
"Custom Field",
"Property Setter"
]

2
smart_service/mahindra_smart_service/doctype/release/release.js

@ -2,6 +2,4 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Release', { frappe.ui.form.on('Release', {
// refresh: function(frm) {
// }
}); });

4
smart_service/mahindra_smart_service/doctype/release/release.py

@ -13,8 +13,4 @@ class Release(Document):
@frappe.whitelist() @frappe.whitelist()
def api_vehicle_map(): def api_vehicle_map():
doc = frappe.get_doc('Systems','Reverse Parking Assistance System') doc = frappe.get_doc('Systems','Reverse Parking Assistance System')
# doc = frappe.get_doc({
# 'doctype': 'Procedure',
# 'name': 'Thar-AX-0001-Air Filter Element Clean-en'
# })
return doc return doc

1
smart_service/mahindra_smart_service/report/_applog_translation/_applog_translation.js

@ -13,7 +13,6 @@ frappe.query_reports["_Applog Translation"] = {
default: frappe.datetime.year_start(), default: frappe.datetime.year_start(),
"reqd": 0 "reqd": 0
}, },
{ {
"fieldname":"to_date", "fieldname":"to_date",
"label": __("To Date"), "label": __("To Date"),

5
smart_service/mahindra_smart_service/report/_applog_translation/_applog_translation.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2022-01-10 10:44:02.371299", "modified": "2022-01-28 15:18:14.220575",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Mahindra Smart Service", "module": "Mahindra Smart Service",
"name": "_Applog Translation", "name": "_Applog Translation",
@ -21,9 +21,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Admin"
} }
] ]
} }

5
smart_service/mahindra_smart_service/report/_drive_translation/_drive_translation.js

@ -4,17 +4,14 @@
frappe.query_reports["_Drive Translation"] = { frappe.query_reports["_Drive Translation"] = {
"filters": [ "filters": [
], ],
"formatter": function (value, row, column, data, default_formatter) { "formatter": function (value, row, column, data, default_formatter) {
console.log(value)
if(value==null){ if(value==null){
value=' ' value=' '
column.align='left'; column.align='left';
} }
value = default_formatter(value, row, column, data); value = default_formatter(value, row, column, data);
return value; return value;
}
}
}; };

8
smart_service/mahindra_smart_service/report/_drive_translation/_drive_translation.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2021-11-29 12:15:09.820884", "modified": "2022-01-28 15:19:38.891878",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Mahindra Smart Service", "module": "Mahindra Smart Service",
"name": "_Drive Translation", "name": "_Drive Translation",
@ -19,14 +19,8 @@
"report_name": "_Drive Translation", "report_name": "_Drive Translation",
"report_type": "Script Report", "report_type": "Script Report",
"roles": [ "roles": [
{
"role": "_Admin"
},
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Master Read"
} }
] ]
} }

81
smart_service/mahindra_smart_service/report/_drive_translation/_drive_translation.py

@ -19,7 +19,6 @@ def get_data():
custom_lang = frappe.db.sql("""SELECT lang_code FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_list=True) custom_lang = frappe.db.sql("""SELECT lang_code FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_list=True)
queryAppendLang = "" queryAppendLang = ""
for d in custom_lang: for d in custom_lang:
q = ", (CASE WHEN tabLang.languageCode = '%s' THEN %s.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0]) q = ", (CASE WHEN tabLang.languageCode = '%s' THEN %s.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0])
@ -35,8 +34,6 @@ def get_data():
`tabDrive`.modified as "Modified On", `tabDrive`.modified as "Modified On",
`tabDrive`.active_status as "Status", `tabDrive`.active_status as "Status",
`tabDrive`.drive as 'Drive' `tabDrive`.drive as 'Drive'
%s %s
From %s.`tabDrive` From %s.`tabDrive`
LEFT JOIN %s.`tabTranslation` as tabTrans LEFT JOIN %s.`tabTranslation` as tabTrans
@ -52,96 +49,18 @@ def get_data():
ON %s.tabTranslation.language = tabLang.languageCode) as tabTranslation ON %s.tabTranslation.language = tabLang.languageCode) as tabTranslation
ON %s.`tabDrive`.drive = tabTranslation.sourceText;""" % (sel,current_db_name,current_db_name,current_db_name,current_db_name,current_db_name,queryAppendLang,current_db_name,current_db_name,current_db_name,current_db_name) ON %s.`tabDrive`.drive = tabTranslation.sourceText;""" % (sel,current_db_name,current_db_name,current_db_name,current_db_name,current_db_name,queryAppendLang,current_db_name,current_db_name,current_db_name,current_db_name)
data = frappe.db.sql(actualQuery,as_list=True) data = frappe.db.sql(actualQuery,as_list=True)
return data return data
# data = frappe.db.sql(
# """Select
# `tabDrive Segment`.modified as "Modified On",
# `tabDrive Segment`.active_status as "Status",
# `tabDrive Segment`.drive_segment as 'drive Segment' ,
# `tabDrive Segment`.drive_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabDrive Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabDrive Segment`.drive_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text
# , (CASE WHEN tabLang.languageCode = "en" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as en
# , (CASE WHEN tabLang.languageCode = "gu" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as gu
# , (CASE WHEN tabLang.languageCode = "hi" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as hi
# , (CASE WHEN tabLang.languageCode = "kn" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as kn
# , (CASE WHEN tabLang.languageCode = "ml" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ml
# , (CASE WHEN tabLang.languageCode = "mr" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as mr
# , (CASE WHEN tabLang.languageCode = "ta" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ta
# , (CASE WHEN tabLang.languageCode = "te" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as te
# From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabDrive Segment`.drive_segment = tabTranslation.sourceText;""",as_list=True)
# return data
def get_columns(): def get_columns():
columns = [] columns = []
columns += [ columns += [
_("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Drive") + ":Data/:220", _("Modified On") + ":Datetime/:200", _("Status") + ":Data/:100",_("Drive") + ":Data/:220",
] ]
lang = [] lang = []
custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1)
# frappe.msgprint(str(custom_lang))
for d in custom_lang: for d in custom_lang:
lang.append(cstr(d["lang_name"])+ "::220") lang.append(cstr(d["lang_name"])+ "::220")
# frappe.msgprint(str(lang))
columns += lang columns += lang
return columns,lang return columns,lang
# customLang = ['en', 'hi', 'ta', 'te']
# queryAppendLang = []
# for d in customLang:
# # print(d)
# query = " ,(CASE WHEN tabLang.languageCode = '%s' THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as %s" % (d, d)
# queryAppendLang.append(query)
# actualQuery = """Select
# `tabDrive Segment`.modified as "Modified On",
# `tabDrive Segment`.active_status as "Status",
# `tabDrive Segment`.drive_segment as 'drive Segment' ,
# `tabDrive Segment`.drive_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabDrive Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabDrive Segment`.drive_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text %s From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabDrive Segment`.drive_segment = tabTranslation.sourceText;""" % (queryAppendLang[0])
# print(actualQuery)

BIN
smart_service/mahindra_smart_service/report/_file_structure/__pycache__/_file_structure.cpython-38.pyc

Binary file not shown.

8
smart_service/mahindra_smart_service/report/_file_structure/_file_structure.js

@ -8,8 +8,6 @@ const documents =['doc','docx','txt','odt','ppt','pptx'];
const spreadsheets=['ods','xls','xlsx']; const spreadsheets=['ods','xls','xlsx'];
frappe.query_reports["_File Structure"] = { frappe.query_reports["_File Structure"] = {
"filters": [ "filters": [
@ -19,7 +17,6 @@ frappe.query_reports["_File Structure"] = {
if(data && column.fieldname=="filename" && data.folder==0){ if(data && column.fieldname=="filename" && data.folder==0){
if(data.private==1){ if(data.private==1){
if(pictures.includes(data.fileformat)){ if(pictures.includes(data.fileformat)){
// console.log(data);
value = `<p><svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 40 40"> value = `<p><svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 40 40">
<g id="Image" transform="translate(-2584 -2277)"> <g id="Image" transform="translate(-2584 -2277)">
<rect id="Rectangle_1711" data-name="Rectangle 1711" width="40" height="40" transform="translate(2584 2277)" fill="none"/> <rect id="Rectangle_1711" data-name="Rectangle 1711" width="40" height="40" transform="translate(2584 2277)" fill="none"/>
@ -93,7 +90,6 @@ frappe.query_reports["_File Structure"] = {
} else if(data.private==0){ } else if(data.private==0){
if(pictures.includes(data.fileformat)){ if(pictures.includes(data.fileformat)){
// console.log(data);
value = `<p><svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 40 40"> value = `<p><svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 40 40">
<g id="Image" transform="translate(-2584 -2277)"> <g id="Image" transform="translate(-2584 -2277)">
<rect id="Rectangle_1711" data-name="Rectangle 1711" width="40" height="40" transform="translate(2584 2277)" fill="none"/> <rect id="Rectangle_1711" data-name="Rectangle 1711" width="40" height="40" transform="translate(2584 2277)" fill="none"/>
@ -212,14 +208,10 @@ frappe.query_reports["_File Structure"] = {
}, },
"set_route_to_file": function (data) { "set_route_to_file": function (data) {
// console.log(data);
// window.open("http://ss.hnsonline.com:81/files/" + data);
window.open("http://192.168.1.58:81/files/" + data); window.open("http://192.168.1.58:81/files/" + data);
}, },
"set_route_to_folder": function (data) { "set_route_to_folder": function (data) {
// console.log(data);
// window.open("http://ss.hnsonline.com:81/files/" + data);
}, },
"tree": true, "tree": true,

40
smart_service/mahindra_smart_service/report/_file_structure/_file_structure.py

File diff suppressed because one or more lines are too long

BIN
smart_service/mahindra_smart_service/report/_fuel_translation/__pycache__/_fuel_translation.cpython-38.pyc

Binary file not shown.

4
smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.js

@ -7,13 +7,11 @@ frappe.query_reports["_Fuel Translation"] = {
], ],
"formatter": function (value, row, column, data, default_formatter) { "formatter": function (value, row, column, data, default_formatter) {
console.log(value)
if(value==null){ if(value==null){
value=' ' value=' '
column.align='left'; column.align='left';
} }
value = default_formatter(value, row, column, data); value = default_formatter(value, row, column, data);
return value; return value;
}
}
}; };

5
smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2021-11-26 17:08:23.995237", "modified": "2022-01-28 15:18:46.419570",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Mahindra Smart Service", "module": "Mahindra Smart Service",
"name": "_Fuel Translation", "name": "_Fuel Translation",
@ -21,9 +21,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Admin"
} }
] ]
} }

74
smart_service/mahindra_smart_service/report/_fuel_translation/_fuel_translation.py

@ -33,7 +33,6 @@ def get_data():
`tabFuel`.modified as "Modified On", `tabFuel`.modified as "Modified On",
`tabFuel`.active_status as "Status", `tabFuel`.active_status as "Status",
`tabFuel`.fuel as 'Fuel' `tabFuel`.fuel as 'Fuel'
%s %s
From `tabFuel` From `tabFuel`
LEFT JOIN `tabTranslation` as tabTrans LEFT JOIN `tabTranslation` as tabTrans
@ -54,41 +53,6 @@ def get_data():
return data return data
# data = frappe.db.sql(
# """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text
# , (CASE WHEN tabLang.languageCode = "en" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as en
# , (CASE WHEN tabLang.languageCode = "gu" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as gu
# , (CASE WHEN tabLang.languageCode = "hi" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as hi
# , (CASE WHEN tabLang.languageCode = "kn" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as kn
# , (CASE WHEN tabLang.languageCode = "ml" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ml
# , (CASE WHEN tabLang.languageCode = "mr" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as mr
# , (CASE WHEN tabLang.languageCode = "ta" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ta
# , (CASE WHEN tabLang.languageCode = "te" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as te
# From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""",as_list=True)
# return data
def get_columns(): def get_columns():
current_db_name = frappe.conf.get("db_name") current_db_name = frappe.conf.get("db_name")
@ -103,41 +67,3 @@ def get_columns():
lang.append(cstr(d["lang_name"])+ "::220") lang.append(cstr(d["lang_name"])+ "::220")
columns += lang columns += lang
return columns,lang return columns,lang
# customLang = ['en', 'hi', 'ta', 'te']
# queryAppendLang = []
# for d in customLang:
# # print(d)
# query = " ,(CASE WHEN tabLang.languageCode = '%s' THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as %s" % (d, d)
# queryAppendLang.append(query)
# actualQuery = """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text %s From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""" % (queryAppendLang[0])
# print(actualQuery)

BIN
smart_service/mahindra_smart_service/report/_procedure_report/__pycache__/_procedure_report.cpython-38.pyc

Binary file not shown.

75
smart_service/mahindra_smart_service/report/_procedure_report/_procedure_report.js

@ -13,16 +13,6 @@ frappe.query_reports["_Procedure Report"] = {
], ],
"formatter": function (value, row, column, data, default_formatter) { "formatter": function (value, row, column, data, default_formatter) {
// if (data && column.fieldname == "procedure_name") {
// if (data.indent != 0 && data.indent != 1) {
// column.link_onclick = "frappe.query_reports['_Procedure Report'].set_route(" + JSON.stringify(data.parent) + ")"
// }
// else {
// column.link_onclick = " "
// }
// }
if (data && column.fieldname == "procedure_name") { if (data && column.fieldname == "procedure_name") {
switch (data.indent) { switch (data.indent) {
case 3: case 3:
@ -34,7 +24,7 @@ frappe.query_reports["_Procedure Report"] = {
<path id="Path_2564" data-name="Path 2564" d="M408.471,1492.3q3.1,0,6.2,0a1.181,1.181,0,0,1,.6.07.787.787,0,0,1,.363.547c-.011.178-.248.379-.432.5-.124.078-.329.035-.5.035q-6.259,0-12.519,0c-.168,0-.377.042-.5-.039a.913.913,0,0,1-.413-.513.7.7,0,0,1,.329-.513,1.187,1.187,0,0,1,.6-.082Q405.341,1492.3,408.471,1492.3Z" transform="translate(-33.442 -80.228)" fill="#606060"/> <path id="Path_2564" data-name="Path 2564" d="M408.471,1492.3q3.1,0,6.2,0a1.181,1.181,0,0,1,.6.07.787.787,0,0,1,.363.547c-.011.178-.248.379-.432.5-.124.078-.329.035-.5.035q-6.259,0-12.519,0c-.168,0-.377.042-.5-.039a.913.913,0,0,1-.413-.513.7.7,0,0,1,.329-.513,1.187,1.187,0,0,1,.6-.082Q405.341,1492.3,408.471,1492.3Z" transform="translate(-33.442 -80.228)" fill="#606060"/>
<path id="Path_2565" data-name="Path 2565" d="M408.413,1528.122c-2.143,0-4.287,0-6.43,0-.412,0-.811-.053-.817-.546s.38-.615.828-.614q6.374.008,12.747,0c.453,0,.83.118.816.623s-.415.539-.827.538C412.625,1528.118,410.519,1528.122,408.413,1528.122Z" transform="translate(-33.341 -111.024)" fill="#606060"/> <path id="Path_2565" data-name="Path 2565" d="M408.413,1528.122c-2.143,0-4.287,0-6.43,0-.412,0-.811-.053-.817-.546s.38-.615.828-.614q6.374.008,12.747,0c.453,0,.83.118.816.623s-.415.539-.827.538C412.625,1528.118,410.519,1528.122,408.413,1528.122Z" transform="translate(-33.341 -111.024)" fill="#606060"/>
<path id="Path_2566" data-name="Path 2566" d="M406.889,1563.014c-1.633,0-3.267-.007-4.9,0-.422,0-.8-.081-.814-.556-.012-.517.385-.6.827-.594q4.872.012,9.743,0c.411,0,.8.052.808.553.013.541-.389.6-.821.594C410.118,1563.009,408.5,1563.014,406.889,1563.014Z" transform="translate(-33.324 -142.032)" fill="#606060"/> <path id="Path_2566" data-name="Path 2566" d="M406.889,1563.014c-1.633,0-3.267-.007-4.9,0-.422,0-.8-.081-.814-.556-.012-.517.385-.6.827-.594q4.872.012,9.743,0c.411,0,.8.052.808.553.013.541-.389.6-.821.594C410.118,1563.009,408.5,1563.014,406.889,1563.014Z" transform="translate(-33.324 -142.032)" fill="#606060"/>
<path id="Path_2567" data-name="Path 2567" d="M479.649,1554.137c-.42-.235-.837-.474-1.259-.7a.175.175,0,0,1-.114-.181c-.011-.361-.026-.723-.062-1.082a.223.223,0,0,1,.119-.246c.382-.267.754-.549,1.131-.823a.141.141,0,0,0,.056-.195c-.144-.326-.286-.654-.424-.982a.141.141,0,0,0-.183-.088c-.473.092-.946.178-1.419.276l-.011,0a.154.154,0,0,1-.175-.066c-.249-.275-.5-.546-.763-.808a.188.188,0,0,1-.064-.217c.123-.464.231-.932.349-1.4a.131.131,0,0,0-.076-.173l-.354-.177q-.3-.151-.6-.3a.14.14,0,0,0-.2.042c-.3.37-.607.734-.9,1.107a.2.2,0,0,1-.221.085c-.362-.051-.727-.09-1.092-.121a.175.175,0,0,1-.174-.122c-.206-.438-.422-.874-.643-1.305a.17.17,0,0,0-.139-.077c-.362.078-.723.169-1.084.253a.122.122,0,0,0-.1.144c.008.49.01.98.023,1.47a.15.15,0,0,1-.087.155c-.316.2-.632.405-.94.62a.187.187,0,0,1-.226.022c-.432-.2-.869-.387-1.3-.582a.146.146,0,0,0-.205.055q-.306.422-.623.836a.154.154,0,0,0,.013.225c.312.359.618.724.933,1.081a.168.168,0,0,1,.045.2q-.175.536-.321,1.08a.183.183,0,0,1-.154.15c-.459.126-.914.263-1.372.394a.148.148,0,0,0-.127.174c.023.346.043.694.061,1.04a.151.151,0,0,0,.143.161c.475.076.948.159,1.423.23a.171.171,0,0,1,.159.125c.141.347.29.693.447,1.033a.165.165,0,0,1-.013.2c-.173.25-.342.5-.512.757-.1.145-.195.292-.293.436a.155.155,0,0,0,.021.226c.15.156.3.313.449.47.09.094.18.189.268.284a.137.137,0,0,0,.2.029c.172-.106.345-.209.518-.313q.362-.218.724-.438a.152.152,0,0,1,.186-.011c.119.063.237.125.357.186q.334.17.674.33a.172.172,0,0,1,.112.168c.046.482.1.964.155,1.448a.131.131,0,0,0,.134.133c.345.04.691.078,1.036.121a.163.163,0,0,0,.2-.124c.153-.45.315-.9.465-1.349a.17.17,0,0,1,.152-.134c.358-.075.715-.156,1.068-.252a.209.209,0,0,1,.243.063c.337.335.686.66,1.029.989a.131.131,0,0,0,.188.016q.433-.29.871-.572a.163.163,0,0,0,.076-.226c-.171-.445-.335-.892-.51-1.333a.167.167,0,0,1,.027-.2c.231-.3.454-.6.672-.9a.165.165,0,0,1,.182-.089c.344.045.691.078,1.036.115,0,0,0-.008,0-.013.139,0,.277,0,.415,0a.135.135,0,0,0,.157-.108q.152-.521.31-1.039A.132.132,0,0,0,479.649,1554.137Zm-6.27,1.911a3.069,3.069,0,0,1-2.075-.809c-.059-.053-.115-.11-.17-.17a3.06,3.06,0,0,1,2.166-5.136c.026,0,.052,0,.079,0s.051,0,.077,0h0a3.058,3.058,0,0,1-.079,6.115Z" transform="translate(-91.456 -128.231)" fill="#e51636"/> <path id="Path_2567" data-name="Path 2567" d="M479.649,1554.137c-.42-.235-.837-.474-1.259-.7a.175.175,0,0,1-.114-.181c-.011-.361-.026-.723-.062-1.082a.223.223,0,0,1,.119-.246c.382-.267.754-.549,1.131-.823a.141.141,0,0,0,.056-.195c-.144-.326-.286-.654-.424-.982a.141.141,0,0,0-.183-.088c-.473.092-.946.178-1.419.276l-.011,0a.154.154,0,0,1-.175-.066c-.249-.275-.5-.546-.763-.808a.188.188,0,0,1-.064-.217c.123-.464.231-.932.349-1.4a.131.131,0,0,0-.076-.173l-.354-.177q-.3-.151-.6-.3a.14.14,0,0,0-.2.042c-.3.37-.607.734-.9,1.107a.2.2,0,0,1-.221.085c-.362-.051-.727-.09-1.092-.121a.175.175,0,0,1-.174-.122c-.206-.438-.422-.874-.643-1.305a.17.17,0,0,0-.139-.077c-.362.078-.723.169-1.084.253a.122.122,0,0,0-.1.144c.008.49.01.98.023,1.47a.15.15,0,0,1-.087.155c-.316.2-.632.405-.94.62a.187.187,0,0,1-.226.022c-.432-.2-.869-.387-1.3-.582a.146.146,0,0,0-.205.055q-.306.422-.623.836a.154.154,0,0,0,.013.225c.312.359.618.724.933,1.081a.168.168,0,0,1,.045.2q-.175.536-.321,1.08a.183.183,0,0,1-.154.15c-.459.126-.914.263-1.372.394a.148.148,0,0,0-.127.174c.023.346.043.694.061,1.04a.151.151,0,0,0,.143.161c.475.076.948.159,1.423.23a.171.171,0,0,1,.159.125c.141.347.29.693.447,1.033a.165.165,0,0,1-.013.2c-.173.25-.342.5-.512.757-.1.145-.195.292-.293.436a.155.155,0,0,0,.021.226c.15.156.3.313.449.47.09.094.18.189.268.284a.137.137,0,0,0,.2.029c.172-.106.345-.209.518-.313q.362-.218.724-.438a.152.152,0,0,1,.186-.011c.119.063.237.125.357.186q.334.17.674.33a.172.172,0,0,1,.112.168c.046.482.1.964.155,1.448a.131.131,0,0,0,.134.133c.345.04.691.078,1.036.121a.163.163,0,0,0,.2-.124c.153-.45.315-.9.465-1.349a.17.17,0,0,1,.152-.134c.358-.075.715-.156,1.068-.252a.209.209,0,0,1,.243.063c.337.335.686.66,1.029.989a.131.131,0,0,0,.188.016q.433-.29.871-.572a.163.163,0,0,0,.076-.226c-.171-.445-.335-.892-.51-1.333a.167.167,0,0,1,.027-.2c.231-.3.454-.6.672-.9a.165.165,0,0,1,.182-.089c.344.045.691.078,1.036.115,0,0,0-.008,0-.013.139,0,.277,0,.415,0a.135.135,0,0,0,.157-.108q.152-.521.31-1.039A.132.132,0,0,0,479.649,1554.137Zm-6.27,1.911a3.069,3.069,0,0,1-2.075-.809c-.059-.053-.115-.11-.17-.17a3.06,3.06,0,0,1,2.166-5.136c.026,0,.052,0,.079,0s.051,0,.077,0h0a3.058,3.058,0,0,1-.079,6.115Z" transform="translate(-91.456 -128.231)" fill="#000000"/>
</g> </g>
</g> </g>
</svg>&nbsp;&nbsp;&nbsp;${value}</p>` </svg>&nbsp;&nbsp;&nbsp;${value}</p>`
@ -45,7 +35,7 @@ frappe.query_reports["_Procedure Report"] = {
<rect id="Rectangle_1704" data-name="Rectangle 1704" width="40" height="40" transform="translate(2581 1900)" fill="none"/> <rect id="Rectangle_1704" data-name="Rectangle 1704" width="40" height="40" transform="translate(2581 1900)" fill="none"/>
<g id="Group_3450" data-name="Group 3450" transform="translate(3980.455 977.971)"> <g id="Group_3450" data-name="Group 3450" transform="translate(3980.455 977.971)">
<path id="Path_2488" data-name="Path 2488" d="M-1366.515,938.924q-1.059-.01-2.119,0a.561.561,0,0,0-.626.633c-.007.633,0,1.266,0,1.9,0,.088,0,.177,0,.26-.56.083-.561.083-.561-.431,0-1.138-.034-2.276.014-3.412a1.8,1.8,0,0,0-1.793-1.785c-1.568.042-3.137.013-4.706.013-.088,0-.176-.008-.268-.011v-1.63a.316.316,0,0,1,.077-.031c.679,0,1.358,0,2.036-.007.492,0,.7-.217.7-.707,0-.66.005-1.321.015-1.981a.627.627,0,0,0-.689-.7c-.56,0-1.12,0-1.679,0q-3,0-6,0c-.464,0-.666.208-.667.675,0,.688,0,1.376,0,2.064,0,.449.207.648.662.652.514,0,1.027,0,1.541,0h.59V936.1h-.318c-.789,0-1.578,0-2.367,0a1.749,1.749,0,0,0-1.4.647c-.532.632-1.073,1.254-1.614,1.878-.246.284-.449.669-.762.813a2.961,2.961,0,0,1-1.11.052,1.087,1.087,0,0,1-.137,0,1.881,1.881,0,0,0-1.863,1.84c.04.418.006.843.006,1.265v.251h-1.122c0-.892-.01-1.762,0-2.632.008-.453-.206-.716-.656-.718q-1.045-.005-2.091,0c-.437,0-.646.206-.646.637q0,4.431,0,8.862a.572.572,0,0,0,.646.641q1.033,0,2.064,0c.472,0,.667-.193.669-.669,0-.8,0-1.6,0-2.394,0-.1.008-.194.013-.292h1.117c0,.531,0,1.043,0,1.554a1.832,1.832,0,0,0,1.8,1.8c.358,0,.717-.015,1.073.01a.623.623,0,0,1,.389.178c.772.872,1.529,1.758,2.292,2.638a1.585,1.585,0,0,0,1.239.562q3.564.009,7.128,0a1.7,1.7,0,0,0,1.257-.527q1.994-2.034,3.993-4.063a1.784,1.784,0,0,0,.551-1.332c0-.272,0-.544,0-.824h.564v.308c0,.615,0,1.229,0,1.844a.572.572,0,0,0,.643.647q1.059.006,2.119,0a.566.566,0,0,0,.623-.637q0-4.431,0-8.862A.574.574,0,0,0-1366.515,938.924Zm-23.059,6.2h-1.217c-.936,0-1.017.081-1.017,1.019v2.373c-.335,0-.628-.009-.92,0-.181.007-.212-.078-.211-.233.006-.513,0-1.027,0-1.54,0-1.943.008-3.887,0-5.83,0-.248.075-.321.313-.3.262.019.526,0,.818,0,0,.293,0,.556,0,.82,0,.642,0,1.283,0,1.925a.572.572,0,0,0,.642.646c.522.005,1.044,0,1.588,0Zm8.209-11.836h-.284v-1.1h6.732v1.1h-1.158c-.321,0-.642,0-.963,0-.464,0-.676.213-.677.67,0,.606,0,1.211,0,1.816v.321h-1.125c0-.171,0-.332,0-.493,0-.55.009-1.1.016-1.65a.606.606,0,0,0-.643-.661C-1380.1,933.284-1380.732,933.286-1381.365,933.285Zm14.33,14.633h-1.1v-.925c0-.422.005-.844,0-1.266a.563.563,0,0,0-.6-.605q-.812-.01-1.623,0a.557.557,0,0,0-.592.611c0,.468.014.936-.009,1.4a.723.723,0,0,1-.178.435q-2.012,2.073-4.05,4.122a.708.708,0,0,1-.454.184q-3.55.018-7.1,0a.668.668,0,0,1-.436-.217q-1.245-1.414-2.461-2.855a.743.743,0,0,0-.613-.3c-.5.006-1.009,0-1.513,0-.472-.006-.653-.183-.653-.651q0-3.275,0-6.549c0-.511.188-.688.706-.689.468,0,.936-.009,1.4.006a.784.784,0,0,0,.668-.3c.786-.921,1.585-1.831,2.366-2.755a.829.829,0,0,1,.7-.328c3.688.01,7.375.006,11.062.007.462,0,.563.1.563.566q0,2.188,0,4.376c0,.5.184.684.675.686s1.009,0,1.514,0a.564.564,0,0,0,.628-.629c0-.715,0-1.429,0-2.175h1.1Z" transform="translate(0)" fill="#606060"/> <path id="Path_2488" data-name="Path 2488" d="M-1366.515,938.924q-1.059-.01-2.119,0a.561.561,0,0,0-.626.633c-.007.633,0,1.266,0,1.9,0,.088,0,.177,0,.26-.56.083-.561.083-.561-.431,0-1.138-.034-2.276.014-3.412a1.8,1.8,0,0,0-1.793-1.785c-1.568.042-3.137.013-4.706.013-.088,0-.176-.008-.268-.011v-1.63a.316.316,0,0,1,.077-.031c.679,0,1.358,0,2.036-.007.492,0,.7-.217.7-.707,0-.66.005-1.321.015-1.981a.627.627,0,0,0-.689-.7c-.56,0-1.12,0-1.679,0q-3,0-6,0c-.464,0-.666.208-.667.675,0,.688,0,1.376,0,2.064,0,.449.207.648.662.652.514,0,1.027,0,1.541,0h.59V936.1h-.318c-.789,0-1.578,0-2.367,0a1.749,1.749,0,0,0-1.4.647c-.532.632-1.073,1.254-1.614,1.878-.246.284-.449.669-.762.813a2.961,2.961,0,0,1-1.11.052,1.087,1.087,0,0,1-.137,0,1.881,1.881,0,0,0-1.863,1.84c.04.418.006.843.006,1.265v.251h-1.122c0-.892-.01-1.762,0-2.632.008-.453-.206-.716-.656-.718q-1.045-.005-2.091,0c-.437,0-.646.206-.646.637q0,4.431,0,8.862a.572.572,0,0,0,.646.641q1.033,0,2.064,0c.472,0,.667-.193.669-.669,0-.8,0-1.6,0-2.394,0-.1.008-.194.013-.292h1.117c0,.531,0,1.043,0,1.554a1.832,1.832,0,0,0,1.8,1.8c.358,0,.717-.015,1.073.01a.623.623,0,0,1,.389.178c.772.872,1.529,1.758,2.292,2.638a1.585,1.585,0,0,0,1.239.562q3.564.009,7.128,0a1.7,1.7,0,0,0,1.257-.527q1.994-2.034,3.993-4.063a1.784,1.784,0,0,0,.551-1.332c0-.272,0-.544,0-.824h.564v.308c0,.615,0,1.229,0,1.844a.572.572,0,0,0,.643.647q1.059.006,2.119,0a.566.566,0,0,0,.623-.637q0-4.431,0-8.862A.574.574,0,0,0-1366.515,938.924Zm-23.059,6.2h-1.217c-.936,0-1.017.081-1.017,1.019v2.373c-.335,0-.628-.009-.92,0-.181.007-.212-.078-.211-.233.006-.513,0-1.027,0-1.54,0-1.943.008-3.887,0-5.83,0-.248.075-.321.313-.3.262.019.526,0,.818,0,0,.293,0,.556,0,.82,0,.642,0,1.283,0,1.925a.572.572,0,0,0,.642.646c.522.005,1.044,0,1.588,0Zm8.209-11.836h-.284v-1.1h6.732v1.1h-1.158c-.321,0-.642,0-.963,0-.464,0-.676.213-.677.67,0,.606,0,1.211,0,1.816v.321h-1.125c0-.171,0-.332,0-.493,0-.55.009-1.1.016-1.65a.606.606,0,0,0-.643-.661C-1380.1,933.284-1380.732,933.286-1381.365,933.285Zm14.33,14.633h-1.1v-.925c0-.422.005-.844,0-1.266a.563.563,0,0,0-.6-.605q-.812-.01-1.623,0a.557.557,0,0,0-.592.611c0,.468.014.936-.009,1.4a.723.723,0,0,1-.178.435q-2.012,2.073-4.05,4.122a.708.708,0,0,1-.454.184q-3.55.018-7.1,0a.668.668,0,0,1-.436-.217q-1.245-1.414-2.461-2.855a.743.743,0,0,0-.613-.3c-.5.006-1.009,0-1.513,0-.472-.006-.653-.183-.653-.651q0-3.275,0-6.549c0-.511.188-.688.706-.689.468,0,.936-.009,1.4.006a.784.784,0,0,0,.668-.3c.786-.921,1.585-1.831,2.366-2.755a.829.829,0,0,1,.7-.328c3.688.01,7.375.006,11.062.007.462,0,.563.1.563.566q0,2.188,0,4.376c0,.5.184.684.675.686s1.009,0,1.514,0a.564.564,0,0,0,.628-.629c0-.715,0-1.429,0-2.175h1.1Z" transform="translate(0)" fill="#606060"/>
<path id="Path_2489" data-name="Path 2489" d="M-1162.721,1084.808c-.943,0-1.82-.005-2.7.009-.084,0-.2.114-.243.2q-1.313,2.606-2.612,5.219c-.034.069-.059.142-.1.247h2.813l-1.641,4.932.054.024,4.431-6.1h-2.834Z" transform="translate(-213.288 -145.408)" fill="#e51636"/> <path id="Path_2489" data-name="Path 2489" d="M-1162.721,1084.808c-.943,0-1.82-.005-2.7.009-.084,0-.2.114-.243.2q-1.313,2.606-2.612,5.219c-.034.069-.059.142-.1.247h2.813l-1.641,4.932.054.024,4.431-6.1h-2.834Z" transform="translate(-213.288 -145.408)" fill="#000000"/>
</g> </g>
</g> </g>
</svg>&nbsp;&nbsp;${value}</p>` </svg>&nbsp;&nbsp;${value}</p>`
@ -61,34 +51,34 @@ frappe.query_reports["_Procedure Report"] = {
<g id="car" transform="translate(8.425 4.295)"> <g id="car" transform="translate(8.425 4.295)">
<g id="Group_550" data-name="Group 550"> <g id="Group_550" data-name="Group 550">
<g id="Group_549" data-name="Group 549"> <g id="Group_549" data-name="Group 549">
<path id="Path_452" data-name="Path 452" d="M-86.141,788.49l-1.6-3.759a.877.877,0,0,0-.808-.533H-95.4a.877.877,0,0,0-.808.533l-1.6,3.759a2.054,2.054,0,0,0-1.2,1.866V792.7a.881.881,0,0,0,.879.879h.289v1.463a.881.881,0,0,0,.879.879h1.174a.882.882,0,0,0,.885-.879h0V793.58h5.87v1.462a.881.881,0,0,0,.879.879h1.174a.882.882,0,0,0,.879-.879V793.58h.289a.883.883,0,0,0,.879-.879v-2.345A2.057,2.057,0,0,0-86.141,788.49Zm-9.532-3.526a.286.286,0,0,1,.272-.186h6.847a.288.288,0,0,1,.269.176l1.43,3.346H-97.108Zm.176,10.079a.29.29,0,0,1-.289.289h-1.177a.289.289,0,0,1-.289-.289h0V793.58H-95.5Zm8.5.289h-1.177a.289.289,0,0,1-.289-.289h0V793.58H-86.7v1.462h0a.291.291,0,0,1-.282.3H-87Zm1.174-2.345H-98.137a.289.289,0,0,1-.289-.289h0v-2.341a1.465,1.465,0,0,1,1.465-1.465h9.976a1.466,1.466,0,0,1,1.465,1.465V792.7h0a.29.29,0,0,1-.283.295h-.017Z" transform="translate(99.016 -784.197)" fill="#e51636"/> <path id="Path_452" data-name="Path 452" d="M-86.141,788.49l-1.6-3.759a.877.877,0,0,0-.808-.533H-95.4a.877.877,0,0,0-.808.533l-1.6,3.759a2.054,2.054,0,0,0-1.2,1.866V792.7a.881.881,0,0,0,.879.879h.289v1.463a.881.881,0,0,0,.879.879h1.174a.882.882,0,0,0,.885-.879h0V793.58h5.87v1.462a.881.881,0,0,0,.879.879h1.174a.882.882,0,0,0,.879-.879V793.58h.289a.883.883,0,0,0,.879-.879v-2.345A2.057,2.057,0,0,0-86.141,788.49Zm-9.532-3.526a.286.286,0,0,1,.272-.186h6.847a.288.288,0,0,1,.269.176l1.43,3.346H-97.108Zm.176,10.079a.29.29,0,0,1-.289.289h-1.177a.289.289,0,0,1-.289-.289h0V793.58H-95.5Zm8.5.289h-1.177a.289.289,0,0,1-.289-.289h0V793.58H-86.7v1.462h0a.291.291,0,0,1-.282.3H-87Zm1.174-2.345H-98.137a.289.289,0,0,1-.289-.289h0v-2.341a1.465,1.465,0,0,1,1.465-1.465h9.976a1.466,1.466,0,0,1,1.465,1.465V792.7h0a.29.29,0,0,1-.283.295h-.017Z" transform="translate(99.016 -784.197)" fill="#000000"/>
</g> </g>
</g> </g>
<g id="Group_552" data-name="Group 552" transform="translate(1.174 5.279)"> <g id="Group_552" data-name="Group 552" transform="translate(1.174 5.279)">
<g id="Group_551" data-name="Group 551"> <g id="Group_551" data-name="Group 551">
<path id="Path_453" data-name="Path 453" d="M-96.739,787.848a1.464,1.464,0,0,0-1.465,1.465,1.465,1.465,0,0,0,1.465,1.465,1.465,1.465,0,0,0,1.465-1.465A1.466,1.466,0,0,0-96.739,787.848Zm0,2.345a.879.879,0,0,1-.879-.879.879.879,0,0,1,.879-.879.88.88,0,0,1,.879.879.882.882,0,0,1-.879.879Z" transform="translate(98.204 -787.848)" fill="#e51636"/> <path id="Path_453" data-name="Path 453" d="M-96.739,787.848a1.464,1.464,0,0,0-1.465,1.465,1.465,1.465,0,0,0,1.465,1.465,1.465,1.465,0,0,0,1.465-1.465A1.466,1.466,0,0,0-96.739,787.848Zm0,2.345a.879.879,0,0,1-.879-.879.879.879,0,0,1,.879-.879.88.88,0,0,1,.879.879.882.882,0,0,1-.879.879Z" transform="translate(98.204 -787.848)" fill="#000000"/>
</g> </g>
</g> </g>
<g id="Group_554" data-name="Group 554" transform="translate(9.97 5.279)"> <g id="Group_554" data-name="Group 554" transform="translate(9.97 5.279)">
<g id="Group_553" data-name="Group 553"> <g id="Group_553" data-name="Group 553">
<path id="Path_454" data-name="Path 454" d="M-90.655,787.848a1.464,1.464,0,0,0-1.465,1.465,1.465,1.465,0,0,0,1.465,1.465,1.465,1.465,0,0,0,1.465-1.465A1.466,1.466,0,0,0-90.655,787.848Zm0,2.345a.879.879,0,0,1-.879-.879.879.879,0,0,1,.879-.879.88.88,0,0,1,.879.879.882.882,0,0,1-.879.879Z" transform="translate(92.12 -787.848)" fill="#e51636"/> <path id="Path_454" data-name="Path 454" d="M-90.655,787.848a1.464,1.464,0,0,0-1.465,1.465,1.465,1.465,0,0,0,1.465,1.465,1.465,1.465,0,0,0,1.465-1.465A1.466,1.466,0,0,0-90.655,787.848Zm0,2.345a.879.879,0,0,1-.879-.879.879.879,0,0,1,.879-.879.88.88,0,0,1,.879.879.882.882,0,0,1-.879.879Z" transform="translate(92.12 -787.848)" fill="#000000"/>
</g> </g>
</g> </g>
<g id="Group_556" data-name="Group 556" transform="translate(4.683 7.038)"> <g id="Group_556" data-name="Group 556" transform="translate(4.683 7.038)">
<g id="Group_555" data-name="Group 555"> <g id="Group_555" data-name="Group 555">
<path id="Path_455" data-name="Path 455" d="M-91.37,789.065h-4.112a.294.294,0,0,0-.295.294.294.294,0,0,0,.295.295h4.1a.294.294,0,0,0,.294-.295.294.294,0,0,0-.294-.294Z" transform="translate(95.777 -789.065)" fill="#e51636"/> <path id="Path_455" data-name="Path 455" d="M-91.37,789.065h-4.112a.294.294,0,0,0-.295.294.294.294,0,0,0,.295.295h4.1a.294.294,0,0,0,.294-.295.294.294,0,0,0-.294-.294Z" transform="translate(95.777 -789.065)" fill="#000000"/>
</g> </g>
</g> </g>
<g id="Group_558" data-name="Group 558" transform="translate(4.683 5.864)"> <g id="Group_558" data-name="Group 558" transform="translate(4.683 5.864)">
<g id="Group_557" data-name="Group 557"> <g id="Group_557" data-name="Group 557">
<path id="Path_456" data-name="Path 456" d="M-91.37,788.253h-4.112a.294.294,0,0,0-.295.294.294.294,0,0,0,.295.295h4.1a.294.294,0,0,0,.294-.295.294.294,0,0,0-.294-.294Z" transform="translate(95.777 -788.253)" fill="#e51636"/> <path id="Path_456" data-name="Path 456" d="M-91.37,788.253h-4.112a.294.294,0,0,0-.295.294.294.294,0,0,0,.295.295h4.1a.294.294,0,0,0,.294-.295.294.294,0,0,0-.294-.294Z" transform="translate(95.777 -788.253)" fill="#000000"/>
</g> </g>
</g> </g>
</g> </g>
</g> </g>
<g id="Group_3056" data-name="Group 3056" transform="translate(21.591 11.364)"> <g id="Group_3056" data-name="Group 3056" transform="translate(21.591 11.364)">
<ellipse id="Ellipse_91" data-name="Ellipse 91" cx="7" cy="6.5" rx="7" ry="6.5" transform="translate(-0.477 0.136)" fill="#fff"/> <ellipse id="Ellipse_91" data-name="Ellipse 91" cx="7" cy="6.5" rx="7" ry="6.5" transform="translate(-0.477 0.136)" fill="#fff"/>
<path id="Path_2603" data-name="Path 2603" d="M-1045.072,205.021l-2.947-2.948a4.821,4.821,0,0,0,1.12-3.1,4.862,4.862,0,0,0-4.857-4.857h0a4.825,4.825,0,0,0-3.434,1.423,4.825,4.825,0,0,0-1.422,3.434,4.824,4.824,0,0,0,1.423,3.434,4.825,4.825,0,0,0,3.434,1.422,4.82,4.82,0,0,0,3.1-1.12l2.948,2.948a.447.447,0,0,0,.317.132.447.447,0,0,0,.317-.132A.449.449,0,0,0-1045.072,205.021Zm-6.684-2.091a3.933,3.933,0,0,1-2.8-1.159,3.933,3.933,0,0,1-1.16-2.8,3.933,3.933,0,0,1,1.16-2.8,3.933,3.933,0,0,1,2.8-1.16v0a3.964,3.964,0,0,1,3.959,3.959,3.933,3.933,0,0,1-1.16,2.8A3.933,3.933,0,0,1-1051.756,202.93Z" transform="translate(1058.064 -192.663)" fill="#e51636"/> <path id="Path_2603" data-name="Path 2603" d="M-1045.072,205.021l-2.947-2.948a4.821,4.821,0,0,0,1.12-3.1,4.862,4.862,0,0,0-4.857-4.857h0a4.825,4.825,0,0,0-3.434,1.423,4.825,4.825,0,0,0-1.422,3.434,4.824,4.824,0,0,0,1.423,3.434,4.825,4.825,0,0,0,3.434,1.422,4.82,4.82,0,0,0,3.1-1.12l2.948,2.948a.447.447,0,0,0,.317.132.447.447,0,0,0,.317-.132A.449.449,0,0,0-1045.072,205.021Zm-6.684-2.091a3.933,3.933,0,0,1-2.8-1.159,3.933,3.933,0,0,1-1.16-2.8,3.933,3.933,0,0,1,1.16-2.8,3.933,3.933,0,0,1,2.8-1.16v0a3.964,3.964,0,0,1,3.959,3.959,3.933,3.933,0,0,1-1.16,2.8A3.933,3.933,0,0,1-1051.756,202.93Z" transform="translate(1058.064 -192.663)" fill="#000000"/>
</g> </g>
</g> </g>
</g> </g>
@ -96,7 +86,7 @@ frappe.query_reports["_Procedure Report"] = {
</svg>&nbsp;&nbsp;${value}</p>` </svg>&nbsp;&nbsp;${value}</p>`
break; break;
case 0: case 0:
value = `<p><svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="18px" viewBox="0 0 24 24" width="18px" fill="#ef6d81"><g><rect fill="none" height="24" width="24" y="0"/></g><g><g><path d="M18.92,6.01C18.72,5.42,18.16,5,17.5,5h-11C5.84,5,5.29,5.42,5.08,6.01L3,12v8c0,0.55,0.45,1,1,1h1c0.55,0,1-0.45,1-1v-1 h12v1c0,0.55,0.45,1,1,1h1c0.55,0,1-0.45,1-1v-8L18.92,6.01z M6.85,7h10.29l1.04,3H5.81L6.85,7z M19,17H5v-5h14V17z"/><circle cx="7.5" cy="14.5" r="1.5"/><circle cx="16.5" cy="14.5" r="1.5"/></g></g></svg><b>&nbsp;&nbsp;${value}</b></p>` value = `<p><svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="18px" viewBox="0 0 24 24" width="18px" fill="#606060"><g><rect fill="none" height="24" width="24" y="0"/></g><g><g><path d="M18.92,6.01C18.72,5.42,18.16,5,17.5,5h-11C5.84,5,5.29,5.42,5.08,6.01L3,12v8c0,0.55,0.45,1,1,1h1c0.55,0,1-0.45,1-1v-1 h12v1c0,0.55,0.45,1,1,1h1c0.55,0,1-0.45,1-1v-8L18.92,6.01z M6.85,7h10.29l1.04,3H5.81L6.85,7z M19,17H5v-5h14V17z"/><circle cx="7.5" cy="14.5" r="1.5"/><circle cx="16.5" cy="14.5" r="1.5"/></g></g></svg><b>&nbsp;&nbsp;${value}</b></p>`
break; break;
default: default:
value = `<p>&nbsp;&nbsp;<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 40 40"> value = `<p>&nbsp;&nbsp;<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 40 40">
@ -104,7 +94,7 @@ frappe.query_reports["_Procedure Report"] = {
<rect id="Rectangle_1706" data-name="Rectangle 1706" width="40" height="40" transform="translate(2579 2008)" fill="none"/> <rect id="Rectangle_1706" data-name="Rectangle 1706" width="40" height="40" transform="translate(2579 2008)" fill="none"/>
<g id="Group_3453" data-name="Group 3453" transform="translate(-4.215 -1.96)"> <g id="Group_3453" data-name="Group 3453" transform="translate(-4.215 -1.96)">
<circle id="Ellipse_97" data-name="Ellipse 97" cx="9" cy="9" r="9" transform="translate(2588.215 2020.96)" fill="#606060"/> <circle id="Ellipse_97" data-name="Ellipse 97" cx="9" cy="9" r="9" transform="translate(2588.215 2020.96)" fill="#606060"/>
<path id="Path_2934" data-name="Path 2934" d="M6.732,17.942a.856.856,0,0,0,.68-.375,1.6,1.6,0,0,0,0-1.812L2.322,8.971l5.09-6.783a1.6,1.6,0,0,0,0-1.812.8.8,0,0,0-1.36,0L.282,8.065a1.6,1.6,0,0,0,0,1.812l5.77,7.689A.857.857,0,0,0,6.732,17.942Z" transform="translate(2617.437 2038.931) rotate(180)" fill="#e51636"/> <path id="Path_2934" data-name="Path 2934" d="M6.732,17.942a.856.856,0,0,0,.68-.375,1.6,1.6,0,0,0,0-1.812L2.322,8.971l5.09-6.783a1.6,1.6,0,0,0,0-1.812.8.8,0,0,0-1.36,0L.282,8.065a1.6,1.6,0,0,0,0,1.812l5.77,7.689A.857.857,0,0,0,6.732,17.942Z" transform="translate(2617.437 2038.931) rotate(180)" fill="#000000"/>
</g> </g>
</g> </g>
</svg>&nbsp;&nbsp;&nbsp;${value}</p>` </svg>&nbsp;&nbsp;&nbsp;${value}</p>`
@ -135,21 +125,52 @@ frappe.query_reports["_Procedure Report"] = {
} }
} }
if (data && column.fieldname == "workflow_state") {
column.link_onclick = "frappe.query_reports['_Procedure Report'].set_route(" + JSON.stringify(data.procedure) + ")" if(data && String(column.fieldname).slice(3)=='workflow_state'){
if (value !== undefined){
value = `<span>
<svg xmlns="http://www.w3.org/2000/svg" height="18px" viewBox="0 0 24 24" width="18px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-2zm-3-4h8v2H8z"/></svg>
&nbsp&nbsp ${value} </span>`
var langCode = String(column.fieldname).slice(0,2)
var proc = String(data.procedure).slice(0,-2)
column.link_onclick = "frappe.query_reports['_Procedure Report'].set_route(" + JSON.stringify(proc+langCode) + ")"
}
}
if(data && String(column.fieldname).slice(2) == '_active_status'){
switch(data.indent){
case 2:
if(value !== undefined){
newValue = ""
val = String(value).split(' / ');
switch (val[0]) {
case "Active":
newValue = `<span class="filterable indicator-pill green ellipsis"> ${val[0]} </span>`
break;
case "Inactive":
newValue = `<span class="filterable indicator-pill red ellipsis"> ${val[0]} </span>`
break;
}
value = newValue +" / "+ `<span class="filterable indicator-pill red ellipsis"> ${val[1]} </span>`
}
break;
case 3:
column.align= 'center'
if (value !==undefined){
value = `<span class="filterable indicator-pill orange ellipsis"> ${value}</span>`
}
break;
}
} }
value = default_formatter(value, row, column, data); value = default_formatter(value, row, column, data);
return value; return value;
}, },
"set_route": function (data) { "set_route": function (data) {
console.log(data)
frappe.set_route("Form", "Procedure", data) frappe.set_route("Form", "Procedure", data)
}, },
// "set_route_to_procedure": function (data) {
// da = "http://192.168.1.58:81/printview?doctype=Procedure&name=" + data + "&format=Standard&no_letterhead=1&letterhead=No%20Letterhead&settings=%7B%7D&_lang=en"
// window.open(da);
// },
"tree": true, "tree": true,
"name_field": "procedure_name", "name_field": "procedure_name",
"parent_field": "", "parent_field": "",

140
smart_service/mahindra_smart_service/report/_procedure_report/_procedure_report.py

@ -5,6 +5,10 @@ import functools
import frappe import frappe
from frappe import _ from frappe import _
current_db_name = frappe.conf.get("db_name")
custom_lang = frappe.db.sql('''SELECT lang_code,lang_name FROM {}.`tabCustom Languages` where lang_code <> 'en'; '''.format(
current_db_name), as_dict=True)
def execute(filters=None): def execute(filters=None):
validate_filters(filters) validate_filters(filters)
@ -12,12 +16,14 @@ def execute(filters=None):
columns = get_columns() columns = get_columns()
return columns, data return columns, data
def validate_filters(filters): def validate_filters(filters):
return return
def get_data(filters): def get_data(filters):
fil = None fil = None
if(filters.variant_mapping!=None): if filters.variant_mapping != None:
fil = filters.variant_mapping + "%" fil = filters.variant_mapping + "%"
data = frappe.db.sql( data = frappe.db.sql(
@ -31,18 +37,17 @@ def get_data(filters):
inner join tabProcedure inner join tabProcedure
on `tabSystem Mapping_Sub System`.`procedure` = tabProcedure.name on `tabSystem Mapping_Sub System`.`procedure` = tabProcedure.name
where `tabSystem Mapping_Sub System`.parent LIKE %s where `tabSystem Mapping_Sub System`.parent LIKE %s
and substring(`tabProcedure_Details`.parent,-2) = 'en'
GROUP by `tabSystem Mapping_Sub System`.`procedure` ,tabProcedure_Details.procedure_name ,tabProcedure_Details.step_name GROUP by `tabSystem Mapping_Sub System`.`procedure` ,tabProcedure_Details.procedure_name ,tabProcedure_Details.step_name
order by `tabSystem Mapping_Sub System`.systems ,`tabSystem Mapping_Sub System`.sub_systems,`procedure`,idx; order by `tabSystem Mapping_Sub System`.systems ,`tabSystem Mapping_Sub System`.sub_systems,`procedure`,idx;
""",fil,as_dict=True) """, fil, as_dict=True)
filterData = filters.variant_mapping filterData = filters.variant_mapping
if(filterData!=None and len(data) > 0): if(filterData != None and len(data) > 0):
data = modifyData(data,filterData) data = modifyData(data, filterData)
return data return data
def modifyData(dataInput,filterParent): def modifyData(dataInput, filterParent):
list1 = [] list1 = []
inputData = modifyChildData(dataInput, indent=4, header=0) inputData = modifyChildData(dataInput, indent=4, header=0)
parentAppend = addParent(filterParent, indent=0, header=1) parentAppend = addParent(filterParent, indent=0, header=1)
@ -57,11 +62,12 @@ def modifyData(dataInput,filterParent):
ssMap, ssSize = getParentMap(sMap[i], 'sub_systems') ssMap, ssSize = getParentMap(sMap[i], 'sub_systems')
ssMapAppend = appendToDic2(ssMap, indent=2, header=1) ssMapAppend = appendToDic2(ssMap, indent=2, header=1)
for j in ssMapAppend: for j in ssMapAppend:
val = j['procedure_name'] val = j['procedure_name']
proc = j['procedure']
procMap, procSize = getParentMap(ssMap[val], 'procedure_name') procMap, procSize = getParentMap(ssMap[val], 'procedure_name')
procValuesDic = appendToDic3(procMap, procSize, j, indent=3, header = 0) procValuesDic = appendToDic3(
procMap, procSize, j, indent=3, header=0, procedure=proc)
j['length'] = len(procValuesDic) j['length'] = len(procValuesDic)
list1.append(j) list1.append(j)
@ -71,13 +77,14 @@ def modifyData(dataInput,filterParent):
pval = d['procedure_name'] pval = d['procedure_name']
for s in procMap[pval]: for s in procMap[pval]:
s['procedure_name']= s['step_name'] s['procedure_name'] = s['step_name']
list1.append(s) list1.append(s)
appendData = addDuplicateData(list1) appendData = addDuplicateData(list1)
appendData = removeDuplicateAndHeader(appendData) appendData = removeDuplicateAndHeader(appendData)
return appendData return appendData
def appendToDic1(mapData, parent, indent, header): def appendToDic1(mapData, parent, indent, header):
mapDataAppend = [] mapDataAppend = []
for d in mapData: for d in mapData:
@ -94,6 +101,7 @@ def appendToDic1(mapData, parent, indent, header):
mapDataAppend.append(keyDict) mapDataAppend.append(keyDict)
return mapDataAppend return mapDataAppend
def appendToDic2(mapData, indent, header): def appendToDic2(mapData, indent, header):
mapDataAppend = [] mapDataAppend = []
for d in mapData: for d in mapData:
@ -103,30 +111,78 @@ def appendToDic2(mapData, indent, header):
'sub_systems': da['sub_systems'], 'sub_systems': da['sub_systems'],
'parent': da['parent'], 'parent': da['parent'],
'procedure_name': d, 'procedure_name': d,
'active_status':da['active_status'], 'active_status': da['active_status'],
'indent': indent, 'indent': indent,
'header': header, 'header': header,
'workflow_state': da['workflow_state'], 'en_workflow_state': da['workflow_state'],
'procedure': da['procedure'], 'procedure': da['procedure'],
} }
dic1 = {}
for c in custom_lang:
other_proc = da['procedure']
other_proc = other_proc[:-2]+c['lang_code']
others = frappe.db.sql('''select tabProcedure.active_status,count(distinct(`tabProcedure_Details`.procedure_name)) as syscount,tabProcedure.workflow_state
from (_d6463952657fa86c.`tabProcedure_Details` inner join _d6463952657fa86c.`tabProcedure` on `tabProcedure_Details`.`parent` = `tabProcedure`.`name`)
where `tabProcedure`.name = '{}'; '''.format(other_proc), as_dict=True)
if len(others) > 0:
others = others[0]
if others['active_status'] is not None:
if others['syscount'] == 1:
dic1['{}_active_status'.format(
c['lang_code'])] = others['active_status'] + ' / ' + str(others['syscount']) + ' Procedure'
else:
dic1['{}_active_status'.format(
c['lang_code'])] = others['active_status'] + ' / ' + str(others['syscount']) + ' Procedures'
dic1['{}_workflow_state'.format(
c['lang_code'])] = others['workflow_state']
keyDict.update(dic1)
mapDataAppend.append(keyDict) mapDataAppend.append(keyDict)
return mapDataAppend return mapDataAppend
def appendToDic3(mapData,procSize,j,indent,header):
def appendToDic3(mapData, procSize, j, indent, header, procedure):
mapDataAppend = [] mapDataAppend = []
i = 0 i = 0
dic1 = {}
list1 = []
for c in custom_lang:
list2 = []
procedure = procedure[:-2]+c['lang_code']
other_step_count = frappe.db.sql(
'''select count(distinct(step_name)) as count from _d6463952657fa86c.tabProcedure_Details where parent= '{}' group by(procedure_name) order by idx;'''.format(procedure), as_list=True)
for l in other_step_count:
list2.append(l[0])
list1.append(list2)
for u in mapData: for u in mapData:
procDict = { procDict = {
'systems': mapData[u][0]['systems'], 'systems': mapData[u][0]['systems'],
'sub_systems': mapData[u][0]['sub_systems'], 'sub_systems': mapData[u][0]['sub_systems'],
'parent': j["parent"], 'parent': j["parent"],
'procedure_name': u, 'procedure_name': u,
'active_status': "Active",
'indent': indent, 'indent': indent,
'header': header, 'header': header,
'length': procSize[i] 'length': procSize[i],
} }
i+=1
dic2 = {}
for cus in range(len(custom_lang)):
if len(list1[cus]) > 0:
if list1[cus][i] == 1:
dic1['{}_active_status'.format(custom_lang[cus]['lang_code'])] = str(
list1[cus][i]) + " Step"
else:
dic1['{}_active_status'.format(custom_lang[cus]['lang_code'])] = str(
list1[cus][i]) + " Steps"
dic2.update(dic1)
procDict.update(dic1)
i += 1
mapDataAppend.append(procDict) mapDataAppend.append(procDict)
return mapDataAppend return mapDataAppend
@ -137,6 +193,7 @@ def modifyChildData(childData, indent, header):
a.update({'header': header}) a.update({'header': header})
return childData return childData
def addParent(variantParent, indent, header): def addParent(variantParent, indent, header):
varParDict = [{ varParDict = [{
'systems': "", 'systems': "",
@ -144,10 +201,11 @@ def addParent(variantParent, indent, header):
'parent': variantParent, 'parent': variantParent,
'procedure_name': variantParent, 'procedure_name': variantParent,
'indent': indent, 'indent': indent,
'header':header 'header': header
}] }]
return varParDict return varParDict
def getParentMap(input_list, parameter): def getParentMap(input_list, parameter):
sizeList = [] sizeList = []
parentChildMap = {} parentChildMap = {}
@ -157,6 +215,7 @@ def getParentMap(input_list, parameter):
sizeList.append(len(parentChildMap[c])) sizeList.append(len(parentChildMap[c]))
return parentChildMap, sizeList return parentChildMap, sizeList
def addDuplicateData(data1): def addDuplicateData(data1):
prevValue = "" prevValue = ""
for i in data1: for i in data1:
@ -168,6 +227,7 @@ def addDuplicateData(data1):
prevValue = i['procedure_name'] prevValue = i['procedure_name']
return data1 return data1
def removeDuplicateAndHeader(data1): def removeDuplicateAndHeader(data1):
for k in data1: for k in data1:
if k['header'] == 0: if k['header'] == 0:
@ -175,9 +235,6 @@ def removeDuplicateAndHeader(data1):
k['workflow_state'] = "" k['workflow_state'] = ""
return data1 return data1
def print(dataText):
frappe.msgprint(str(dataText))
def get_columns(): def get_columns():
columns = [ columns = [
@ -195,28 +252,39 @@ def get_columns():
"width": 100 "width": 100
}, },
{ {
"fieldname":"length", "fieldname": "length",
"label":"Elements Length", "label": "Elements Length",
"fieldtype":"Data", "fieldtype": "Data",
"width": 150 "width": 150
}, },
{ {
"fieldname": "workflow_state", "fieldname": "en_workflow_state",
"label": _("English"), "label": _("English"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Procedure", "options": "Procedure",
"width": 150 "width": 150
} }
] ]
current_db_name = frappe.conf.get("db_name")
custom_lang = frappe.db.sql("""SELECT lang_code,lang_name FROM {}.`tabCustom Languages` where lang_code <> "en" """.format(current_db_name),as_dict=1) if len(custom_lang) > 0:
lang=[] lang = []
for i in custom_lang: for i in custom_lang:
langField = { lang_status = {
"fieldname": i['lang_name'], "fieldname": "{}_active_status".format(i['lang_code']),
"label": i['lang_name'], "label": _("{}_Status".format(i['lang_name'])),
"width": 150 "fieldtype": "Data",
} "options": "",
lang.append(langField) "width": 150
columns += lang }
return columns lang_workflow = {
"fieldname": "{}_workflow_state".format(i['lang_code']),
"label": _("{}_workflow_state".format(i['lang_name'])),
"fieldtype": "Link",
"options": "Procedure",
"width": 150
}
lang.append(lang_status)
lang.append(lang_workflow)
columns += lang
return columns

BIN
smart_service/mahindra_smart_service/report/_sub_systems_translation/__pycache__/_sub_systems_translation.cpython-38.pyc

Binary file not shown.

3
smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.js

@ -14,6 +14,5 @@ frappe.query_reports["_Sub Systems Translation"] = {
} }
value = default_formatter(value, row, column, data); value = default_formatter(value, row, column, data);
return value; return value;
}
}
}; };

5
smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2021-11-18 13:02:56.502032", "modified": "2022-01-28 15:19:04.967839",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Mahindra Smart Service", "module": "Mahindra Smart Service",
"name": "_Sub Systems Translation", "name": "_Sub Systems Translation",
@ -22,9 +22,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Author"
} }
] ]
} }

78
smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.py

@ -20,7 +20,6 @@ def get_data():
custom_lang = frappe.db.sql("""SELECT lang_code FROM {}.`tabCustom Languages` where lang_code <> "en" order by lang_name""".format(current_db_name),as_list=True) custom_lang = frappe.db.sql("""SELECT lang_code FROM {}.`tabCustom Languages` where lang_code <> "en" order by lang_name""".format(current_db_name),as_list=True)
queryAppendLang = "" queryAppendLang = ""
for d in custom_lang: for d in custom_lang:
q = ", (CASE WHEN tabLang.languageCode = '%s' THEN %s.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0]) q = ", (CASE WHEN tabLang.languageCode = '%s' THEN %s.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0])
@ -56,42 +55,7 @@ def get_data():
return data return data
# data = frappe.db.sql(
# """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text
# , (CASE WHEN tabLang.languageCode = "en" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as en
# , (CASE WHEN tabLang.languageCode = "gu" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as gu
# , (CASE WHEN tabLang.languageCode = "hi" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as hi
# , (CASE WHEN tabLang.languageCode = "kn" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as kn
# , (CASE WHEN tabLang.languageCode = "ml" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ml
# , (CASE WHEN tabLang.languageCode = "mr" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as mr
# , (CASE WHEN tabLang.languageCode = "ta" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ta
# , (CASE WHEN tabLang.languageCode = "te" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as te
# From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""",as_list=True)
# return data
def get_columns(): def get_columns():
columns = [] columns = []
@ -100,47 +64,7 @@ def get_columns():
] ]
lang = [] lang = []
custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM {0}.`tabCustom Languages` where lang_code <> "en" order by lang_name""".format(current_db_name),as_dict=1) custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM {0}.`tabCustom Languages` where lang_code <> "en" order by lang_name""".format(current_db_name),as_dict=1)
# frappe.msgprint(str(custom_lang))
for d in custom_lang: for d in custom_lang:
lang.append(cstr(d["lang_name"])+ "::300") lang.append(cstr(d["lang_name"])+ "::300")
# frappe.msgprint(str(lang))
columns += lang columns += lang
return columns,lang return columns,lang
# customLang = ['en', 'hi', 'ta', 'te']
# queryAppendLang = []
# for d in customLang:
# # print(d)
# query = " ,(CASE WHEN tabLang.languageCode = '%s' THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as %s" % (d, d)
# queryAppendLang.append(query)
# actualQuery = """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text %s From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""" % (queryAppendLang[0])
# print(actualQuery)

BIN
smart_service/mahindra_smart_service/report/_systems_translation/__pycache__/_systems_translation.cpython-38.pyc

Binary file not shown.

3
smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.js

@ -14,6 +14,5 @@ frappe.query_reports["_Systems Translation"] = {
} }
value = default_formatter(value, row, column, data); value = default_formatter(value, row, column, data);
return value; return value;
}
}
}; };

5
smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2021-11-18 12:55:26.914599", "modified": "2022-01-28 15:19:13.135158",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Mahindra Smart Service", "module": "Mahindra Smart Service",
"name": "_Systems Translation", "name": "_Systems Translation",
@ -22,9 +22,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Author"
} }
] ]
} }

82
smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.py

@ -19,7 +19,6 @@ def get_data():
custom_lang = frappe.db.sql("""SELECT lang_code FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_list=True) custom_lang = frappe.db.sql("""SELECT lang_code FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_list=True)
queryAppendLang = "" queryAppendLang = ""
for d in custom_lang: for d in custom_lang:
q = ", (CASE WHEN tabLang.languageCode = '%s' THEN %s.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0]) q = ", (CASE WHEN tabLang.languageCode = '%s' THEN %s.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0])
@ -35,8 +34,6 @@ def get_data():
`tabSystems`.modified as "Modified On", `tabSystems`.modified as "Modified On",
`tabSystems`.active_status as "Status", `tabSystems`.active_status as "Status",
`tabSystems`.system_name as 'Vehicle Segment' `tabSystems`.system_name as 'Vehicle Segment'
%s %s
From %s.`tabSystems` From %s.`tabSystems`
LEFT JOIN %s.`tabTranslation` as tabTrans LEFT JOIN %s.`tabTranslation` as tabTrans
@ -52,47 +49,10 @@ def get_data():
ON %s.tabTranslation.language = tabLang.languageCode) as tabTranslation ON %s.tabTranslation.language = tabLang.languageCode) as tabTranslation
ON %s.`tabSystems`.system_name = tabTranslation.sourceText;""" % (sel,current_db_name,current_db_name,current_db_name,current_db_name,current_db_name ,queryAppendLang,current_db_name,current_db_name,current_db_name,current_db_name) ON %s.`tabSystems`.system_name = tabTranslation.sourceText;""" % (sel,current_db_name,current_db_name,current_db_name,current_db_name,current_db_name ,queryAppendLang,current_db_name,current_db_name,current_db_name,current_db_name)
data = frappe.db.sql(actualQuery,as_list=True) data = frappe.db.sql(actualQuery,as_list=True)
return data return data
# data = frappe.db.sql(
# """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text
# , (CASE WHEN tabLang.languageCode = "en" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as en
# , (CASE WHEN tabLang.languageCode = "gu" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as gu
# , (CASE WHEN tabLang.languageCode = "hi" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as hi
# , (CASE WHEN tabLang.languageCode = "kn" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as kn
# , (CASE WHEN tabLang.languageCode = "ml" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ml
# , (CASE WHEN tabLang.languageCode = "mr" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as mr
# , (CASE WHEN tabLang.languageCode = "ta" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ta
# , (CASE WHEN tabLang.languageCode = "te" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as te
# From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""",as_list=True)
# return data
def get_columns(): def get_columns():
columns = [] columns = []
@ -101,47 +61,7 @@ def get_columns():
] ]
lang = [] lang = []
custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1)
# frappe.msgprint(str(custom_lang))
for d in custom_lang: for d in custom_lang:
lang.append(cstr(d["lang_name"])+ "::300") lang.append(cstr(d["lang_name"])+ "::300")
# frappe.msgprint(str(lang))
columns += lang columns += lang
return columns,lang return columns,lang
# customLang = ['en', 'hi', 'ta', 'te']
# queryAppendLang = []
# for d in customLang:
# # print(d)
# query = " ,(CASE WHEN tabLang.languageCode = '%s' THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as %s" % (d, d)
# queryAppendLang.append(query)
# actualQuery = """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text %s From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""" % (queryAppendLang[0])
# print(actualQuery)

BIN
smart_service/mahindra_smart_service/report/_transmission_translation/__pycache__/_transmission_translation.cpython-38.pyc

Binary file not shown.

3
smart_service/mahindra_smart_service/report/_transmission_translation/_transmission_translation.js

@ -14,6 +14,5 @@ frappe.query_reports["_Transmission Translation"] = {
} }
value = default_formatter(value, row, column, data); value = default_formatter(value, row, column, data);
return value; return value;
}
}
}; };

8
smart_service/mahindra_smart_service/report/_transmission_translation/_transmission_translation.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2021-11-29 12:14:17.565403", "modified": "2022-01-28 15:18:31.653425",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Mahindra Smart Service", "module": "Mahindra Smart Service",
"name": "_Transmission Translation", "name": "_Transmission Translation",
@ -21,12 +21,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Admin"
},
{
"role": "_Master Read"
} }
] ]
} }

81
smart_service/mahindra_smart_service/report/_transmission_translation/_transmission_translation.py

@ -17,8 +17,6 @@ def execute(filters=None):
def get_data(): def get_data():
custom_lang = frappe.db.sql("""SELECT lang_code FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_list=True) custom_lang = frappe.db.sql("""SELECT lang_code FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_list=True)
queryAppendLang = "" queryAppendLang = ""
for d in custom_lang: for d in custom_lang:
q = ", (CASE WHEN tabLang.languageCode = '%s' THEN %s.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0]) q = ", (CASE WHEN tabLang.languageCode = '%s' THEN %s.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0])
@ -34,8 +32,6 @@ def get_data():
`tabTransmission`.modified as "Modified On", `tabTransmission`.modified as "Modified On",
`tabTransmission`.active_status as "Status", `tabTransmission`.active_status as "Status",
`tabTransmission`.transmission as 'Transmission' `tabTransmission`.transmission as 'Transmission'
%s %s
From %s.`tabTransmission` From %s.`tabTransmission`
LEFT JOIN %s.`tabTranslation` as tabTrans LEFT JOIN %s.`tabTranslation` as tabTrans
@ -53,45 +49,8 @@ def get_data():
data = frappe.db.sql(actualQuery,as_list=True) data = frappe.db.sql(actualQuery,as_list=True)
return data return data
# data = frappe.db.sql(
# """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text
# , (CASE WHEN tabLang.languageCode = "en" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as en
# , (CASE WHEN tabLang.languageCode = "gu" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as gu
# , (CASE WHEN tabLang.languageCode = "hi" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as hi
# , (CASE WHEN tabLang.languageCode = "kn" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as kn
# , (CASE WHEN tabLang.languageCode = "ml" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ml
# , (CASE WHEN tabLang.languageCode = "mr" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as mr
# , (CASE WHEN tabLang.languageCode = "ta" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ta
# , (CASE WHEN tabLang.languageCode = "te" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as te
# From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""",as_list=True)
# return data
def get_columns(): def get_columns():
columns = [] columns = []
@ -100,47 +59,7 @@ def get_columns():
] ]
lang = [] lang = []
custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1)
# frappe.msgprint(str(custom_lang))
for d in custom_lang: for d in custom_lang:
lang.append(cstr(d["lang_name"])+ "::220") lang.append(cstr(d["lang_name"])+ "::220")
# frappe.msgprint(str(lang))
columns += lang columns += lang
return columns,lang return columns,lang
# customLang = ['en', 'hi', 'ta', 'te']
# queryAppendLang = []
# for d in customLang:
# # print(d)
# query = " ,(CASE WHEN tabLang.languageCode = '%s' THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as %s" % (d, d)
# queryAppendLang.append(query)
# actualQuery = """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text %s From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""" % (queryAppendLang[0])
# print(actualQuery)

BIN
smart_service/mahindra_smart_service/report/_variant_translation/__pycache__/_variant_translation.cpython-38.pyc

Binary file not shown.

8
smart_service/mahindra_smart_service/report/_variant_translation/_variant_translation.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2021-11-30 12:10:32.622816", "modified": "2022-01-28 15:17:37.387567",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Mahindra Smart Service", "module": "Mahindra Smart Service",
"name": "_Variant Translation", "name": "_Variant Translation",
@ -19,14 +19,8 @@
"report_name": "_Variant Translation", "report_name": "_Variant Translation",
"report_type": "Script Report", "report_type": "Script Report",
"roles": [ "roles": [
{
"role": "_Admin"
},
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Master Read"
} }
] ]
} }

80
smart_service/mahindra_smart_service/report/_variant_translation/_variant_translation.py

@ -18,8 +18,6 @@ def execute(filters=None):
def get_data(): def get_data():
custom_lang = frappe.db.sql("""SELECT lang_code FROM `tabCustom Languages` where lang_code <> "en" order by lang_name""",as_list=True) custom_lang = frappe.db.sql("""SELECT lang_code FROM `tabCustom Languages` where lang_code <> "en" order by lang_name""",as_list=True)
queryAppendLang = "" queryAppendLang = ""
for d in custom_lang: for d in custom_lang:
q = ", (CASE WHEN tabLang.languageCode = '%s' THEN tabTranslation.translated_text ELSE null END) as %s" %(d[0],d[0]) q = ", (CASE WHEN tabLang.languageCode = '%s' THEN tabTranslation.translated_text ELSE null END) as %s" %(d[0],d[0])
@ -30,7 +28,6 @@ def get_data():
r = ",tabTranslation.%s as %s"%(d[0],d[0]) r = ",tabTranslation.%s as %s"%(d[0],d[0])
sel+= r sel+= r
actualQuery = """Select actualQuery = """Select
`tabVariant`.modified as "Modified On", `tabVariant`.modified as "Modified On",
`tabVariant`.active_status as "Status", `tabVariant`.active_status as "Status",
@ -52,46 +49,9 @@ def get_data():
ON tabTranslation.language = tabLang.languageCode) as tabTranslation ON tabTranslation.language = tabLang.languageCode) as tabTranslation
ON `tabVariant`.variant = tabTranslation.sourceText;""" % (sel ,queryAppendLang) ON `tabVariant`.variant = tabTranslation.sourceText;""" % (sel ,queryAppendLang)
data = frappe.db.sql(actualQuery,as_list=True) data = frappe.db.sql(actualQuery,as_list=True)
return data return data
# data = frappe.db.sql(
# """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text
# , (CASE WHEN tabLang.languageCode = "en" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as en
# , (CASE WHEN tabLang.languageCode = "gu" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as gu
# , (CASE WHEN tabLang.languageCode = "hi" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as hi
# , (CASE WHEN tabLang.languageCode = "kn" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as kn
# , (CASE WHEN tabLang.languageCode = "ml" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ml
# , (CASE WHEN tabLang.languageCode = "mr" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as mr
# , (CASE WHEN tabLang.languageCode = "ta" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ta
# , (CASE WHEN tabLang.languageCode = "te" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as te
# From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""",as_list=True)
# return data
def get_columns(): def get_columns():
@ -101,47 +61,7 @@ def get_columns():
] ]
lang = [] lang = []
custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1)
# frappe.msgprint(str(custom_lang))
for d in custom_lang: for d in custom_lang:
lang.append(cstr(d["lang_name"])+ "::220") lang.append(cstr(d["lang_name"])+ "::220")
# frappe.msgprint(str(lang))
columns += lang columns += lang
return columns,lang return columns,lang
# customLang = ['en', 'hi', 'ta', 'te']
# queryAppendLang = []
# for d in customLang:
# # print(d)
# query = " ,(CASE WHEN tabLang.languageCode = '%s' THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as %s" % (d, d)
# queryAppendLang.append(query)
# actualQuery = """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text %s From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""" % (queryAppendLang[0])
# print(actualQuery)

BIN
smart_service/mahindra_smart_service/report/_vehicle_segment_translation/__pycache__/_vehicle_segment_translation.cpython-38.pyc

Binary file not shown.

5
smart_service/mahindra_smart_service/report/_vehicle_segment_translation/_vehicle_segment_translation.json

@ -28,7 +28,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2021-11-16 15:10:52.636132", "modified": "2022-01-28 15:19:20.751548",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Mahindra Smart Service", "module": "Mahindra Smart Service",
"name": "_Vehicle Segment Translation", "name": "_Vehicle Segment Translation",
@ -42,9 +42,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Author"
} }
] ]
} }

78
smart_service/mahindra_smart_service/report/_vehicle_segment_translation/_vehicle_segment_translation.py

@ -53,45 +53,9 @@ def get_data():
ON %s.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""" % (sel,current_db_name,current_db_name,current_db_name,current_db_name,current_db_name ,queryAppendLang,current_db_name,current_db_name,current_db_name,current_db_name) ON %s.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""" % (sel,current_db_name,current_db_name,current_db_name,current_db_name,current_db_name ,queryAppendLang,current_db_name,current_db_name,current_db_name,current_db_name)
data = frappe.db.sql(actualQuery,as_list=True) data = frappe.db.sql(actualQuery,as_list=True)
return data return data
# data = frappe.db.sql(
# """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text
# , (CASE WHEN tabLang.languageCode = "en" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as en
# , (CASE WHEN tabLang.languageCode = "gu" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as gu
# , (CASE WHEN tabLang.languageCode = "hi" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as hi
# , (CASE WHEN tabLang.languageCode = "kn" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as kn
# , (CASE WHEN tabLang.languageCode = "ml" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ml
# , (CASE WHEN tabLang.languageCode = "mr" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as mr
# , (CASE WHEN tabLang.languageCode = "ta" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ta
# , (CASE WHEN tabLang.languageCode = "te" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as te
# From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""",as_list=True)
# return data
def get_columns(): def get_columns():
@ -101,47 +65,7 @@ def get_columns():
] ]
lang = [] lang = []
custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1)
# frappe.msgprint(str(custom_lang))
for d in custom_lang: for d in custom_lang:
lang.append(cstr(d["lang_name"])+ "::220") lang.append(cstr(d["lang_name"])+ "::220")
# frappe.msgprint(str(lang))
columns += lang columns += lang
return columns,lang return columns,lang
# customLang = ['en', 'hi', 'ta', 'te']
# queryAppendLang = []
# for d in customLang:
# # print(d)
# query = " ,(CASE WHEN tabLang.languageCode = '%s' THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as %s" % (d, d)
# queryAppendLang.append(query)
# actualQuery = """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text %s From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""" % (queryAppendLang[0])
# print(actualQuery)

BIN
smart_service/mahindra_smart_service/report/_vehicle_translation/__pycache__/_vehicle_translation.cpython-38.pyc

Binary file not shown.

3
smart_service/mahindra_smart_service/report/_vehicle_translation/_vehicle_translation.js

@ -14,6 +14,5 @@ frappe.query_reports["_Vehicle Translation"] = {
} }
value = default_formatter(value, row, column, data); value = default_formatter(value, row, column, data);
return value; return value;
}
}
}; };

5
smart_service/mahindra_smart_service/report/_vehicle_translation/_vehicle_translation.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2021-11-24 16:56:50.600660", "modified": "2022-01-28 15:18:57.499876",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Mahindra Smart Service", "module": "Mahindra Smart Service",
"name": "_Vehicle Translation", "name": "_Vehicle Translation",
@ -21,9 +21,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Admin"
} }
] ]
} }

81
smart_service/mahindra_smart_service/report/_vehicle_translation/_vehicle_translation.py

@ -17,8 +17,6 @@ def execute(filters=None):
def get_data(): def get_data():
custom_lang = frappe.db.sql("""SELECT lang_code FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_list=True) custom_lang = frappe.db.sql("""SELECT lang_code FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_list=True)
queryAppendLang = "" queryAppendLang = ""
for d in custom_lang: for d in custom_lang:
q = ", (CASE WHEN tabLang.languageCode = '%s' THEN %s.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0]) q = ", (CASE WHEN tabLang.languageCode = '%s' THEN %s.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0])
@ -34,8 +32,6 @@ def get_data():
`tabVehicle`.modified as "Modified On", `tabVehicle`.modified as "Modified On",
`tabVehicle`.active_status as "Status", `tabVehicle`.active_status as "Status",
`tabVehicle`.vehicle as 'Vehicle' `tabVehicle`.vehicle as 'Vehicle'
%s %s
From %s.`tabVehicle` From %s.`tabVehicle`
LEFT JOIN %s.`tabTranslation` as tabTrans LEFT JOIN %s.`tabTranslation` as tabTrans
@ -53,45 +49,8 @@ def get_data():
data = frappe.db.sql(actualQuery,as_list=True) data = frappe.db.sql(actualQuery,as_list=True)
return data return data
# data = frappe.db.sql(
# """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text
# , (CASE WHEN tabLang.languageCode = "en" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as en
# , (CASE WHEN tabLang.languageCode = "gu" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as gu
# , (CASE WHEN tabLang.languageCode = "hi" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as hi
# , (CASE WHEN tabLang.languageCode = "kn" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as kn
# , (CASE WHEN tabLang.languageCode = "ml" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ml
# , (CASE WHEN tabLang.languageCode = "mr" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as mr
# , (CASE WHEN tabLang.languageCode = "ta" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as ta
# , (CASE WHEN tabLang.languageCode = "te" THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as te
# From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""",as_list=True)
# return data
def get_columns(): def get_columns():
columns = [] columns = []
@ -100,47 +59,7 @@ def get_columns():
] ]
lang = [] lang = []
custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1) custom_lang = frappe.db.sql("""SELECT lang_code,lang_name,active_status FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_dict=1)
# frappe.msgprint(str(custom_lang))
for d in custom_lang: for d in custom_lang:
lang.append(cstr(d["lang_name"])+ "::220") lang.append(cstr(d["lang_name"])+ "::220")
# frappe.msgprint(str(lang))
columns += lang columns += lang
return columns,lang return columns,lang
# customLang = ['en', 'hi', 'ta', 'te']
# queryAppendLang = []
# for d in customLang:
# # print(d)
# query = " ,(CASE WHEN tabLang.languageCode = '%s' THEN _d6463952657fa86c.tabTranslation.translated_text ELSE null END) as %s" % (d, d)
# queryAppendLang.append(query)
# actualQuery = """Select
# `tabVehicle Segment`.modified as "Modified On",
# `tabVehicle Segment`.active_status as "Status",
# `tabVehicle Segment`.vehicle_segment as 'Vehicle Segment' ,
# `tabVehicle Segment`.vehicle_segment as 'English',
# tabTranslation.hi as हिंदी,
# tabTranslation.ta as தமிழ்,
# tabTranslation.gu as ગુજરાતી,
# tabTranslation.kn as ಕನ್ನಡ,
# tabTranslation.ml as മലയാളം, tabTranslation.mr as मराठी,tabTranslation.te as తెలుగు
# From _d6463952657fa86c.`tabVehicle Segment`
# LEFT JOIN _d6463952657fa86c.`tabTranslation` as tabTrans
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTrans.source_text
# LEFT JOIN (Select tabLang.languageCode as languageCode
# ,_d6463952657fa86c.tabTranslation.source_text as sourceText
# , _d6463952657fa86c.tabTranslation.translated_text as translated_text %s From _d6463952657fa86c.tabTranslation
# INNER JOIN (SELECT tanLang.language_name as language_name
# , tanLang.language_code as languageCode
# FROM _d6463952657fa86c.tabLanguage as tanLang) as tabLang
# ON _d6463952657fa86c.tabTranslation.language = tabLang.languageCode) as tabTranslation
# ON _d6463952657fa86c.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""" % (queryAppendLang[0])
# print(actualQuery)

BIN
smart_service/mahindra_smart_service/report/installation_report/__pycache__/installation_report.cpython-38.pyc

Binary file not shown.

16
smart_service/mahindra_smart_service/report/installation_report/installation_report.js

@ -18,22 +18,6 @@ frappe.query_reports["Installation Report"] = {
default: frappe.datetime.month_end(), default: frappe.datetime.month_end(),
"reqd": 0 "reqd": 0
}, },
{
"fieldname":"user",
"label": __("User"),
"fieldtype": "Link",
"options" : "App Users",
"reqd": 0
},
{
"fieldname":"device",
"label": __("Device"),
"fieldtype": "Link",
"options" : "App Device",
"reqd": 0
},
] ]
}; };

5
smart_service/mahindra_smart_service/report/installation_report/installation_report.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2022-01-11 21:31:48.945777", "modified": "2022-01-28 15:24:44.638997",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Mahindra Smart Service", "module": "Mahindra Smart Service",
"name": "Installation Report", "name": "Installation Report",
@ -21,9 +21,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Admin"
} }
] ]
} }

58
smart_service/mahindra_smart_service/report/installation_report/installation_report.py

@ -15,45 +15,8 @@ def execute(filters=None):
return columns, data return columns, data
def get_data(filters): def get_data(filters):
if filters.get('user') and filters.get('device'):
data = frappe.db.sql("""select dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version, data = frappe.db.sql("""select dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version,
al.device,ad.device_id,ad.app_current_version,al.type,al.date_time_stamp,al.creation,date(al.date_time_stamp) as date,time(al.date_time_stamp) as time,time(al.date_time_stamp) as last_time al.device,ad.device_id,ad.app_current_version,al.type,al.date_time_stamp,al.creation,al.date_time_stamp as date,al.date_time_stamp as time,time(al.date_time_stamp) as last_time
from `tabApp Log` al,`tabApp Device` ad,`tabApp Users` au,`tabApp Dealer` dealer
where
ad.name = %s and al.device = %s and au.name = %s and au.dealer = dealer.name and al.type = 'Installed' and
(al.modified between %s and %s)""",(filters.get('device'),filters.get('device'),filters.get('user'),filters.get('from_date'), filters.get('to_date')), as_dict=1)
if data:
return data
else:
frappe.throw('No Data for Selected Filters.')
if filters.get('user'):
data = frappe.db.sql("""select dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version,
al.device,ad.device_id,ad.app_current_version,al.type,al.date_time_stamp,al.creation,date(al.date_time_stamp) as date,time(al.date_time_stamp) as time,time(al.date_time_stamp) as last_time
from `tabApp Log` al,`tabApp Device` ad,`tabApp Users` au,`tabApp Dealer` dealer
where
al.device = ad.name and au.name = %s and au.dealer = dealer.name and al.type = 'Installed' and
(al.modified between %s and %s)""",(filters.get('user'),filters.get('from_date'), filters.get('to_date')), as_dict=1)
if data:
return data
else:
frappe.throw('No Data for Selected Filters.')
if filters.get('device'):
data = frappe.db.sql("""select dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version,
al.device,ad.device_id,ad.app_current_version,al.type,al.date_time_stamp,al.creation,date(al.date_time_stamp) as date,
time(al.date_time_stamp) as time,time(al.date_time_stamp) as last_time,ad.name
from `tabApp Log` al,`tabApp Device` ad,`tabApp Users` au,`tabApp Dealer` dealer
where
ad.name = %s and al.device = %s and al.user = au.name and au.dealer = dealer.name and al.type = 'Installed' and
(al.modified between %s and %s)""",(filters.get('device'),filters.get('device'),filters.get('from_date'), filters.get('to_date')), as_dict=1)
if data:
return data
else:
frappe.throw('No Data for Selected Filters.')
else:
data = frappe.db.sql("""select dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version,
al.device,ad.device_id,ad.app_current_version,al.type,al.date_time_stamp,al.creation,date(al.date_time_stamp) as date,time(al.date_time_stamp) as time,time(al.date_time_stamp) as last_time
from `tabApp Log` al,`tabApp Device` ad,`tabApp Users` au,`tabApp Dealer` dealer from `tabApp Log` al,`tabApp Device` ad,`tabApp Users` au,`tabApp Dealer` dealer
where where
al.device = ad.name and al.user = au.name and au.dealer = dealer.name and al.type = 'Installed' and al.device = ad.name and al.user = au.name and au.dealer = dealer.name and al.type = 'Installed' and
@ -62,27 +25,24 @@ def get_data(filters):
if data: if data:
return data return data
else: else:
frappe.throw('No Data for Selected Filters.') frappe.msgprint('No Data for Selected Filters.')
def get_columns(): def get_columns():
columns = [ columns = [
{"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100}, {"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100},
{"label": _("User ID"), "fieldname": "user_id", "fieldtype": "Data", "width": 100}, {"label": _("Dealer Location"), "fieldname": "area", "fieldtype":"Data","width": 150},
{"label": _("User Name"), "fieldname": "first_name", "fieldtype": "Data", "width": 100},
{"label": _("Dealer code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 100}, {"label": _("Dealer code"), "fieldname": "dealer_code", "fieldtype": "Data", "width": 100},
{"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype":"Data","width": 150}, {"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype":"Data","width": 150},
{"label": _("Dealer Location"), "fieldname": "area", "fieldtype":"Data","width": 150},
{"label": _("Device OS"), "fieldname": "os", "fieldtype": "Data", "width": 100},
{"label": _("OS Version"), "fieldname": "os_version", "fieldtype": "Data", "width": 100},
{"label": _("Device Type"), "fieldname": "type", "fieldtype": "Data","width": 100}, {"label": _("Device Type"), "fieldname": "type", "fieldtype": "Data","width": 100},
{"label": _("Device ID"), "fieldname": "device_id", "fieldtype": "Data", "width": 100}, {"label": _("Device ID"), "fieldname": "device_id", "fieldtype": "Data", "width": 100},
{"label": _("App Installation Date"), "fieldname": "date_time_stamp", "fieldtype": "DateTime","width": 160}, {"label": _("Device OS"), "fieldname": "os", "fieldtype": "Data", "width": 100},
{"label": _("App Installation Time"), "fieldname": "time", "fieldtype": "DateTime","width": 160}, {"label": _("OS Version"), "fieldname": "os_version", "fieldtype": "Data", "width": 100},
{"label": _("App LastAccessed Date"), "fieldname": "date", "fieldtype": "Date","width": 200}, {"label": _("User ID"), "fieldname": "user_id", "fieldtype": "Data", "width": 100},
{"label": _("App LastAccessed Time"), "fieldname": "last_time", "fieldtype": "DateTime","width": 200}, {"label": _("User Name"), "fieldname": "first_name", "fieldtype": "Data", "width": 100},
{"label": _("App Installation Date"), "fieldname": "date_time_stamp", "fieldtype": "DateTime","width": 200},
{"label": _("App Last Accessed Date"), "fieldname": "date", "fieldtype": "DateTime","width": 200},
{"label": _("App Version No"), "fieldname": "app_current_version", "fieldtype": "Data", "width": 150}, {"label": _("App Version No"), "fieldname": "app_current_version", "fieldtype": "Data", "width": 150},
#{"label": _("Installation Status"), "fieldname": "device", "fieldtype": "Data", "width": 150},
] ]
return columns return columns

BIN
smart_service/mahindra_smart_service/report/login_report/__pycache__/login_report.cpython-38.pyc

Binary file not shown.

16
smart_service/mahindra_smart_service/report/login_report/login_report.js

@ -19,22 +19,6 @@ frappe.query_reports["Login Report"] = {
default: frappe.datetime.year_end(), default: frappe.datetime.year_end(),
"reqd": 0 "reqd": 0
}, },
{
"fieldname":"user",
"label": __("User"),
"fieldtype": "Link",
"options" : "App Users",
"reqd": 0
},
{
"fieldname":"device",
"label": __("Device"),
"fieldtype": "Link",
"options" : "App Device",
"reqd": 0
},
] ]
}; };

5
smart_service/mahindra_smart_service/report/login_report/login_report.json

@ -9,7 +9,7 @@
"filters": [], "filters": [],
"idx": 0, "idx": 0,
"is_standard": "Yes", "is_standard": "Yes",
"modified": "2022-01-11 21:41:22.671074", "modified": "2022-01-28 15:24:33.214754",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Mahindra Smart Service", "module": "Mahindra Smart Service",
"name": "Login Report", "name": "Login Report",
@ -21,9 +21,6 @@
"roles": [ "roles": [
{ {
"role": "System Manager" "role": "System Manager"
},
{
"role": "_Admin"
} }
] ]
} }

53
smart_service/mahindra_smart_service/report/login_report/login_report.py

@ -1,8 +1,6 @@
# Copyright (c) 2013, 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 from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cstr, cint, getdate from frappe.utils import cstr, cint, getdate
@ -15,43 +13,6 @@ def execute(filters=None):
return columns, data return columns, data
def get_data(filters): def get_data(filters):
if filters.get('user') and filters.get('device'):
data = frappe.db.sql("""select dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version,
al.device,ad.device_id,ad.app_current_version,al.type,al.date_time_stamp,al.creation,date(al.date_time_stamp) as date,time(al.date_time_stamp) as time,time(al.date_time_stamp) as last_time
from `tabApp Log` al,`tabApp Device` ad,`tabApp Users` au,`tabApp Dealer` dealer
where
ad.name = %s and al.device = %s and au.name = %s and au.dealer = dealer.name and al.type = 'Installed' and
(al.modified between %s and %s)""",(filters.get('device'),filters.get('device'),filters.get('user'),filters.get('from_date'), filters.get('to_date')), as_dict=1)
if data:
return data
else:
frappe.throw('No Data for Selected Filters.')
if filters.get('user'):
data = frappe.db.sql("""select dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version,
al.device,ad.device_id,ad.app_current_version,al.type,al.date_time_stamp,al.creation,date(al.date_time_stamp) as date,time(al.date_time_stamp) as time,time(al.date_time_stamp) as last_time
from `tabApp Log` al,`tabApp Device` ad,`tabApp Users` au,`tabApp Dealer` dealer
where
al.device = ad.name and au.name = %s and au.dealer = dealer.name and al.type = 'Installed' and
(al.modified between %s and %s)""",(filters.get('user'),filters.get('from_date'), filters.get('to_date')), as_dict=1)
if data:
return data
else:
frappe.throw('No Data for Selected Filters.')
if filters.get('device'):
data = frappe.db.sql("""select dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version,
al.device,ad.device_id,ad.app_current_version,al.type,al.date_time_stamp,al.creation,date(al.date_time_stamp) as date,
time(al.date_time_stamp) as time,time(al.date_time_stamp) as last_time,ad.name
from `tabApp Log` al,`tabApp Device` ad,`tabApp Users` au,`tabApp Dealer` dealer
where
ad.name = %s and al.device = %s and al.user = au.name and au.dealer = dealer.name and al.type = 'Installed' and
(al.modified between %s and %s)""",(filters.get('device'),filters.get('device'),filters.get('from_date'), filters.get('to_date')), as_dict=1)
if data:
return data
else:
frappe.throw('No Data for Selected Filters.')
else:
data = frappe.db.sql("""select count(al.name) as count,dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version, data = frappe.db.sql("""select count(al.name) as count,dealer.zone,au.user_id,au.first_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, 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(al.date_time_stamp) as time date(al.date_time_stamp) as date,time(al.date_time_stamp) as time
@ -62,21 +23,21 @@ def get_data(filters):
if data: if data:
return data return data
else: else:
frappe.throw('No Data for Selected Filters.') frappe.msgprint('No Data for Selected Filters.')
def get_columns(): def get_columns():
columns = [ columns = [
{"label": _("Date"), "fieldname": "date", "fieldtype": "Date", "width": 100}, {"label": _("Date"), "fieldname": "date", "fieldtype": "Date", "width": 100},
{"label": _("Time"), "fieldname": "time", "fieldtype": "DateTime", "width": 100}, {"label": _("Time"), "fieldname": "time", "fieldtype": "DateTime", "width": 130},
{"label": _("User Name"), "fieldname": "first_name", "fieldtype": "Data", "width": 100}, {"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100},
{"label": _("User ID"), "fieldname": "user_id", "fieldtype": "Data", "width": 150}, {"label": _("Dealer Location"), "fieldname": "area", "fieldtype": "Data", "width": 100},
{"label": _("Dealer code"), "fieldname": "dealer_code", "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": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype":"Data","width": 150},
{"label": _("Dealer Location"), "fieldname": "area", "fieldtype": "Data", "width": 100},
{"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100},
{"label": _("Device"), "fieldname": "device_type", "fieldtype": "Data", "width": 100},
{"label": _("Device ID"), "fieldname": "device_id", "fieldtype": "Data", "width": 150}, {"label": _("Device ID"), "fieldname": "device_id", "fieldtype": "Data", "width": 150},
{"label": _("Device"), "fieldname": "device_type", "fieldtype": "Data", "width": 100},
{"label": _("User ID"), "fieldname": "user_id", "fieldtype": "Data", "width": 150},
{"label": _("User Name"), "fieldname": "first_name", "fieldtype": "Data", "width": 100},
{"label": _("Latitude"), "fieldname": "latitude", "fieldtype": "Data", "width": 100}, {"label": _("Latitude"), "fieldname": "latitude", "fieldtype": "Data", "width": 100},
{"label": _("Longitude"), "fieldname": "longitude", "fieldtype": "Data", "width": 100}, {"label": _("Longitude"), "fieldname": "longitude", "fieldtype": "Data", "width": 100},
{"label": _("Count"), "fieldname": "count", "fieldtype": "Data", "width": 100}, {"label": _("Count"), "fieldname": "count", "fieldtype": "Data", "width": 100},

16
smart_service/masters/doctype/drive/drive.json

@ -21,8 +21,7 @@
"in_preview": 1, "in_preview": 1,
"in_standard_filter": 1, "in_standard_filter": 1,
"label": "Drive", "label": "Drive",
"reqd": 1, "reqd": 1
"translatable": 1
}, },
{ {
"fieldname": "active_status", "fieldname": "active_status",
@ -42,7 +41,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-04 10:33:43.839821", "modified": "2022-01-28 11:43:29.834686",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Masters", "module": "Masters",
"name": "Drive", "name": "Drive",
@ -59,17 +58,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"search_fields": "drive", "search_fields": "drive",

16
smart_service/masters/doctype/fuel/fuel.json

@ -22,8 +22,7 @@
"in_preview": 1, "in_preview": 1,
"in_standard_filter": 1, "in_standard_filter": 1,
"label": "Fuel", "label": "Fuel",
"reqd": 1, "reqd": 1
"translatable": 1
}, },
{ {
"fieldname": "active_status", "fieldname": "active_status",
@ -43,7 +42,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2022-01-04 10:33:02.241517", "modified": "2022-01-28 11:38:18.719814",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Masters", "module": "Masters",
"name": "Fuel", "name": "Fuel",
@ -60,17 +59,6 @@
"role": "System Manager", "role": "System Manager",
"share": 1, "share": 1,
"write": 1 "write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "_Admin",
"share": 1,
"write": 1
} }
], ],
"search_fields": "fuel", "search_fields": "fuel",

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save