mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-15 21:05:10 +00:00
fix: enhance dispatch address query logic and add supplier address query
(cherry picked from commit 9a859e54b6)
This commit is contained in:
@@ -57,13 +57,11 @@ erpnext.buying = {
|
|||||||
|
|
||||||
if(this.frm.get_field('dispatch_address')) {
|
if(this.frm.get_field('dispatch_address')) {
|
||||||
this.frm.set_query("dispatch_address", () => {
|
this.frm.set_query("dispatch_address", () => {
|
||||||
if(this.frm.doc.supplier) {
|
if(this.frm.doc.is_return){
|
||||||
return {
|
return erpnext.queries.company_address_query(this.frm.doc);
|
||||||
query: 'frappe.contacts.doctype.address.address.address_query',
|
}
|
||||||
filters: { link_doctype: 'Supplier', link_name: this.frm.doc.supplier }
|
|
||||||
};
|
return erpnext.queries.supplier_address_query(this.frm.doc);
|
||||||
} else
|
|
||||||
return erpnext.queries.dispatch_address_query(this.frm.doc)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,6 +112,23 @@ $.extend(erpnext.queries, {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
supplier_address_query: function (doc) {
|
||||||
|
if (!doc.supplier) {
|
||||||
|
cur_frm.scroll_to_field("supplier");
|
||||||
|
frappe.show_alert({
|
||||||
|
message: __("Please set {0} first.", [
|
||||||
|
__(frappe.meta.get_label(doc.doctype, "supplier", doc.name)),
|
||||||
|
]),
|
||||||
|
indicator: "orange",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
query: "frappe.contacts.doctype.address.address.address_query",
|
||||||
|
filters: { link_doctype: "Supplier", link_name: doc.supplier },
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
dispatch_address_query: function (doc) {
|
dispatch_address_query: function (doc) {
|
||||||
var filters = { link_doctype: "Company", link_name: doc.company || "" };
|
var filters = { link_doctype: "Company", link_name: doc.company || "" };
|
||||||
var is_drop_ship = doc.items.some((item) => item.delivered_by_supplier);
|
var is_drop_ship = doc.items.some((item) => item.delivered_by_supplier);
|
||||||
|
|||||||
Reference in New Issue
Block a user