|
@ -50,8 +50,9 @@ class PublishTest(Document): |
|
|
|
|
|
|
|
|
def on_submit(self): |
|
|
def on_submit(self): |
|
|
if self.docstatus == 1 and self.publish_status == 'To Publish' and self.publish_module == 'Others' and self.publish_type == 'Internal': |
|
|
if self.docstatus == 1 and self.publish_status == 'To Publish' and self.publish_module == 'Others' and self.publish_type == 'Internal': |
|
|
repair_checksheet_publish(self.vehicle, self.vehicle_id, self.language, self.publish_type, |
|
|
if len(self.repair_checksheet_publish)>0: |
|
|
self.release_description, self.variant, self.repair_checksheet_publish) |
|
|
repair_checksheet_publish(self.vehicle, self.vehicle_id, self.language, self.publish_type, |
|
|
|
|
|
self.release_description, self.variant, self.repair_checksheet_publish) |
|
|
feature_finder_publish(self.vehicle, self.vehicle_id, self.language, self.publish_type, |
|
|
feature_finder_publish(self.vehicle, self.vehicle_id, self.language, self.publish_type, |
|
|
self.release_description,self.feature_finder_publish) |
|
|
self.release_description,self.feature_finder_publish) |
|
|
update_publish_status = frappe.db.sql( |
|
|
update_publish_status = frappe.db.sql( |
|
@ -519,7 +520,6 @@ def repair_checksheet_publish(vehicle, vehicle_id, |
|
|
repair_checksheet['data'][0]) |
|
|
repair_checksheet['data'][0]) |
|
|
# frappe.msgprint(str(repair_checksheet['data'][0])) |
|
|
# frappe.msgprint(str(repair_checksheet['data'][0])) |
|
|
repair_checksheet_tmp=get_latest_data({'data':repair_checksheet_tmp},{'data':[]}) |
|
|
repair_checksheet_tmp=get_latest_data({'data':repair_checksheet_tmp},{'data':[]}) |
|
|
frappe.msgprint(str(repair_checksheet_tmp)) |
|
|
|
|
|
|
|
|
|
|
|
if publish_repair_checksheet == 1: |
|
|
if publish_repair_checksheet == 1: |
|
|
""" Save publish file """ |
|
|
""" Save publish file """ |
|
@ -535,10 +535,11 @@ def repair_checksheet_publish(vehicle, vehicle_id, |
|
|
f'{vehicle} - {language} - {publish_type} error in json creation' + str(e)) |
|
|
f'{vehicle} - {language} - {publish_type} error in json creation' + str(e)) |
|
|
frappe.throw('Failed To Publish') |
|
|
frappe.throw('Failed To Publish') |
|
|
|
|
|
|
|
|
def feature_finder_publish(vehicle=None, language=None, |
|
|
def feature_finder_publish(vehicle=None,vehicle_id=None, |
|
|
vehicle_id=None,publish_type=None, |
|
|
language=None,publish_type=None, |
|
|
release_description=None,parent=None): |
|
|
release_description=None,parent=None): |
|
|
try: |
|
|
try: |
|
|
|
|
|
frappe.msgprint(str('res')) |
|
|
|
|
|
|
|
|
logger_file = f'{vehicle} - {language} - {publish_type} - {module_name}' |
|
|
logger_file = f'{vehicle} - {language} - {publish_type} - {module_name}' |
|
|
logger = frappe.logger(logger_file, |
|
|
logger = frappe.logger(logger_file, |
|
@ -573,37 +574,40 @@ def feature_finder_publish(vehicle=None, language=None, |
|
|
f'Repair Checksheet Data Append Start::{vehicle}-{language}-{publish_type}') |
|
|
f'Repair Checksheet Data Append Start::{vehicle}-{language}-{publish_type}') |
|
|
'''update existing global json file''' |
|
|
'''update existing global json file''' |
|
|
if os.path.isfile(file_path): |
|
|
if os.path.isfile(file_path): |
|
|
with open(file_path) as f: |
|
|
pass |
|
|
published_data = json.load(f) |
|
|
# with open(file_path) as f: |
|
|
for i in parent: |
|
|
# published_data = json.load(f) |
|
|
repair_checksheet = repair_checksheet_data(vehicle, language, |
|
|
# for i in parent: |
|
|
publish_type, i.parent_name) |
|
|
# repair_checksheet = repair_checksheet_data(vehicle, language, |
|
|
if repair_checksheet['status'] == 1: |
|
|
# publish_type, i.parent_name) |
|
|
publish_repair_checksheet = 1 |
|
|
# if repair_checksheet['status'] == 1: |
|
|
repair_checksheet_tmp.append( |
|
|
# publish_repair_checksheet = 1 |
|
|
repair_checksheet['data'][0]) |
|
|
# repair_checksheet_tmp.append( |
|
|
|
|
|
# repair_checksheet['data'][0]) |
|
|
|
|
|
|
|
|
repair_checksheet_tmp=get_latest_data({'data':published_data['data']},{'data':repair_checksheet_tmp}) |
|
|
# repair_checksheet_tmp=get_latest_data({'data':published_data['data']},{'data':repair_checksheet_tmp}) |
|
|
|
|
|
|
|
|
else: |
|
|
else: |
|
|
|
|
|
|
|
|
for i in parent: |
|
|
for i in parent: |
|
|
feature_finder = feature_finder_data( |
|
|
feature_finder = feature_finder_data( |
|
|
vehicle, language, publish_type, i.parent) |
|
|
vehicle, language, publish_type, i.parent) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if feature_finder['status'] == 1: |
|
|
if feature_finder['status'] == 1: |
|
|
publish_feature_finder = 1 |
|
|
publish_feature_finder = 1 |
|
|
|
|
|
|
|
|
if len(feature_finder['data']): |
|
|
if len(feature_finder['data']): |
|
|
feature_finder_tmp.append( |
|
|
feature_finder_tmp.append( |
|
|
feature_finder['data'][0]) |
|
|
feature_finder['data'][0]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
feature_finder_tmp=get_latest_data({'data':feature_finder_tmp},{'data':[]}) |
|
|
feature_finder_tmp=get_latest_data({'data':feature_finder_tmp},{'data':[]}) |
|
|
frappe.msgprint(str(feature_finder_tmp)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if publish_feature_finder == 1: |
|
|
if publish_feature_finder == 1: |
|
|
""" Save publish file """ |
|
|
""" Save publish file """ |
|
|
vehicle_data['data'] = feature_finder_tmp |
|
|
vehicle_data['data'] = feature_finder_tmp |
|
|
|
|
|
frappe.msgprint(str(file_path)) |
|
|
|
|
|
|
|
|
with open(file_path, 'w') as outfile: |
|
|
with open(file_path, 'w') as outfile: |
|
|
outfile.write(json.dumps(vehicle_data, indent=4, default=str)) |
|
|
outfile.write(json.dumps(vehicle_data, indent=4, default=str)) |
|
@ -676,7 +680,6 @@ def get_latest_data(prev_data, latest_data): |
|
|
final_dic.update({d2: data_dic2[d2]}) |
|
|
final_dic.update({d2: data_dic2[d2]}) |
|
|
|
|
|
|
|
|
final_list = list(final_dic.values()) |
|
|
final_list = list(final_dic.values()) |
|
|
frappe.msgprint(str(final_list)) |
|
|
|
|
|
|
|
|
|
|
|
return final_list |
|
|
return final_list |
|
|
|
|
|
|
|
@ -722,7 +725,8 @@ def repair_checksheet_data(vehicle=None, language=None, |
|
|
def feature_finder_data(vehicle=None, language=None, |
|
|
def feature_finder_data(vehicle=None, language=None, |
|
|
publish_type=None, parent=None): |
|
|
publish_type=None, parent=None): |
|
|
try: |
|
|
try: |
|
|
logger_file = f'{vehicle} - {language} - {publish_type} - {module_name}' |
|
|
frappe.msgprint(str(parent)) |
|
|
|
|
|
logger_file = f'{vehicle} - {language} - {publish_type} - {module_name} - fetch data' |
|
|
logger = frappe.logger(logger_file, |
|
|
logger = frappe.logger(logger_file, |
|
|
allow_site=True, file_count=100) |
|
|
allow_site=True, file_count=100) |
|
|
logger.info( |
|
|
logger.info( |
|
|