[fix] call get_party_account only if party is set
This commit is contained in:
parent
3aa14f54b7
commit
8d1c7a2524
@ -270,7 +270,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
me.apply_pricing_rule();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var set_party_account = function(set_pricing) {
|
||||
if (in_list(["Sales Invoice", "Purchase Invoice"], me.frm.doc.doctype)) {
|
||||
if(me.frm.doc.doctype=="Sales Invoice") {
|
||||
@ -280,25 +280,27 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
var party_type = "Supplier";
|
||||
var party_account_field = 'credit_to';
|
||||
}
|
||||
|
||||
return frappe.call({
|
||||
method: "erpnext.accounts.party.get_party_account",
|
||||
args: {
|
||||
company: me.frm.doc.company,
|
||||
party_type: party_type,
|
||||
party: me.frm.doc[frappe.model.scrub(party_type)]
|
||||
},
|
||||
callback: function(r) {
|
||||
if(!r.exc && r.message) {
|
||||
me.frm.set_value(party_account_field, r.message);
|
||||
set_pricing();
|
||||
|
||||
if(me.frm.doc[frappe.model.scrub(party_type)]) {
|
||||
return frappe.call({
|
||||
method: "erpnext.accounts.party.get_party_account",
|
||||
args: {
|
||||
company: me.frm.doc.company,
|
||||
party_type: party_type,
|
||||
party: me.frm.doc[frappe.model.scrub(party_type)]
|
||||
},
|
||||
callback: function(r) {
|
||||
if(!r.exc && r.message) {
|
||||
me.frm.set_value(party_account_field, r.message);
|
||||
set_pricing();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
set_pricing();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date;
|
||||
|
Loading…
x
Reference in New Issue
Block a user