|
|
@ -50,11 +50,12 @@ class Publish(Document): |
|
|
|
|
|
|
|
def on_submit(self): |
|
|
|
if self.docstatus == 1 and self.publish_status == 'To Publish' and self.publish_module == 'Repair service' and self.publish_type == 'Internal': |
|
|
|
|
|
|
|
repair_checksheet_publish(self.vehicle, self.vehicle_id, |
|
|
|
self.language, self.publish_type, |
|
|
|
self.release_description, self.variant, |
|
|
|
self.repair_checksheet_publish) |
|
|
|
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 == 'Feature Finder' and self.publish_type == 'Internal' and self.feature_finder_publish: |
|
|
|
feature_finder_publish(self.vehicle, self.vehicle_id, |
|
|
@ -62,7 +63,6 @@ class Publish(Document): |
|
|
|
self.release_description,self.feature_finder_publish,self.variant) |
|
|
|
|
|
|
|
if self.docstatus == 1 and self.publish_module =='Feature Finder' and self.publish_type == 'Global': |
|
|
|
|
|
|
|
feature_finder_publish(self.vehicle, self.vehicle_id, |
|
|
|
self.language, self.publish_type, |
|
|
|
self.release_description,self.feature_finder_publish, |
|
|
@ -76,8 +76,8 @@ class Publish(Document): |
|
|
|
self.release_description, self.variant, |
|
|
|
self.repair_checksheet_publish) |
|
|
|
update_repair_published_docs(self) |
|
|
|
update_publish_status = frappe.db.sql( |
|
|
|
"""update `tabPublish` set publish_status='Published' where name='{0}'""".format(self.name)) |
|
|
|
# update_publish_status = frappe.db.sql( |
|
|
|
# """update `tabPublish` set publish_status='Published' where name='{0}'""".format(self.name)) |
|
|
|
def onload1(self): |
|
|
|
current_db_name = frappe.conf.get("db_name") |
|
|
|
# To validate updated procedure status |
|
|
@ -244,6 +244,7 @@ def global_publish(doc): |
|
|
|
publish_record.vehicle = doc.vehicle |
|
|
|
publish_record.vehicle_id = doc.vehicle_id |
|
|
|
publish_record.variant_mapping = doc.variant_mapping |
|
|
|
publish_record.publish_module=doc.publish_module |
|
|
|
publish_record.variant_mapping_status = doc.variant_mapping_status |
|
|
|
publish_record.kilometer_mapping = doc.kilometer_mapping |
|
|
|
publish_record.km_active_status = doc.km_active_status |
|
|
@ -353,7 +354,7 @@ def update_mapping(variant_mapping, doc): |
|
|
|
def get_vm_asset(doc, lang): |
|
|
|
doc = frappe.get_doc("Variant Mapping", doc) |
|
|
|
vm_assets = frappe.db.sql("""select category,language,attach_file,active_status from {0}.`tabVariant Mapping_Assets` |
|
|
|
where parent = "{1}" and language '{2}' and published = '0'; """.format(current_db_name, doc.name, lang), as_dict=1) |
|
|
|
where parent = "{1}" and language ='{2}' and published = 0; """.format(current_db_name, doc.name, lang), as_dict=1) |
|
|
|
return vm_assets |
|
|
|
|
|
|
|
|
|
|
@ -827,28 +828,26 @@ def max_publish_new_module(doc): |
|
|
|
return ver |
|
|
|
|
|
|
|
|
|
|
|
@frappe.whitelist() |
|
|
|
def cal_ver_new_module(vehicle, lang, publish_type, doc): |
|
|
|
update_procedure(vehicle, lang, publish_type, doc) |
|
|
|
current_db_name = frappe.conf.get("db_name") |
|
|
|
doc = frappe.get_doc("Publish", doc) |
|
|
|
ver = frappe.db.sql("""select max(creation) from `tabPublish` where vehicle = "{vehi}" and language = "{lang}";""" |
|
|
|
.format(vehi=vehicle, lang=lang)) |
|
|
|
v = 0.0 |
|
|
|
if publish_type == 'Global': |
|
|
|
if ver[0][0] == None: |
|
|
|
v = 1.0 |
|
|
|
else: |
|
|
|
v = int(float(ver[0][0])) + 1.0 |
|
|
|
|
|
|
|
elif publish_type == 'Internal': |
|
|
|
if ver[0][0] == None: |
|
|
|
v = 0.01 |
|
|
|
else: |
|
|
|
v = float(ver[0][0]) + 0.01 |
|
|
|
v = "{:.2f}".format(v) |
|
|
|
doc.version = v |
|
|
|
frappe.db.sql("""update {0}.`tabPublish` set version = "{1}" where name = "{2}";""".format( |
|
|
|
current_db_name, v, doc.name)) |
|
|
|
frappe.db.commit() |
|
|
|
return v |
|
|
|
# @frappe.whitelist() |
|
|
|
# def cal_ver_new_module(vehicle, lang, publish_type, doc): |
|
|
|
# current_db_name = frappe.conf.get("db_name") |
|
|
|
# doc = frappe.get_doc("Publish", doc) |
|
|
|
# ver = frappe.db.sql(f"""select max(creation) from `tabPublish` where vehicle = "{vehicle}" and language = "{lang}";""",as_dict=1) |
|
|
|
# v = 0.0 |
|
|
|
# if publish_type == 'Global': |
|
|
|
# if ver[0][0] == None: |
|
|
|
# v = 1.0 |
|
|
|
# else: |
|
|
|
# v = int(float(ver[0][0])) + 1.0 |
|
|
|
|
|
|
|
# elif publish_type == 'Internal': |
|
|
|
# if ver[0][0] == None: |
|
|
|
# v = 0.01 |
|
|
|
# else: |
|
|
|
# v = float(ver[0][0]) + 0.01 |
|
|
|
# v = "{:.2f}".format(v) |
|
|
|
# doc.version = v |
|
|
|
# frappe.db.sql("""update {0}.`tabPublish` set version = "{1}" where name = "{2}";""".format( |
|
|
|
# current_db_name, v, doc.name)) |
|
|
|
# frappe.db.commit() |
|
|
|
# return v |