fix: Check for Company before trying to fetch party details
This commit is contained in:
parent
4bff9d8663
commit
e27b996e38
@ -85,6 +85,10 @@ erpnext.utils.get_party_details = function(frm, method, args, callback) {
|
|||||||
args.posting_date, args.party_type=="Customer" ? "customer": "supplier")) return;
|
args.posting_date, args.party_type=="Customer" ? "customer": "supplier")) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!erpnext.utils.validate_mandatory(frm, "Company", frm.doc.company, args.party_type=="Customer" ? "customer": "supplier")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
args.currency = frm.doc.currency;
|
args.currency = frm.doc.currency;
|
||||||
args.company = frm.doc.company;
|
args.company = frm.doc.company;
|
||||||
args.doctype = frm.doc.doctype;
|
args.doctype = frm.doc.doctype;
|
||||||
@ -188,6 +192,10 @@ erpnext.utils.set_taxes_from_address = function(frm, triggered_from_field, billi
|
|||||||
|
|
||||||
erpnext.utils.set_taxes = function(frm, triggered_from_field) {
|
erpnext.utils.set_taxes = function(frm, triggered_from_field) {
|
||||||
if (frappe.meta.get_docfield(frm.doc.doctype, "taxes")) {
|
if (frappe.meta.get_docfield(frm.doc.doctype, "taxes")) {
|
||||||
|
if (!erpnext.utils.validate_mandatory(frm, "Company", frm.doc.company, triggered_from_field)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!erpnext.utils.validate_mandatory(frm, "Lead / Customer / Supplier",
|
if (!erpnext.utils.validate_mandatory(frm, "Lead / Customer / Supplier",
|
||||||
frm.doc.customer || frm.doc.supplier || frm.doc.lead || frm.doc.party_name, triggered_from_field)) {
|
frm.doc.customer || frm.doc.supplier || frm.doc.lead || frm.doc.party_name, triggered_from_field)) {
|
||||||
return;
|
return;
|
||||||
@ -256,7 +264,7 @@ erpnext.utils.validate_mandatory = function(frm, label, value, trigger_on) {
|
|||||||
if (!value) {
|
if (!value) {
|
||||||
frm.doc[trigger_on] = "";
|
frm.doc[trigger_on] = "";
|
||||||
refresh_field(trigger_on);
|
refresh_field(trigger_on);
|
||||||
frappe.msgprint(__("Please enter {0} first", [label]));
|
frappe.throw({message:__("Please enter {0} first", [label]), title:__("Mandatory")});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user