Merge pull request #9769 from manassolanki/payment-entry
frappe call if posting date is defined
This commit is contained in:
commit
cf82c3828e
@ -291,37 +291,39 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
|
|
||||||
set_account_currency_and_balance: function(frm, account, currency_field,
|
set_account_currency_and_balance: function(frm, account, currency_field,
|
||||||
balance_field, callback_function) {
|
balance_field, callback_function) {
|
||||||
frappe.call({
|
if (frm.doc.posting_date) {
|
||||||
method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_account_details",
|
frappe.call({
|
||||||
args: {
|
method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_account_details",
|
||||||
"account": account,
|
args: {
|
||||||
"date": frm.doc.posting_date
|
"account": account,
|
||||||
},
|
"date": frm.doc.posting_date
|
||||||
callback: function(r, rt) {
|
},
|
||||||
if(r.message) {
|
callback: function(r, rt) {
|
||||||
frm.set_value(currency_field, r.message['account_currency']);
|
if(r.message) {
|
||||||
frm.set_value(balance_field, r.message['account_balance']);
|
frm.set_value(currency_field, r.message['account_currency']);
|
||||||
|
frm.set_value(balance_field, r.message['account_balance']);
|
||||||
|
|
||||||
if(frm.doc.payment_type=="Receive" && currency_field=="paid_to_account_currency") {
|
if(frm.doc.payment_type=="Receive" && currency_field=="paid_to_account_currency") {
|
||||||
frm.toggle_reqd(["reference_no", "reference_date"],
|
frm.toggle_reqd(["reference_no", "reference_date"],
|
||||||
(r.message['account_type'] == "Bank" ? 1 : 0));
|
(r.message['account_type'] == "Bank" ? 1 : 0));
|
||||||
if(!frm.doc.received_amount && frm.doc.paid_amount)
|
if(!frm.doc.received_amount && frm.doc.paid_amount)
|
||||||
frm.events.paid_amount(frm);
|
frm.events.paid_amount(frm);
|
||||||
} else if(frm.doc.payment_type=="Pay" && currency_field=="paid_from_account_currency") {
|
} else if(frm.doc.payment_type=="Pay" && currency_field=="paid_from_account_currency") {
|
||||||
frm.toggle_reqd(["reference_no", "reference_date"],
|
frm.toggle_reqd(["reference_no", "reference_date"],
|
||||||
(r.message['account_type'] == "Bank" ? 1 : 0));
|
(r.message['account_type'] == "Bank" ? 1 : 0));
|
||||||
|
|
||||||
if(!frm.doc.paid_amount && frm.doc.received_amount)
|
if(!frm.doc.paid_amount && frm.doc.received_amount)
|
||||||
frm.events.received_amount(frm);
|
frm.events.received_amount(frm);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(callback_function) callback_function(frm);
|
||||||
|
|
||||||
|
frm.events.hide_unhide_fields(frm);
|
||||||
|
frm.events.set_dynamic_labels(frm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(callback_function) callback_function(frm);
|
|
||||||
|
|
||||||
frm.events.hide_unhide_fields(frm);
|
|
||||||
frm.events.set_dynamic_labels(frm);
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
paid_from_account_currency: function(frm) {
|
paid_from_account_currency: function(frm) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user