codacy fixes

This commit is contained in:
Ranjith 2018-05-05 14:32:42 +05:30
parent 715780b78b
commit 9505ea93cf

View File

@ -1,33 +1,33 @@
frappe.ui.form.on(cur_frm.doctype, { frappe.ui.form.on(cur_frm.doctype, {
setup: function(frm) { setup: function(frm) {
frm.set_query("employee", function() { frm.set_query("employee", function() {
return { return {
filters: { filters: {
"status": "Active" "status": "Active"
} }
}; };
}) });
}, },
onload: function(frm){ onload: function(frm){
if(frm.doc.__islocal){ if(frm.doc.__islocal){
if(frm.doctype == "Employee Promotion"){ if(frm.doctype == "Employee Promotion"){
frm.doc.promotion_details = []; frm.doc.promotion_details = [];
}else if (frm.doctype == "Employee Transfer") { }else if (frm.doctype == "Employee Transfer") {
frm.doc.transfer_details = []; frm.doc.transfer_details = [];
} }
} }
}, },
employee: function(frm) { employee: function(frm) {
frm.add_fetch("employee", "company", "company"); frm.add_fetch("employee", "company", "company");
}, },
refresh: function(frm) { refresh: function(frm) {
var table; var table;
if(frm.doctype == "Employee Promotion"){ if(frm.doctype == "Employee Promotion"){
table = "promotion_details"; table = "promotion_details";
}else if (frm.doctype == "Employee Transfer") { }else if (frm.doctype == "Employee Transfer") {
table = "transfer_details" table = "transfer_details"
} }
if(!table){return} if(!table){return};
cur_frm.fields_dict[table].grid.wrapper.find('.grid-add-row').hide(); cur_frm.fields_dict[table].grid.wrapper.find('.grid-add-row').hide();
cur_frm.fields_dict[table].grid.add_custom_button(__('Add Row'), () => { cur_frm.fields_dict[table].grid.add_custom_button(__('Add Row'), () => {
if(!frm.doc.employee){ if(!frm.doc.employee){
@ -84,7 +84,7 @@ var show_dialog = function(frm, table, field_labels) {
d.get_primary_btn().attr('disabled', true); d.get_primary_btn().attr('disabled', true);
d.data = {}; d.data = {};
d.show(); d.show();
} };
var render_dynamic_field = function(d, fieldtype, options, fieldname) { var render_dynamic_field = function(d, fieldtype, options, fieldname) {
d.data.new = null; d.data.new = null;
@ -104,7 +104,7 @@ var render_dynamic_field = function(d, fieldtype, options, fieldname) {
}).on("awesomplete-close", function(e) { }).on("awesomplete-close", function(e) {
d.data.new = e.target.value; d.data.new = e.target.value;
}); });
} };
var add_to_details = function(frm, d, table) { var add_to_details = function(frm, d, table) {
let data = d.data; let data = d.data;
@ -133,7 +133,7 @@ var add_to_details = function(frm, d, table) {
}else { }else {
frappe.show_alert({message:__("Value missing"),indicator:'red'}); frappe.show_alert({message:__("Value missing"),indicator:'red'});
} }
} };
var validate_duplicate = function(frm, table, fieldname){ var validate_duplicate = function(frm, table, fieldname){
let duplicate = false; let duplicate = false;
@ -144,4 +144,4 @@ var validate_duplicate = function(frm, table, fieldname){
} }
}); });
return duplicate; return duplicate;
} };