|
@ -17,9 +17,9 @@ cur_frm.fields_dict["vehicle"].get_query = function (doc, cdt, cdn) { |
|
|
|
|
|
|
|
|
let lang_set_first_time = true; |
|
|
let lang_set_first_time = true; |
|
|
var html_variant = [] |
|
|
var html_variant = [] |
|
|
function get_variant_mapping(frm){ |
|
|
function get_variant_mapping(frm) { |
|
|
var res = $(cur_frm.fields_dict.variant_mapping_html.wrapper).empty(); |
|
|
var res = $(cur_frm.fields_dict.variant_mapping_html.wrapper).empty(); |
|
|
var vm =`<table class="table table-bordered">
|
|
|
var vm = `<table class="table table-bordered">
|
|
|
<thead> |
|
|
<thead> |
|
|
<tr> |
|
|
<tr> |
|
|
<th scope="col">#</th> |
|
|
<th scope="col">#</th> |
|
@ -33,44 +33,44 @@ function get_variant_mapping(frm){ |
|
|
vm += ` <tbody></tbody></table>` |
|
|
vm += ` <tbody></tbody></table>` |
|
|
res.append(vm) |
|
|
res.append(vm) |
|
|
|
|
|
|
|
|
if(frm.doc.variant_mapping_details){ |
|
|
if (frm.doc.variant_mapping_details) { |
|
|
var variant_mapping_details_ = frm.doc.variant_mapping_details |
|
|
var variant_mapping_details_ = frm.doc.variant_mapping_details |
|
|
variant_mapping_details_ = variant_mapping_details_.split("\n") |
|
|
variant_mapping_details_ = variant_mapping_details_.split("\n") |
|
|
variant_mapping_details_.map(v=>{ |
|
|
variant_mapping_details_.map(v => { |
|
|
frappe.db.get_list('Variant Mapping', { |
|
|
frappe.db.get_list('Variant Mapping', { |
|
|
fields: ['family_code', 'fuel','transmission','drive'], |
|
|
fields: ['family_code', 'fuel', 'transmission', 'drive'], |
|
|
filters: { name: v } |
|
|
filters: { name: v } |
|
|
}).then(val => { |
|
|
}).then(val => { |
|
|
if (val){ |
|
|
if (val) { |
|
|
var docv= ` <tr>
|
|
|
var docv = ` <tr>
|
|
|
<th scope="row">1</th> |
|
|
<th scope="row">1</th> |
|
|
<td>${val[0]['family_code']}</td> |
|
|
<td>${val[0]['family_code']}</td> |
|
|
<td>${val[0]['fuel']}</td> |
|
|
<td>${val[0]['fuel']}</td> |
|
|
<td>@${val[0]['transmission']}</td> |
|
|
<td>@${val[0]['transmission']}</td> |
|
|
<td>@${val[0]['drive']}</td> |
|
|
<td>@${val[0]['drive']}</td> |
|
|
</tr>` |
|
|
</tr>` |
|
|
res.find('tbody').append(docv) |
|
|
res.find('tbody').append(docv) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
frappe.ui.form.on("Publish", { |
|
|
frappe.ui.form.on("Publish", { |
|
|
|
|
|
|
|
|
onload: function (frm) { |
|
|
onload: function (frm) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(function mysam(){ |
|
|
setTimeout(function mysam() { |
|
|
$('[data-fieldname="special_tool_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="special_tool_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="qwik_service_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="qwik_service_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
}, 500); |
|
|
}, 500); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
if ( |
|
|
frm.doc.hasOwnProperty("repiar_checksheet_publish_docs") && |
|
|
frm.doc.hasOwnProperty("repiar_checksheet_publish_docs") && |
|
@ -231,7 +231,7 @@ frappe.ui.form.on("Publish", { |
|
|
) { |
|
|
) { |
|
|
cur_frm.refresh_field("torque_manual_publish_docs"); |
|
|
cur_frm.refresh_field("torque_manual_publish_docs"); |
|
|
cur_frm.remove_custom_button("Add To Publish"); |
|
|
cur_frm.remove_custom_button("Add To Publish"); |
|
|
cur_frm.set_df_property("torque_manual_publish_docs", "hidden", 0); |
|
|
cur_frm.set_df_property("torque_manual_publish_docs", "hidden", 0); |
|
|
cur_frm.refresh_field("torque_manual_publish_docs"); |
|
|
cur_frm.refresh_field("torque_manual_publish_docs"); |
|
|
} |
|
|
} |
|
|
if ( |
|
|
if ( |
|
@ -327,7 +327,7 @@ frappe.ui.form.on("Publish", { |
|
|
// if(frm.doc.variant_mapping_details){
|
|
|
// if(frm.doc.variant_mapping_details){
|
|
|
// get_variant_mapping(frm)
|
|
|
// get_variant_mapping(frm)
|
|
|
// }
|
|
|
// }
|
|
|
setTimeout(function mysam(){ |
|
|
setTimeout(function mysam() { |
|
|
$('[data-fieldname="special_tool_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="special_tool_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="qwik_service_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="qwik_service_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
}, 500); |
|
|
}, 500); |
|
@ -368,25 +368,25 @@ frappe.ui.form.on("Publish", { |
|
|
if (r.message == frm.doc.version) { |
|
|
if (r.message == frm.doc.version) { |
|
|
|
|
|
|
|
|
frm.add_custom_button(__("Global Publish"), function () { |
|
|
frm.add_custom_button(__("Global Publish"), function () { |
|
|
frappe.confirm("Are you sure you want to Publish?", () => { |
|
|
frappe.confirm("Are you sure you want to Publish?", () => { |
|
|
frappe.call({ |
|
|
frappe.call({ |
|
|
method: |
|
|
method: |
|
|
"smart_service.transactions.doctype.publish.publish.generate_global_publish", |
|
|
"smart_service.transactions.doctype.publish.publish.generate_global_publish", |
|
|
args: { |
|
|
args: { |
|
|
name: frm.doc.name, |
|
|
name: frm.doc.name, |
|
|
module_name: frm.doc.publish_module, |
|
|
module_name: frm.doc.publish_module, |
|
|
}, |
|
|
}, |
|
|
callback: function (r) { |
|
|
callback: function (r) { |
|
|
|
|
|
|
|
|
window.location.href = |
|
|
window.location.href = |
|
|
r.message.url + |
|
|
r.message.url + |
|
|
"/app/publish" + |
|
|
"/app/publish" + |
|
|
"/" + |
|
|
"/" + |
|
|
r.message.message; |
|
|
r.message.message; |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}) |
|
|
}); |
|
|
|
|
|
}) |
|
|
.addClass("btn-warning") |
|
|
.addClass("btn-warning") |
|
|
.css({ "background-color": "#f5b0cd", color: "black" }); |
|
|
.css({ "background-color": "#f5b0cd", color: "black" }); |
|
|
} |
|
|
} |
|
@ -463,7 +463,7 @@ frappe.ui.form.on("Publish", { |
|
|
frm.fields_dict.publish_documents.grid.wrapper |
|
|
frm.fields_dict.publish_documents.grid.wrapper |
|
|
.find(".grid-append-row") |
|
|
.find(".grid-append-row") |
|
|
.hide(); |
|
|
.hide(); |
|
|
|
|
|
|
|
|
// document.querySelectorAll(
|
|
|
// document.querySelectorAll(
|
|
|
// "[data-fieldname='km_report']"
|
|
|
// "[data-fieldname='km_report']"
|
|
|
// )[1].style.backgroundColor = "#e31a37";
|
|
|
// )[1].style.backgroundColor = "#e31a37";
|
|
@ -483,7 +483,7 @@ frappe.ui.form.on("Publish", { |
|
|
!frm.doc.global_publish && |
|
|
!frm.doc.global_publish && |
|
|
frappe.user.has_role("_Publisher") |
|
|
frappe.user.has_role("_Publisher") |
|
|
) { |
|
|
) { |
|
|
|
|
|
|
|
|
frappe.call({ |
|
|
frappe.call({ |
|
|
method: |
|
|
method: |
|
|
"smart_service.transactions.doctype.publish.publish.max_publish", |
|
|
"smart_service.transactions.doctype.publish.publish.max_publish", |
|
@ -492,21 +492,21 @@ frappe.ui.form.on("Publish", { |
|
|
}, |
|
|
}, |
|
|
callback: function (r) { |
|
|
callback: function (r) { |
|
|
if (r.message) { |
|
|
if (r.message) { |
|
|
|
|
|
|
|
|
if (r.message == frm.doc.version) { |
|
|
if (r.message == frm.doc.version) { |
|
|
|
|
|
|
|
|
frm.add_custom_button(__("Global Publish"), function () { |
|
|
frm.add_custom_button(__("Global Publish"), function () { |
|
|
frappe.call({ |
|
|
frappe.call({ |
|
|
method: |
|
|
method: |
|
|
"smart_service.transactions.doctype.publish.publish.global_publish", |
|
|
"smart_service.transactions.doctype.publish.publish.global_publish", |
|
|
args: { |
|
|
args: { |
|
|
doc: frm.doc.name, |
|
|
doc: frm.doc.name, |
|
|
}, |
|
|
}, |
|
|
callback: function (r) { |
|
|
callback: function (r) { |
|
|
cur_frm.reload_doc(); |
|
|
cur_frm.reload_doc(); |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
}) |
|
|
}) |
|
|
.addClass("btn-warning") |
|
|
.addClass("btn-warning") |
|
|
.css({ "background-color": "#f5b0cd", color: "black" }); |
|
|
.css({ "background-color": "#f5b0cd", color: "black" }); |
|
|
} |
|
|
} |
|
@ -514,7 +514,7 @@ frappe.ui.form.on("Publish", { |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ( |
|
|
if ( |
|
|
frm.doc.docstatus === 1 && |
|
|
frm.doc.docstatus === 1 && |
|
|
frm.doc.publish_status == "To Publish" && |
|
|
frm.doc.publish_status == "To Publish" && |
|
@ -522,95 +522,95 @@ frappe.ui.form.on("Publish", { |
|
|
frm.doc.publish_module == "Automotive System" |
|
|
frm.doc.publish_module == "Automotive System" |
|
|
) { |
|
|
) { |
|
|
console.log("call") |
|
|
console.log("call") |
|
|
|
|
|
|
|
|
frm.add_custom_button(__("Publish"), function () { |
|
|
frm.add_custom_button(__("Publish"), function () { |
|
|
frappe.confirm( |
|
|
frappe.confirm( |
|
|
"Are you sure you want to Publish?", |
|
|
"Are you sure you want to Publish?", |
|
|
() => { |
|
|
() => { |
|
|
// action to perform if Yes is selected
|
|
|
// action to perform if Yes is selected
|
|
|
if ( |
|
|
if ( |
|
|
frm.doc.vehicle && |
|
|
frm.doc.vehicle && |
|
|
frm.doc.language && |
|
|
frm.doc.language && |
|
|
frm.doc.publish_type |
|
|
frm.doc.publish_type |
|
|
) { |
|
|
) { |
|
|
frappe.call({ |
|
|
frappe.call({ |
|
|
method: |
|
|
method: |
|
|
"smart_service.transactions.doctype.publish.publish.cal_ver", |
|
|
"smart_service.transactions.doctype.publish.publish.cal_ver", |
|
|
args: { |
|
|
args: { |
|
|
vehicle: frm.doc.vehicle, |
|
|
vehicle: frm.doc.vehicle, |
|
|
lang: frm.doc.language, |
|
|
lang: frm.doc.language, |
|
|
publish_type: frm.doc.publish_type, |
|
|
publish_type: frm.doc.publish_type, |
|
|
doc: frm.doc.name, |
|
|
doc: frm.doc.name, |
|
|
publish_module: frm.doc.publish_module, |
|
|
publish_module: frm.doc.publish_module, |
|
|
}, |
|
|
}, |
|
|
callback: (r) => { |
|
|
callback: (r) => { |
|
|
|
|
|
|
|
|
frm.set_value("version", r.message); |
|
|
frm.set_value("version", r.message); |
|
|
cur_frm.refresh_field("version"); |
|
|
cur_frm.refresh_field("version"); |
|
|
if ( |
|
|
if ( |
|
|
frm.doc.docstatus === 1 && |
|
|
frm.doc.docstatus === 1 && |
|
|
frm.doc.publish_status == "To Publish" |
|
|
frm.doc.publish_status == "To Publish" |
|
|
) { |
|
|
) { |
|
|
frappe.call({ |
|
|
frappe.call({ |
|
|
// method: "smart_service.apis.publish_api.api_procedure",
|
|
|
// method: "smart_service.apis.publish_api.api_procedure",
|
|
|
method: "smart_service.apis.publish_api.new_publish", |
|
|
method: "smart_service.apis.publish_api.new_publish", |
|
|
args: { |
|
|
args: { |
|
|
args: frm.doc.name, |
|
|
args: frm.doc.name, |
|
|
publish_type: frm.doc.publish_type, |
|
|
publish_type: frm.doc.publish_type, |
|
|
vehicle: frm.doc.vehicle, |
|
|
vehicle: frm.doc.vehicle, |
|
|
language: frm.doc.language, |
|
|
language: frm.doc.language, |
|
|
version: frm.doc.version, |
|
|
version: frm.doc.version, |
|
|
}, |
|
|
}, |
|
|
callback: function (r) { |
|
|
callback: function (r) { |
|
|
|
|
|
|
|
|
console.log(r.message,"r.message") |
|
|
console.log(r.message, "r.message") |
|
|
if (r.message[0] == true) { |
|
|
if (r.message[0] == true) { |
|
|
console.log("calling",r.message) |
|
|
console.log("calling", r.message) |
|
|
frm.set_value("publish_status", "Published"); |
|
|
frm.set_value("publish_status", "Published"); |
|
|
frm.page.clear_primary_action("Publish"); |
|
|
frm.page.clear_primary_action("Publish"); |
|
|
frm.set_value( |
|
|
frm.set_value( |
|
|
"actual_published_date", |
|
|
"actual_published_date", |
|
|
frappe.datetime.nowdate() |
|
|
frappe.datetime.nowdate() |
|
|
); |
|
|
); |
|
|
frappe.call({ |
|
|
frappe.call({ |
|
|
method: |
|
|
method: |
|
|
"smart_service.transactions.doctype.publish.publish.update_procedure_value", |
|
|
"smart_service.transactions.doctype.publish.publish.update_procedure_value", |
|
|
args: { |
|
|
args: { |
|
|
name: frm.doc.name, |
|
|
name: frm.doc.name, |
|
|
file_path: r.message[1], |
|
|
file_path: r.message[1], |
|
|
}, |
|
|
}, |
|
|
callback: (r) => { |
|
|
callback: (r) => { |
|
|
// frm.save('Update');
|
|
|
// frm.save('Update');
|
|
|
// cur_frm.reload_doc()
|
|
|
// cur_frm.reload_doc()
|
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
frappe.msgprint({ |
|
|
frappe.msgprint({ |
|
|
title: __("Notification"), |
|
|
title: __("Notification"), |
|
|
message: __( |
|
|
message: __( |
|
|
"<b>Successfully Published:</b> " + r.message[1] |
|
|
"<b>Successfully Published:</b> " + r.message[1] |
|
|
), |
|
|
), |
|
|
primary_action: { |
|
|
primary_action: { |
|
|
action(values) { |
|
|
action(values) { |
|
|
frm.save("Update"); |
|
|
frm.save("Update"); |
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}, |
|
|
} |
|
|
}); |
|
|
else{ |
|
|
} |
|
|
frappe.msgprint('Failed To Publish') |
|
|
else { |
|
|
} |
|
|
frappe.msgprint('Failed To Publish') |
|
|
}, |
|
|
} |
|
|
}); |
|
|
}, |
|
|
} |
|
|
}); |
|
|
}, |
|
|
} |
|
|
}); |
|
|
}, |
|
|
} |
|
|
}); |
|
|
}, |
|
|
|
|
|
() => { |
|
|
|
|
|
// action to perform if No is selected
|
|
|
|
|
|
} |
|
|
} |
|
|
); |
|
|
}, |
|
|
}) |
|
|
() => { |
|
|
|
|
|
// action to perform if No is selected
|
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
}) |
|
|
.addClass("btn-warning") |
|
|
.addClass("btn-warning") |
|
|
.css({ "background-color": "#f5b0cd", color: "black" }); |
|
|
.css({ "background-color": "#f5b0cd", color: "black" }); |
|
|
} else if (frm.doc.publish_status == "Published") { |
|
|
} else if (frm.doc.publish_status == "Published") { |
|
@ -743,7 +743,7 @@ frappe.ui.form.on("Publish", { |
|
|
doc: frm.doc.name, |
|
|
doc: frm.doc.name, |
|
|
}, |
|
|
}, |
|
|
callback: function (r) { |
|
|
callback: function (r) { |
|
|
|
|
|
|
|
|
if (r.message['status'] == 1) { |
|
|
if (r.message['status'] == 1) { |
|
|
frm.set_value("version", r.message['data']); |
|
|
frm.set_value("version", r.message['data']); |
|
|
cur_frm.refresh_field("version"); |
|
|
cur_frm.refresh_field("version"); |
|
@ -751,9 +751,9 @@ frappe.ui.form.on("Publish", { |
|
|
// window.location.reload();
|
|
|
// window.location.reload();
|
|
|
// cur_frm.reload_doc()
|
|
|
// cur_frm.reload_doc()
|
|
|
} |
|
|
} |
|
|
else{ |
|
|
else { |
|
|
frappe.msgprint("Failed To Publish") |
|
|
frappe.msgprint("Failed To Publish") |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
@ -791,7 +791,7 @@ frappe.ui.form.on("Publish", { |
|
|
if ( |
|
|
if ( |
|
|
frm.doc.publish_module != "Automotive System" && |
|
|
frm.doc.publish_module != "Automotive System" && |
|
|
!frm.doc.hasOwnProperty("repair_checksheet_publish") && |
|
|
!frm.doc.hasOwnProperty("repair_checksheet_publish") && |
|
|
!frm.doc.hasOwnProperty("feature_finder_publish") && |
|
|
!frm.doc.hasOwnProperty("feature_finder_publish") && |
|
|
!frm.doc.hasOwnProperty("qwik_service_publish") && |
|
|
!frm.doc.hasOwnProperty("qwik_service_publish") && |
|
|
!frm.doc.hasOwnProperty("special_tool_publish") && |
|
|
!frm.doc.hasOwnProperty("special_tool_publish") && |
|
|
!frm.doc.hasOwnProperty("torque_information_publish") && |
|
|
!frm.doc.hasOwnProperty("torque_information_publish") && |
|
@ -801,7 +801,7 @@ frappe.ui.form.on("Publish", { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
variant_mapping: function (frm) { |
|
|
variant_mapping: function (frm) { |
|
|
setTimeout(function mysam(){ |
|
|
setTimeout(function mysam() { |
|
|
$('[data-fieldname="special_tool_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="special_tool_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="qwik_service_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="qwik_service_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
}, 100); |
|
|
}, 100); |
|
@ -920,13 +920,13 @@ frappe.ui.form.on("Publish", { |
|
|
if (frm.doc.publish_module == "Torque Manual") { |
|
|
if (frm.doc.publish_module == "Torque Manual") { |
|
|
add_torque_manual(frm); |
|
|
add_torque_manual(frm); |
|
|
} |
|
|
} |
|
|
if(frm.doc.publish_module == "Qwik Service"){ |
|
|
if (frm.doc.publish_module == "Qwik Service") { |
|
|
add_qwik_service(frm) |
|
|
add_qwik_service(frm) |
|
|
} |
|
|
} |
|
|
if(frm.doc.publish_module == "Training Information"){ |
|
|
if (frm.doc.publish_module == "Training Information") { |
|
|
add_training_information(frm) |
|
|
add_training_information(frm) |
|
|
} |
|
|
} |
|
|
if (frm.doc.docstatus === 0 && frm.doc.publish_status == 'To Publish' && frm.doc.publish_module=='Feature Finder') { |
|
|
if (frm.doc.docstatus === 0 && frm.doc.publish_status == 'To Publish' && frm.doc.publish_module == 'Feature Finder') { |
|
|
|
|
|
|
|
|
frm.get_field('feature_finder_publish').grid.add_custom_button(__('Add to Publish'), function () { |
|
|
frm.get_field('feature_finder_publish').grid.add_custom_button(__('Add to Publish'), function () { |
|
|
let added = 0; |
|
|
let added = 0; |
|
@ -949,29 +949,31 @@ frappe.ui.form.on("Publish", { |
|
|
child.variant = row.variant; |
|
|
child.variant = row.variant; |
|
|
child.active_status = row.active_status; |
|
|
child.active_status = row.active_status; |
|
|
added += 1; |
|
|
added += 1; |
|
|
frm.set_df_property('feature_finder_publish_docs','hidden',0) |
|
|
frm.set_df_property('feature_finder_publish_docs', 'hidden', 0) |
|
|
cur_frm.refresh_field("feature_finder_publish",'read_only',1); |
|
|
cur_frm.refresh_field("feature_finder_publish", 'read_only', 1); |
|
|
refresh_field("feature_finder_publish_docs"); |
|
|
refresh_field("feature_finder_publish_docs"); |
|
|
cur_frm.set_df_property("feature_finder_publish",'read_only',1); |
|
|
cur_frm.set_df_property("feature_finder_publish", 'read_only', 1); |
|
|
document.getElementsByClassName('btn btn-xs btn-secondary grid-add-row')[4] .setAttribute("style","display:none;"); |
|
|
document.getElementsByClassName('btn btn-xs btn-secondary grid-add-row')[4].setAttribute("style", "display:none;"); |
|
|
document.getElementsByClassName('btn btn-xs btn-secondary grid-add-row')[5] .setAttribute("style","display:none;"); |
|
|
document.getElementsByClassName('btn btn-xs btn-secondary grid-add-row')[5].setAttribute("style", "display:none;"); |
|
|
} |
|
|
} |
|
|
else{ |
|
|
else { |
|
|
frappe.msgprint(__(row.parent1 + 'Alraeady Added')) |
|
|
frappe.msgprint(__(row.parent1 + 'Alraeady Added')) |
|
|
} |
|
|
} |
|
|
cur_frm.refresh_field("feature_finder_publish_docs",'read_only',1); |
|
|
cur_frm.refresh_field("feature_finder_publish_docs", 'read_only', 1); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
if (added) { frappe.msgprint(__(added + " Doc(s) Added")); |
|
|
if (added) { |
|
|
cur_frm.set_df_property('feature_finder_publish','read_only',1) |
|
|
frappe.msgprint(__(added + " Doc(s) Added")); |
|
|
cur_frm.set_df_property("feature_finder_publish_docs",'read_only',1); |
|
|
cur_frm.set_df_property('feature_finder_publish', 'read_only', 1) |
|
|
cur_frm.refresh_field("feature_finder_publish"); } |
|
|
cur_frm.set_df_property("feature_finder_publish_docs", 'read_only', 1); |
|
|
else if(added==0) { frappe.msgprint(__("No Doc Added")); } |
|
|
cur_frm.refresh_field("feature_finder_publish"); |
|
|
|
|
|
} |
|
|
|
|
|
else if (added == 0) { frappe.msgprint(__("No Doc Added")); } |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
frm.fields_dict.repair_checksheet_publish.grid.grid_buttons.find('.btn-custom').removeClass('btn-default').addClass('btn-primary'); |
|
|
frm.fields_dict.repair_checksheet_publish.grid.grid_buttons.find('.btn-custom').removeClass('btn-default').addClass('btn-primary'); |
|
|
} |
|
|
} |
|
|
if (frm.doc.docstatus === 0 && frm.doc.publish_status == 'To Publish' && frm.doc.publish_module=='Torque Manual') { |
|
|
if (frm.doc.docstatus === 0 && frm.doc.publish_status == 'To Publish' && frm.doc.publish_module == 'Torque Manual') { |
|
|
|
|
|
|
|
|
frm.get_field('torque_manual_publish').grid.add_custom_button(__('Add to Publish'), function () { |
|
|
frm.get_field('torque_manual_publish').grid.add_custom_button(__('Add to Publish'), function () { |
|
|
let added = 0; |
|
|
let added = 0; |
|
@ -992,28 +994,30 @@ frappe.ui.form.on("Publish", { |
|
|
child.parent1 = row.parent1; |
|
|
child.parent1 = row.parent1; |
|
|
child.language = row.language; |
|
|
child.language = row.language; |
|
|
child.variant = row.variant; |
|
|
child.variant = row.variant; |
|
|
child.category= row.category; |
|
|
child.category = row.category; |
|
|
child.sub_category= row.sub_category; |
|
|
child.sub_category = row.sub_category; |
|
|
child.active_status = row.active_status; |
|
|
child.active_status = row.active_status; |
|
|
added += 1; |
|
|
added += 1; |
|
|
frm.set_df_property('torque_manual_publish_docs','hidden',0) |
|
|
frm.set_df_property('torque_manual_publish_docs', 'hidden', 0) |
|
|
cur_frm.refresh_field("torque_manual_publish",'read_only',1); |
|
|
cur_frm.refresh_field("torque_manual_publish", 'read_only', 1); |
|
|
refresh_field("torque_manual_publish_docs"); |
|
|
refresh_field("torque_manual_publish_docs"); |
|
|
cur_frm.set_df_property("torque_manual_publish",'read_only',1); |
|
|
cur_frm.set_df_property("torque_manual_publish", 'read_only', 1); |
|
|
document.getElementsByClassName('btn btn-xs btn-secondary grid-add-row')[4] .setAttribute("style","display:none;"); |
|
|
document.getElementsByClassName('btn btn-xs btn-secondary grid-add-row')[4].setAttribute("style", "display:none;"); |
|
|
document.getElementsByClassName('btn btn-xs btn-secondary grid-add-row')[5] .setAttribute("style","display:none;"); |
|
|
document.getElementsByClassName('btn btn-xs btn-secondary grid-add-row')[5].setAttribute("style", "display:none;"); |
|
|
} |
|
|
} |
|
|
else{ |
|
|
else { |
|
|
frappe.msgprint(__(row.parent1 + 'Alraeady Added')) |
|
|
frappe.msgprint(__(row.parent1 + 'Alraeady Added')) |
|
|
} |
|
|
} |
|
|
// cur_frm.refresh_field("torque_manual_publish_docs",'read_only',1);
|
|
|
// cur_frm.refresh_field("torque_manual_publish_docs",'read_only',1);
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
if (added) { frappe.msgprint(__(added + " Doc(s) Added")); |
|
|
if (added) { |
|
|
cur_frm.set_df_property('torque_manual_publish','read_only',1) |
|
|
frappe.msgprint(__(added + " Doc(s) Added")); |
|
|
cur_frm.set_df_property("torque_manual_publish_docs",'read_only',1); |
|
|
cur_frm.set_df_property('torque_manual_publish', 'read_only', 1) |
|
|
cur_frm.refresh_field("torque_manual_publish"); } |
|
|
cur_frm.set_df_property("torque_manual_publish_docs", 'read_only', 1); |
|
|
else if(added==0) { frappe.msgprint(__("No Doc Added")); } |
|
|
cur_frm.refresh_field("torque_manual_publish"); |
|
|
|
|
|
} |
|
|
|
|
|
else if (added == 0) { frappe.msgprint(__("No Doc Added")); } |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
frm.fields_dict.torque_manual_publish.grid.grid_buttons.find('.btn-custom').removeClass('btn-default').addClass('btn-primary'); |
|
|
frm.fields_dict.torque_manual_publish.grid.grid_buttons.find('.btn-custom').removeClass('btn-default').addClass('btn-primary'); |
|
@ -1195,31 +1199,31 @@ frappe.ui.form.on("Publish", { |
|
|
refresh_field("publish_documents"); |
|
|
refresh_field("publish_documents"); |
|
|
frappe.msgprint(__(frm.doc.variant_mapping + " Added")); |
|
|
frappe.msgprint(__(frm.doc.variant_mapping + " Added")); |
|
|
} |
|
|
} |
|
|
if(frm.doc.feature_finder_publish_docs && frm.doc.publish_module=='Feature Finder'){ |
|
|
// if(frm.doc.feature_finder_publish_docs && frm.doc.publish_module=='Feature Finder'){
|
|
|
frm.doc.publish_documents.forEach(publishrow => { |
|
|
// frm.doc.publish_documents.forEach(publishrow => {
|
|
|
if (frm.doc.variant_mapping == publishrow.variant_mapping) { |
|
|
// if (frm.doc.variant_mapping == publishrow.variant_mapping) {
|
|
|
dulicate = true; |
|
|
// dulicate = true;
|
|
|
} |
|
|
// }
|
|
|
}); |
|
|
// });
|
|
|
frappe.msgprint("Variant Mapping already added"); |
|
|
// frappe.msgprint("Variant Mapping already added");
|
|
|
|
|
|
|
|
|
} |
|
|
// }
|
|
|
if(frm.doc.torque_manual_publish_docs && frm.doc.publish_module=='Torque Manual'){ |
|
|
// if(frm.doc.torque_manual_publish_docs && frm.doc.publish_module=='Torque Manual'){
|
|
|
frm.doc.publish_documents.forEach(publishrow => { |
|
|
// frm.doc.publish_documents.forEach(publishrow => {
|
|
|
if (frm.doc.variant_mapping == publishrow.variant_mapping) { |
|
|
// if (frm.doc.variant_mapping == publishrow.variant_mapping) {
|
|
|
dulicate = true; |
|
|
// dulicate = true;
|
|
|
} |
|
|
// }
|
|
|
}); |
|
|
// });
|
|
|
frappe.msgprint("Variant Mapping already added"); |
|
|
// frappe.msgprint("Variant Mapping already added");
|
|
|
|
|
|
|
|
|
} |
|
|
// }
|
|
|
if (dulicate === false && frm.doc.publish_module == "Torque Manual") { |
|
|
// if (dulicate === false && frm.doc.publish_module == "Torque Manual") {
|
|
|
let child = cur_frm.add_child("publish_documents"); |
|
|
// let child = cur_frm.add_child("publish_documents");
|
|
|
child.variant_mapping = frm.doc.variant_mapping; |
|
|
// child.variant_mapping = frm.doc.variant_mapping;
|
|
|
child.item_category = "Variant Mapping"; |
|
|
// child.item_category = "Variant Mapping";
|
|
|
refresh_field("publish_documents"); |
|
|
// refresh_field("publish_documents");
|
|
|
frappe.msgprint(__(frm.doc.variant_mapping + " Added")); |
|
|
// frappe.msgprint(__(frm.doc.variant_mapping + " Added"));
|
|
|
} |
|
|
// }
|
|
|
}, |
|
|
}, |
|
|
km_report: function (frm, cdt, cdn) { |
|
|
km_report: function (frm, cdt, cdn) { |
|
|
if (frm.doc.publish_module == "Automotive System") { |
|
|
if (frm.doc.publish_module == "Automotive System") { |
|
@ -1236,7 +1240,7 @@ frappe.ui.form.on("Publish", { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
vehicle: function (frm) { |
|
|
vehicle: function (frm) { |
|
|
setTimeout(function mysam(){ |
|
|
setTimeout(function mysam() { |
|
|
$('[data-fieldname="special_tool_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="special_tool_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="qwik_service_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
$('[data-fieldname="qwik_service_publish"]').find('.grid-add-row').css('display', 'none') |
|
|
}, 100); |
|
|
}, 100); |
|
@ -1338,17 +1342,17 @@ frappe.ui.form.on("Publish", { |
|
|
frm.refresh_field("vehicle"); |
|
|
frm.refresh_field("vehicle"); |
|
|
frm.set_value("repair_checksheet_publish", ""); |
|
|
frm.set_value("repair_checksheet_publish", ""); |
|
|
frm.set_value("feature_finder_publish", ""); |
|
|
frm.set_value("feature_finder_publish", ""); |
|
|
frm.set_value("qwik_service_publish",""); |
|
|
frm.set_value("qwik_service_publish", ""); |
|
|
frm.set_value("torque_manual_publish",""); |
|
|
frm.set_value("torque_manual_publish", ""); |
|
|
frm.set_value("training_information_publish",""); |
|
|
frm.set_value("training_information_publish", ""); |
|
|
frm.set_value("special_tool_publish",""); |
|
|
frm.set_value("special_tool_publish", ""); |
|
|
frm.set_value("repiar_checksheet_publish_docs", ""); |
|
|
frm.set_value("repiar_checksheet_publish_docs", ""); |
|
|
frm.set_value("feature_finder_publish_docs", ""); |
|
|
frm.set_value("feature_finder_publish_docs", ""); |
|
|
frm.set_value("qwik_service_publish_docs", ""); |
|
|
frm.set_value("qwik_service_publish_docs", ""); |
|
|
frm.set_value("torque_manual_publish_docs", ""); |
|
|
frm.set_value("torque_manual_publish_docs", ""); |
|
|
frm.set_value("special_tool_publish_docs", ""); |
|
|
frm.set_value("special_tool_publish_docs", ""); |
|
|
frm.set_value("training_information_publish_docs", ""); |
|
|
frm.set_value("training_information_publish_docs", ""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (frm.doc.publish_module == "Repair service" && frm.doc.vehicle) { |
|
|
if (frm.doc.publish_module == "Repair service" && frm.doc.vehicle) { |
|
|
add_to_publish(frm); |
|
|
add_to_publish(frm); |
|
@ -1468,7 +1472,7 @@ frappe.ui.form.on("Publish", { |
|
|
// action to perform if No is selected
|
|
|
// action to perform if No is selected
|
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if (!lang_set_first_time && frm.doc.publish_module == "Torque Manual") { |
|
|
if (!lang_set_first_time && frm.doc.publish_module == "Torque Manual") { |
|
|
frappe.confirm( |
|
|
frappe.confirm( |
|
@ -1483,8 +1487,8 @@ frappe.ui.form.on("Publish", { |
|
|
// action to perform if No is selected
|
|
|
// action to perform if No is selected
|
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if (!lang_set_first_time && frm.doc.publish_module == "Qwik Service") { |
|
|
if (!lang_set_first_time && frm.doc.publish_module == "Qwik Service") { |
|
|
frappe.confirm( |
|
|
frappe.confirm( |
|
|
"This will clear all the data, are you sure you want to proceed?", |
|
|
"This will clear all the data, are you sure you want to proceed?", |
|
@ -1498,7 +1502,7 @@ frappe.ui.form.on("Publish", { |
|
|
// action to perform if No is selected
|
|
|
// action to perform if No is selected
|
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
lang_set_first_time = false; |
|
|
lang_set_first_time = false; |
|
@ -1535,16 +1539,16 @@ frappe.ui.form.on("Publish", { |
|
|
frm.doc.variant_mapping = ""; |
|
|
frm.doc.variant_mapping = ""; |
|
|
frm.doc.repair_checksheet_publish = ""; |
|
|
frm.doc.repair_checksheet_publish = ""; |
|
|
frm.doc.feature_finder_publish = ""; |
|
|
frm.doc.feature_finder_publish = ""; |
|
|
frm.doc.qwik_service_publish=""; |
|
|
frm.doc.qwik_service_publish = ""; |
|
|
frm.doc.special_tool_publish=""; |
|
|
frm.doc.special_tool_publish = ""; |
|
|
frm.doc.torque_manual_publish=""; |
|
|
frm.doc.torque_manual_publish = ""; |
|
|
frm.doc.training_information_publish=""; |
|
|
frm.doc.training_information_publish = ""; |
|
|
frm.set_value("feature_finder_publish_docs", ""); |
|
|
frm.set_value("feature_finder_publish_docs", ""); |
|
|
frm.set_value("repiar_checksheet_publish_docs", ""); |
|
|
frm.set_value("repiar_checksheet_publish_docs", ""); |
|
|
frm.set_value("qwik_service_publish_docs", ""); |
|
|
frm.set_value("qwik_service_publish_docs", ""); |
|
|
frm.set_value("special_tool_publish_docs",""); |
|
|
frm.set_value("special_tool_publish_docs", ""); |
|
|
frm.set_value("torque_manual_publish_docs",""); |
|
|
frm.set_value("torque_manual_publish_docs", ""); |
|
|
frm.set_value("training_information_publish",""); |
|
|
frm.set_value("training_information_publish", ""); |
|
|
frm.set_df_property("repiar_checksheet_publish_docs", "hidden", 1); |
|
|
frm.set_df_property("repiar_checksheet_publish_docs", "hidden", 1); |
|
|
frm.refresh_fields(); |
|
|
frm.refresh_fields(); |
|
|
if (frm.doc.publish_module == "Repair service") { |
|
|
if (frm.doc.publish_module == "Repair service") { |
|
@ -1562,8 +1566,8 @@ frappe.ui.form.on("Publish", { |
|
|
if (frm.doc.publish_module == "Torque Manual") { |
|
|
if (frm.doc.publish_module == "Torque Manual") { |
|
|
add_torque_manual(frm); |
|
|
add_torque_manual(frm); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(frm.doc.publish_module == "Qwik Service"){ |
|
|
if (frm.doc.publish_module == "Qwik Service") { |
|
|
add_qwik_service(frm) |
|
|
add_qwik_service(frm) |
|
|
} |
|
|
} |
|
|
if (frm.doc.publish_module == "special Tool") { |
|
|
if (frm.doc.publish_module == "special Tool") { |
|
@ -1770,7 +1774,7 @@ function add_training_information(frm) { |
|
|
if (dulicate === false) { |
|
|
if (dulicate === false) { |
|
|
let child = cur_frm.add_child( |
|
|
let child = cur_frm.add_child( |
|
|
"training_information_publish_docs" |
|
|
"training_information_publish_docs" |
|
|
); |
|
|
); |
|
|
child.vehicle = frm.doc.vehicle; |
|
|
child.vehicle = frm.doc.vehicle; |
|
|
child.parent1 = row.parent1; |
|
|
child.parent1 = row.parent1; |
|
|
child.language = row.language; |
|
|
child.language = row.language; |
|
@ -1795,7 +1799,7 @@ function add_training_information(frm) { |
|
|
)[5] |
|
|
)[5] |
|
|
.setAttribute("style", "display:none;"); |
|
|
.setAttribute("style", "display:none;"); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
frappe.msgprint(__(row.parent1 + "Alraeady Added")); |
|
|
frappe.msgprint(__(row.parent1 + "Alraeady Added")); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -2039,8 +2043,8 @@ function add_torque_manual(frm) { |
|
|
child.parent1 = row.parent1; |
|
|
child.parent1 = row.parent1; |
|
|
child.language = row.language; |
|
|
child.language = row.language; |
|
|
child.variant = row.variant; |
|
|
child.variant = row.variant; |
|
|
child.category= row.category; |
|
|
child.category = row.category; |
|
|
child.sub_category= row.sub_category; |
|
|
child.sub_category = row.sub_category; |
|
|
child.active_status = row.active_status; |
|
|
child.active_status = row.active_status; |
|
|
added += 1; |
|
|
added += 1; |
|
|
frm.set_df_property( |
|
|
frm.set_df_property( |
|
@ -2115,18 +2119,18 @@ function add_torque_manual(frm) { |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
function add_qwik_service(frm){ |
|
|
function add_qwik_service(frm) { |
|
|
cur_frm.clear_table("Qwik_service_publish"); |
|
|
cur_frm.clear_table("Qwik_service_publish"); |
|
|
cur_frm.refresh_fields(); |
|
|
cur_frm.refresh_fields(); |
|
|
frappe.call({ |
|
|
frappe.call({ |
|
|
method:"smart_service.transactions.doctype.publish.publish.get_qwik_service", |
|
|
method: "smart_service.transactions.doctype.publish.publish.get_qwik_service", |
|
|
args:{ |
|
|
args: { |
|
|
variant: frm.doc.variant_mapping, |
|
|
variant: frm.doc.variant_mapping, |
|
|
language_label: frm.doc.language, |
|
|
language_label: frm.doc.language, |
|
|
publish_type: frm.doc.publish_type |
|
|
publish_type: frm.doc.publish_type |
|
|
}, |
|
|
}, |
|
|
callback:function(r){ |
|
|
callback: function (r) { |
|
|
if (r.message.length > 0){ |
|
|
if (r.message.length > 0) { |
|
|
cur_frm.set_df_property("qwik_service_publish", "hidden", 0); |
|
|
cur_frm.set_df_property("qwik_service_publish", "hidden", 0); |
|
|
var records = r.message; |
|
|
var records = r.message; |
|
|
records.map((v) => { |
|
|
records.map((v) => { |
|
@ -2142,7 +2146,7 @@ function add_qwik_service(frm){ |
|
|
frm.doc.docstatus === 0 && |
|
|
frm.doc.docstatus === 0 && |
|
|
frm.doc.publish_status == "To Publish" && |
|
|
frm.doc.publish_status == "To Publish" && |
|
|
frm.doc.publish_module == "Qwik Service" |
|
|
frm.doc.publish_module == "Qwik Service" |
|
|
){ |
|
|
) { |
|
|
frm |
|
|
frm |
|
|
.get_field("qwik_service_publish") |
|
|
.get_field("qwik_service_publish") |
|
|
.grid.add_custom_button(__("Add to Publish"), function () { |
|
|
.grid.add_custom_button(__("Add to Publish"), function () { |
|
@ -2204,7 +2208,7 @@ function add_qwik_service(frm){ |
|
|
.find(".btn-custom") |
|
|
.find(".btn-custom") |
|
|
.removeClass("btn-default") |
|
|
.removeClass("btn-default") |
|
|
.addClass("btn-primary"); |
|
|
.addClass("btn-primary"); |
|
|
}else { |
|
|
} else { |
|
|
frappe.msgprint(__(row.parent1 + "Alraeady Added")); |
|
|
frappe.msgprint(__(row.parent1 + "Alraeady Added")); |
|
|
} |
|
|
} |
|
|
cur_frm.refresh_field( |
|
|
cur_frm.refresh_field( |
|
@ -2227,7 +2231,7 @@ function add_qwik_service(frm){ |
|
|
1 |
|
|
1 |
|
|
); |
|
|
); |
|
|
cur_frm.refresh_field("qwik_service_publish"); |
|
|
cur_frm.refresh_field("qwik_service_publish"); |
|
|
}else if (added == 0) { |
|
|
} else if (added == 0) { |
|
|
frappe.msgprint(__("No Doc Added")); |
|
|
frappe.msgprint(__("No Doc Added")); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|