Browse Source

publsih remove log errros

version2
venkataakhil 1 year ago
parent
commit
446a0c45a1
  1. 9
      smart_service/transactions/doctype/publish/publish.js
  2. 27
      smart_service/transactions/doctype/publish/publish.py

9
smart_service/transactions/doctype/publish/publish.js

@ -95,7 +95,6 @@ frappe.ui.form.on("Publish", {
} }
if (frm.doc.docstatus == 1 && frm.doc.publish_module == "Special Tool") { if (frm.doc.docstatus == 1 && frm.doc.publish_module == "Special Tool") {
cur_frm.set_df_property("special_tool_publish_docs", "read_only", 1); cur_frm.set_df_property("special_tool_publish_docs", "read_only", 1);
cur_frm.set_df_property("special_tool_publish_docs", "hidden", 1);
cur_frm.refresh_field("special_tool_publish_docs"); cur_frm.refresh_field("special_tool_publish_docs");
cur_frm.remove_custom_button("Add To Publish"); cur_frm.remove_custom_button("Add To Publish");
if (frm.doc.special_tool_publish.length > 0) { if (frm.doc.special_tool_publish.length > 0) {
@ -250,7 +249,7 @@ frappe.ui.form.on("Publish", {
module_name: frm.doc.publish_module, module_name: frm.doc.publish_module,
}, },
callback: function (r) { callback: function (r) {
// debugger;
window.location.href = window.location.href =
r.message.url + r.message.url +
"/app/publish" + "/app/publish" +
@ -356,7 +355,7 @@ frappe.ui.form.on("Publish", {
!frm.doc.global_publish && !frm.doc.global_publish &&
frappe.user.has_role("_Publisher") frappe.user.has_role("_Publisher")
) { ) {
debugger;
frappe.call({ frappe.call({
method: method:
"smart_service.transactions.doctype.publish.publish.max_publish", "smart_service.transactions.doctype.publish.publish.max_publish",
@ -393,7 +392,7 @@ frappe.ui.form.on("Publish", {
frappe.user.has_role("_Publisher") && frappe.user.has_role("_Publisher") &&
frm.doc.publish_module == "Automotive System" frm.doc.publish_module == "Automotive System"
) { ) {
debugger;
frm frm
.add_custom_button(__("Publish"), function () { .add_custom_button(__("Publish"), function () {
frappe.confirm( frappe.confirm(
@ -416,7 +415,7 @@ frappe.ui.form.on("Publish", {
publish_module: frm.doc.publish_module, publish_module: frm.doc.publish_module,
}, },
callback: (r) => { callback: (r) => {
debugger;
frm.set_value("version", r.message); frm.set_value("version", r.message);
cur_frm.refresh_field("version"); cur_frm.refresh_field("version");
if ( if (

27
smart_service/transactions/doctype/publish/publish.py

@ -125,12 +125,6 @@ class Publish(Document):
variant = self.variant_mapping_details.split('/n') variant = self.variant_mapping_details.split('/n')
# for v in variant:
# frappe.log_error('v', str(v))
# if v:
# update_publish_mapping(
# self.vehicle, v, self.language, self.publish_module)
def on_cancel(self): def on_cancel(self):
# Published document should not allow to cancel # Published document should not allow to cancel
if self.publish_status == "Published": if self.publish_status == "Published":
@ -782,7 +776,6 @@ def feature_finder_publish(vehicle=None, vehicle_id=None,
vehi_data, new_variant_name, feature_finder_tmp) vehi_data, new_variant_name, feature_finder_tmp)
elif os.path.isfile(file_path) and publish_type == 'Global': elif os.path.isfile(file_path) and publish_type == 'Global':
frappe.msgprint(str('called'))
with open(global_file_path) as f: with open(global_file_path) as f:
published_data = json.load(f) published_data = json.load(f)
for i in parent: for i in parent:
@ -893,7 +886,6 @@ def qwik_service_publish(vehicle = None , vehicle_id = None,variant = None,
vehi_data, new_variant_name, qwik_service_tmp) vehi_data, new_variant_name, qwik_service_tmp)
elif os.path.isfile(global_file_path) and publish_type == 'Global': elif os.path.isfile(global_file_path) and publish_type == 'Global':
frappe.msgprint(str('compare_internal'))
with open(global_file_path) as f: with open(global_file_path) as f:
published_data = json.load(f) published_data = json.load(f)
for i in parent: for i in parent:
@ -903,7 +895,7 @@ def qwik_service_publish(vehicle = None , vehicle_id = None,variant = None,
publish_qwik_service = 1 publish_qwik_service = 1
qwik_service_tmp.append( qwik_service_tmp.append(
qwik_service['data'][0]) qwik_service['data'][0])
frappe.log_error(str(qwik_service_tmp))
qwik_service_tmp = create_df(qwik_service_tmp) qwik_service_tmp = create_df(qwik_service_tmp)
@ -944,13 +936,7 @@ def qwik_service_publish(vehicle = None , vehicle_id = None,variant = None,
def special_tool_publish(vehicle, vehicle_id, def special_tool_publish(vehicle, vehicle_id,
publish_type, release_description, publish_type, release_description,
parent=None): parent=None):
# special_tool_publish(self.vehicle, self.vehicle_id,
# self.publish_type,
# self.release_description,
# self.special_tool_publish_docs)
try: try:
frappe.log_error(str(parent))
logger_file = f'{vehicle} - {publish_type} - special tool' logger_file = f'{vehicle} - {publish_type} - special tool'
logger = frappe.logger(logger_file, allow_site=True, file_count=100) logger = frappe.logger(logger_file, allow_site=True, file_count=100)
logger.info( logger.info(
@ -969,7 +955,7 @@ def special_tool_publish(vehicle, vehicle_id,
vehicle.replace(' ', '-') + '-special_tool' + '.json' vehicle.replace(' ', '-') + '-special_tool' + '.json'
existing_global= folder_url + "/" + "Global" + "/" + \ existing_global= folder_url + "/" + "Global" + "/" + \
vehicle.replace(' ', '-') + '-special_tool' + '.json' vehicle.replace(' ', '-') + '-special_tool' + '.json'
# frappe.msgprint(str(existing_global))
'''Append Published Data to Json''' '''Append Published Data to Json'''
logger.info( logger.info(
f'Special tool Data Append Start::{vehicle}-{publish_type}') f'Special tool Data Append Start::{vehicle}-{publish_type}')
@ -983,7 +969,6 @@ def special_tool_publish(vehicle, vehicle_id,
'''update existing global json file''' '''update existing global json file'''
if os.path.isfile(existing_global) and publish_type=='Internal': if os.path.isfile(existing_global) and publish_type=='Internal':
# frappe.msgprint(str('exiting'))
with open(existing_global) as f: with open(existing_global) as f:
published_data = json.load(f) published_data = json.load(f)
for i in parent: for i in parent:
@ -992,11 +977,10 @@ def special_tool_publish(vehicle, vehicle_id,
publish_special_tool = 1 publish_special_tool = 1
special_tool_tmp.append( special_tool_tmp.append(
special_tool['data'][0]) special_tool['data'][0])
frappe.log_error(str(special_tool_tmp))
special_tool_tmp = get_latest_data({'data': published_data['data']}, { special_tool_tmp = get_latest_data({'data': published_data['data']}, {
'data': special_tool_tmp}) 'data': special_tool_tmp})
elif os.path.isfile(file_path) and publish_type=='Global': elif os.path.isfile(file_path) and publish_type=='Global':
# frappe.msgprint(str('exiting Global'))
with open(existing_global) as f: with open(existing_global) as f:
published_data = json.load(f) published_data = json.load(f)
for i in parent: for i in parent:
@ -1005,7 +989,7 @@ def special_tool_publish(vehicle, vehicle_id,
publish_special_tool = 1 publish_special_tool = 1
special_tool_tmp.append( special_tool_tmp.append(
special_tool['data'][0]) special_tool['data'][0])
frappe.log_error(str(special_tool_tmp))
special_tool_tmp = get_latest_data({'data': published_data['data']}, { special_tool_tmp = get_latest_data({'data': published_data['data']}, {
'data': special_tool_tmp}) 'data': special_tool_tmp})
@ -1013,13 +997,12 @@ def special_tool_publish(vehicle, vehicle_id,
for i in parent: for i in parent:
special_tool = special_tool_data( special_tool = special_tool_data(
vehicle, publish_type, i.parent1) vehicle, publish_type, i.parent1)
frappe.log_error(str(special_tool))
if special_tool['status'] == 1: if special_tool['status'] == 1:
publish_special_tool = 1 publish_special_tool = 1
if len(special_tool['data'])>0: if len(special_tool['data'])>0:
special_tool_tmp.append( special_tool_tmp.append(
special_tool['data'][0]) special_tool['data'][0])
# frappe.msgprint(str(special_tool['data'][0]))
special_tool_tmp = get_latest_data( special_tool_tmp = get_latest_data(
{'data': special_tool_tmp}, {'data': []}) {'data': special_tool_tmp}, {'data': []})

Loading…
Cancel
Save