frappe.throw("There is no item for global publish")
max_internal_ver=frappe.db.sql('''SELECT max(version) as max_version,name as name,publish_status as p FROM {}.tabPublish where vehicle='{}' and language ='{}' and publish_status = 'To Publish' and publish_type ='Internal';'''.format(current_db_name,doc.vehicle,doc.language),as_dict=True)
ifmax_internal_ver:
forvinmax_internal_ver:
ifstr(doc.version)<str(v.max_version):
frappe.throw('Please publish Internal Publish Version '+str(v.max_version)+' for '+str(v.name))
# max_internal_ver = frappe.db.sql('''SELECT max(version) as max_version,name as name,publish_status as p FROM {}.tabPublish where vehicle='{}' and language ='{}' and publish_status = 'To Publish' and publish_type ='Internal';'''.format(current_db_name,doc.vehicle,doc.language),as_dict=True)
# if max_internal_ver:
# for v in max_internal_ver:
# if str(doc.version) < str(v.max_version):
# frappe.throw('Please publish Internal Publish Version ' + str(v.max_version) + ' for ' + str(v.name))