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