mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 10:11:20 +00:00
[fix] [client script] call cur_frm.cscript.custom_ type functions in the callback of standard functions
This commit is contained in:
@@ -44,7 +44,7 @@ cur_frm.cscript.kra_template = function(doc, dt, dn) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.calculate_total_score = function(doc,cdt,cdn){
|
||||
//get_server_fields('calculate_total','','',doc,cdt,cdn,1);
|
||||
//return get_server_fields('calculate_total','','',doc,cdt,cdn,1);
|
||||
var val = getchildren('Appraisal Goal', doc.name, 'appraisal_details', doc.doctype);
|
||||
var total =0;
|
||||
for(var i = 0; i<val.length; i++){
|
||||
|
||||
@@ -40,7 +40,7 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
|
||||
|
||||
setup_leave_approver_select: function() {
|
||||
var me = this;
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
method:"hr.utils.get_leave_approver_list",
|
||||
callback: function(r) {
|
||||
me.frm.fields_dict.employee_leave_approvers.grid
|
||||
@@ -53,7 +53,7 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
|
||||
},
|
||||
|
||||
date_of_birth: function() {
|
||||
cur_frm.call({
|
||||
return cur_frm.call({
|
||||
method: "get_retirement_date",
|
||||
args: {date_of_birth: this.frm.doc.date_of_birth}
|
||||
});
|
||||
@@ -88,7 +88,7 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
|
||||
|
||||
validate_salary_structure: function(btn, callback) {
|
||||
var me = this;
|
||||
this.frm.call({
|
||||
return this.frm.call({
|
||||
btn: btn,
|
||||
method: "webnotes.client.get_value",
|
||||
args: {
|
||||
|
||||
@@ -19,7 +19,7 @@ wn.provide("erpnext.hr");
|
||||
erpnext.hr.ExpenseClaimController = wn.ui.form.Controller.extend({
|
||||
make_bank_voucher: function() {
|
||||
var me = this;
|
||||
wn.call({
|
||||
return wn.call({
|
||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
||||
args: {
|
||||
"company": cur_frm.doc.company,
|
||||
@@ -64,7 +64,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn) {
|
||||
cur_frm.cscript.clear_sanctioned(doc);
|
||||
}
|
||||
|
||||
cur_frm.call({
|
||||
return cur_frm.call({
|
||||
method:"hr.utils.get_expense_approver_list",
|
||||
callback: function(r) {
|
||||
cur_frm.set_df_property("exp_approver", "options", r.message);
|
||||
|
||||
@@ -72,7 +72,7 @@ cur_frm.cscript.new_leaves_allocated = function(doc, dt, dn) {
|
||||
// ---------------------------------
|
||||
calculate_total_leaves_allocated = function(doc, dt, dn) {
|
||||
if(cint(doc.carry_forward) == 1 && doc.leave_type && doc.fiscal_year && doc.employee){
|
||||
get_server_fields('get_carry_forwarded_leaves','','', doc, dt, dn, 1);
|
||||
return get_server_fields('get_carry_forwarded_leaves','','', doc, dt, dn, 1);
|
||||
}
|
||||
else if(cint(doc.carry_forward) == 0){
|
||||
set_multiple(dt,dn,{carry_forwarded_leaves : 0,total_leaves_allocated : flt(doc.new_leaves_allocated)});
|
||||
|
||||
@@ -24,7 +24,7 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||
cur_frm.cscript.calculate_total_days(doc, dt, dn);
|
||||
}
|
||||
cur_frm.set_df_property("leave_approver", "options", "");
|
||||
cur_frm.call({
|
||||
return cur_frm.call({
|
||||
method:"hr.utils.get_leave_approver_list",
|
||||
callback: function(r) {
|
||||
cur_frm.set_df_property("leave_approver", "options", $.map(r.message,
|
||||
@@ -105,7 +105,7 @@ cur_frm.cscript.to_date = function(doc, dt, dn) {
|
||||
|
||||
cur_frm.cscript.get_leave_balance = function(doc, dt, dn) {
|
||||
if(doc.docstatus==0 && doc.employee && doc.leave_type && doc.fiscal_year) {
|
||||
cur_frm.call({
|
||||
return cur_frm.call({
|
||||
method: "get_leave_balance",
|
||||
args: {
|
||||
employee: doc.employee,
|
||||
@@ -121,7 +121,7 @@ cur_frm.cscript.calculate_total_days = function(doc, dt, dn) {
|
||||
if(cint(doc.half_day) == 1) set_multiple(dt,dn,{total_leave_days:0.5});
|
||||
else{
|
||||
// server call is done to include holidays in leave days calculations
|
||||
get_server_fields('get_total_leave_days', '', '', doc, dt, dn, 1);
|
||||
return get_server_fields('get_total_leave_days', '', '', doc, dt, dn, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ cur_frm.cscript.onload = function(doc,dt,dn){
|
||||
// Validation For To Date
|
||||
// ================================================================================================
|
||||
cur_frm.cscript.to_date = function(doc, cdt, cdn) {
|
||||
$c('runserverobj', args={'method':'to_date_validation','docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
|
||||
return $c('runserverobj', args={'method':'to_date_validation','docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
|
||||
function(r, rt) {
|
||||
var doc = locals[cdt][cdn];
|
||||
if (r.message) {
|
||||
|
||||
@@ -28,7 +28,7 @@ cur_frm.cscript.create_salary_slip = function(doc, cdt, cdn) {
|
||||
if (r.message)
|
||||
display_activity_log(r.message);
|
||||
}
|
||||
$c('runserverobj', args={'method':'create_sal_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
|
||||
return $c('runserverobj', args={'method':'create_sal_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
|
||||
if (r.message)
|
||||
display_activity_log(r.message);
|
||||
}
|
||||
$c('runserverobj', args={'method':'submit_salary_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
|
||||
return $c('runserverobj', args={'method':'submit_salary_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,5 +79,5 @@ cur_frm.cscript.make_jv = function(doc, dt, dn) {
|
||||
|
||||
loaddoc('Journal Voucher', jv.name);
|
||||
}
|
||||
$c_obj(make_doclist(dt,dn),'get_acc_details','',call_back);
|
||||
return $c_obj(make_doclist(dt,dn),'get_acc_details','',call_back);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ cur_frm.cscript.onload = function(doc,dt,dn){
|
||||
// Get leave details
|
||||
//---------------------------------------------------------------------
|
||||
cur_frm.cscript.fiscal_year = function(doc,dt,dn){
|
||||
$c_obj(make_doclist(doc.doctype,doc.name), 'get_emp_and_leave_details','',function(r, rt) {
|
||||
return $c_obj(make_doclist(doc.doctype,doc.name), 'get_emp_and_leave_details','',function(r, rt) {
|
||||
var doc = locals[dt][dn];
|
||||
cur_frm.refresh();
|
||||
calculate_all(doc, dt, dn);
|
||||
@@ -45,7 +45,7 @@ cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year;
|
||||
|
||||
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
|
||||
if (doc.employee && doc.fiscal_year && doc.month) {
|
||||
$c_obj(make_doclist(doc.doctype,doc.name), 'get_leave_details',doc.leave_without_pay,function(r, rt) {
|
||||
return $c_obj(make_doclist(doc.doctype,doc.name), 'get_leave_details',doc.leave_without_pay,function(r, rt) {
|
||||
var doc = locals[dt][dn];
|
||||
cur_frm.refresh();
|
||||
calculate_all(doc, dt, dn);
|
||||
|
||||
@@ -20,7 +20,7 @@ cur_frm.cscript.onload = function(doc, dt, dn){
|
||||
e_tbl = getchildren('Salary Structure Earning', doc.name, 'earning_details', doc.doctype);
|
||||
d_tbl = getchildren('Salary Structure Deduction', doc.name, 'deduction_details', doc.doctype);
|
||||
if (e_tbl.length == 0 && d_tbl.length == 0)
|
||||
$c_obj(make_doclist(doc.doctype,doc.name),'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
|
||||
return $c_obj(make_doclist(doc.doctype,doc.name),'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, dt, dn){
|
||||
@@ -40,7 +40,7 @@ cur_frm.cscript['Make Salary Slip'] = function() {
|
||||
|
||||
cur_frm.cscript.employee = function(doc, dt, dn){
|
||||
if (doc.employee)
|
||||
get_server_fields('get_employee_details','','',doc,dt,dn);
|
||||
return get_server_fields('get_employee_details','','',doc,dt,dn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.modified_value = function(doc, cdt, cdn){
|
||||
|
||||
Reference in New Issue
Block a user