|
|
@ -64,7 +64,6 @@ class Publish(Document): |
|
|
|
self.release_description, self.variant, |
|
|
|
self.repiar_checksheet_publish_docs) |
|
|
|
|
|
|
|
|
|
|
|
update_publish_status = frappe.db.sql( |
|
|
|
"""update `tabPublish` set publish_status='Published' where name='{0}'""".format(self.name)) |
|
|
|
if self.docstatus == 1 and self.publish_status == 'To Publish' and self.publish_module == 'Qwik Service' and self.publish_type == 'Internal': |
|
|
@ -125,7 +124,9 @@ class Publish(Document): |
|
|
|
"""update `tabPublish` set publish_status='Published' where name='{0}'""".format(self.name)) |
|
|
|
|
|
|
|
variant = self.variant_mapping_details.split('/n') |
|
|
|
|
|
|
|
frappe.log_error('publish type', str(self.publish_type)) |
|
|
|
update_publish_mapping(self.vehicle, self.variant_mapping, |
|
|
|
self.language, self.publish_module, self.publish_type) |
|
|
|
|
|
|
|
def on_cancel(self): |
|
|
|
# Published document should not allow to cancel |
|
|
@ -184,16 +185,19 @@ def update_procedure(vehicle, lang, publish_type, doc): |
|
|
|
frappe.throw("There is no item for global publish") |
|
|
|
|
|
|
|
# Generate Publish versions |
|
|
|
|
|
|
|
|
|
|
|
def update_qwik_published_docs(self): |
|
|
|
try: |
|
|
|
for d in self.qwik_service_publish_docs: |
|
|
|
frappe.db.sql( |
|
|
|
"""UPDATE `tabQwik Service` set is_published=1 where name='{0}'""".format(d.parent1)) |
|
|
|
"""UPDATE `tabQwik Service` set is_published=1 where name='{0}'; """.format(d.parent1)) |
|
|
|
frappe.db.commit() |
|
|
|
|
|
|
|
except Exception as ex: |
|
|
|
return str(ex) |
|
|
|
|
|
|
|
|
|
|
|
def update_publish_mapping(vehicle, variant, language, module, publish_type): |
|
|
|
frappe.set_user('Administrator') |
|
|
|
if module == 'Repair service': |
|
|
@ -209,6 +213,18 @@ def update_publish_mapping(vehicle, variant, language, module, publish_type): |
|
|
|
f"""UPDATE `tabModule Publish Mapping` set repairservice_check_sheet='1' and publish_type='1' where name ='{d['name']}'""", as_dict=1) |
|
|
|
frappe.db.commit() |
|
|
|
|
|
|
|
elif module == 'Special Tool': |
|
|
|
pub_data = frappe.db.get_list('Module Publish Mapping', filters={ |
|
|
|
"vehicle": vehicle, |
|
|
|
"language": language, |
|
|
|
"publish_type": publish_type |
|
|
|
}, fields=['name']) |
|
|
|
if len(pub_data) > 0: |
|
|
|
for d in pub_data: |
|
|
|
if d['name']: |
|
|
|
frappe.db.sql( |
|
|
|
f"""UPDATE `tabModule Publish Mapping` set mahindra_special_tool_information='1' and publish_type='1' where name ='{d['name']}'""", as_dict=1) |
|
|
|
frappe.db.commit() |
|
|
|
else: |
|
|
|
pub_data = frappe.db.get_list('Module Publish Mapping', filters={ |
|
|
|
"vehicle": vehicle, |
|
|
@ -224,7 +240,8 @@ def update_publish_mapping(vehicle, variant, language, module, publish_type): |
|
|
|
'doctype': 'Module Publish Mapping', |
|
|
|
"vehicle": vehicle, |
|
|
|
"variant": variant, |
|
|
|
"language": language |
|
|
|
"language": language, |
|
|
|
"publish_type": publish_type |
|
|
|
}) |
|
|
|
if module == 'Automotive System': |
|
|
|
doc.automotive_system = 1 |
|
|
@ -235,6 +252,8 @@ def update_publish_mapping(vehicle, variant, language, module, publish_type): |
|
|
|
elif module == 'Feature Finder': |
|
|
|
doc.feature_finder = 1 |
|
|
|
|
|
|
|
elif module == 'Qwik Service': |
|
|
|
doc.qwik_service = 1 |
|
|
|
|
|
|
|
doc.save() |
|
|
|
|
|
|
@ -555,9 +574,7 @@ def update_procedure_value(name, file_path): |
|
|
|
|
|
|
|
def update_feature_published_docs(self): |
|
|
|
try: |
|
|
|
|
|
|
|
for d in self.feature_finder_publish_docs: |
|
|
|
|
|
|
|
frappe.db.sql( |
|
|
|
"""UPDATE `tabFeature Finder` set is_published=1 where name='{0}'""".format(d.parent1)) |
|
|
|
frappe.db.commit() |
|
|
@ -568,9 +585,7 @@ def update_feature_published_docs(self): |
|
|
|
|
|
|
|
def update_repair_published_docs(self): |
|
|
|
try: |
|
|
|
|
|
|
|
for d in self.repair_checksheet_publish: |
|
|
|
|
|
|
|
frappe.db.sql( |
|
|
|
"""UPDATE `tabRepair Service Mapping` set published=1 where name='{0}'""".format(d.parent_name)) |
|
|
|
frappe.db.commit() |
|
|
@ -578,11 +593,10 @@ def update_repair_published_docs(self): |
|
|
|
except Exception as e: |
|
|
|
frappe.throw(str(e)) |
|
|
|
|
|
|
|
|
|
|
|
def update_special_tool_publish_docs(self): |
|
|
|
try: |
|
|
|
|
|
|
|
for d in self.special_tool_publish_docs: |
|
|
|
|
|
|
|
frappe.db.sql( |
|
|
|
"""UPDATE `tabSpecial Tool Information` set published=1 where name='{0}'""".format(d.parent1)) |
|
|
|
frappe.db.commit() |
|
|
@ -592,7 +606,6 @@ def update_special_tool_publish_docs(self): |
|
|
|
|
|
|
|
def create_publish_folders(folder_url): |
|
|
|
try: |
|
|
|
|
|
|
|
if not os.path.isdir(folder_url + "/" + "Global"): |
|
|
|
os.makedirs(folder_url + "/" + "Global") |
|
|
|
|
|
|
@ -604,6 +617,7 @@ def create_publish_folders(folder_url): |
|
|
|
frappe.throw(str(e)) |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
'''New Module Publish Section''' |
|
|
|
|
|
|
|
|
|
|
@ -717,8 +731,6 @@ def repair_checksheet_publish(vehicle, vehicle_id, |
|
|
|
frappe.throw('Failed To Publish') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def feature_finder_publish(vehicle=None, vehicle_id=None, |
|
|
|
language=None, publish_type=None, |
|
|
|
release_description=None, parent=None, |
|
|
@ -830,6 +842,7 @@ def feature_finder_publish(vehicle=None, vehicle_id=None, |
|
|
|
f'{vehicle} - {language} - {publish_type} - {module_name} error in json creation' + str(e)) |
|
|
|
frappe.throw('Failed To Publish') |
|
|
|
|
|
|
|
|
|
|
|
def qwik_service_publish(vehicle=None, vehicle_id=None, variant=None, |
|
|
|
language=None, publish_type=None, |
|
|
|
release_description=None, parent=None): |
|
|
@ -902,7 +915,6 @@ def qwik_service_publish(vehicle = None , vehicle_id = None,variant = None, |
|
|
|
|
|
|
|
qwik_service_tmp = create_df(qwik_service_tmp) |
|
|
|
|
|
|
|
|
|
|
|
vehi_data = compare_get_data({'data': published_data['data']}, { |
|
|
|
'data': qwik_service_tmp}) |
|
|
|
if vehi_data: |
|
|
@ -933,9 +945,10 @@ def qwik_service_publish(vehicle = None , vehicle_id = None,variant = None, |
|
|
|
with open(file_path, 'w') as outfile: |
|
|
|
outfile.write(json.dumps(vehicle_data, indent=4, default=str)) |
|
|
|
|
|
|
|
|
|
|
|
except Exception as e: |
|
|
|
logger.error(f'{variant} - {language} - {publish_type} - Qwik_service'+str(e)) |
|
|
|
logger.error( |
|
|
|
f'{variant} - {language} - {publish_type} - Qwik_service'+str(e)) |
|
|
|
|
|
|
|
|
|
|
|
def special_tool_publish(vehicle, vehicle_id, |
|
|
|
publish_type, release_description, |
|
|
@ -976,7 +989,8 @@ def special_tool_publish(vehicle, vehicle_id, |
|
|
|
with open(existing_global) as f: |
|
|
|
published_data = json.load(f) |
|
|
|
for i in parent: |
|
|
|
special_tool = special_tool_data(vehicle,publish_type, i.parent1) |
|
|
|
special_tool = special_tool_data( |
|
|
|
vehicle, publish_type, i.parent1) |
|
|
|
if special_tool['status'] == 1 and len(special_tool['data']) > 0: |
|
|
|
publish_special_tool = 1 |
|
|
|
special_tool_tmp.append( |
|
|
@ -988,7 +1002,8 @@ def special_tool_publish(vehicle, vehicle_id, |
|
|
|
with open(existing_global) as f: |
|
|
|
published_data = json.load(f) |
|
|
|
for i in parent: |
|
|
|
special_tool = special_tool_data(vehicle,publish_type, i.parent1) |
|
|
|
special_tool = special_tool_data( |
|
|
|
vehicle, publish_type, i.parent1) |
|
|
|
if special_tool['status'] == 1 and len(special_tool['data']) > 0: |
|
|
|
publish_special_tool = 1 |
|
|
|
special_tool_tmp.append( |
|
|
@ -1262,6 +1277,8 @@ def feature_finder_data(vehicle=None, language=None, |
|
|
|
e) |
|
|
|
logger.error('error in repair checksheet' + str(e)) |
|
|
|
return failure_reponse |
|
|
|
|
|
|
|
|
|
|
|
def qwik_service_data(language, publish_type, variant, parent, vehicle): |
|
|
|
|
|
|
|
try: |
|
|
@ -1301,6 +1318,7 @@ def qwik_service_data(language,publish_type,variant,parent,vehicle): |
|
|
|
|
|
|
|
logger.error('error in qwik service data' + str(e)) |
|
|
|
|
|
|
|
|
|
|
|
def special_tool_data(vehicle=None, |
|
|
|
publish_type=None, parent=None): |
|
|
|
try: |
|
|
@ -1310,7 +1328,6 @@ def special_tool_data(vehicle=None, |
|
|
|
logger.info( |
|
|
|
f"start of fetching special tool data - {parent}") |
|
|
|
|
|
|
|
|
|
|
|
special_tool_information = frappe.db.sql(''' select name,vehicle,tool_type, |
|
|
|
category,tool_name,aggregate_name,aggregate_image, |
|
|
|
pdf,keywords,display_order,my_id,active_status from |
|
|
@ -1336,6 +1353,7 @@ def special_tool_data(vehicle=None, |
|
|
|
logger.error('error in special tool' + str(e)) |
|
|
|
return failure_reponse |
|
|
|
|
|
|
|
|
|
|
|
@frappe.whitelist() |
|
|
|
def max_publish_new_module(doc): |
|
|
|
doc = frappe.get_doc("Publish", doc) |
|
|
@ -1372,6 +1390,7 @@ def cal_ver_new_module(vehicle, lang, publish_type, doc): |
|
|
|
frappe.db.commit() |
|
|
|
return v |
|
|
|
|
|
|
|
|
|
|
|
@frappe.whitelist() |
|
|
|
def get_qwik_service(variant=None, language_label=None, kilometers=None): |
|
|
|
try: |
|
|
@ -1382,6 +1401,7 @@ def get_qwik_service(variant=None,language_label=None,kilometers=None): |
|
|
|
except Exception as e: |
|
|
|
return e |
|
|
|
|
|
|
|
|
|
|
|
@frappe.whitelist() |
|
|
|
def get_special_tool(vehicle=None, publish_type=None): |
|
|
|
data = frappe.db.sql(''' |
|
|
|