mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-15 09:53:09 +00:00
fix: correct query for dispatch_address; remove unnecessary code; increase reusability;
(cherry picked from commit 999ffe86a7)
This commit is contained in:
@@ -57,11 +57,7 @@ erpnext.buying = {
|
||||
|
||||
if(this.frm.get_field('dispatch_address')) {
|
||||
this.frm.set_query("dispatch_address", () => {
|
||||
if(this.frm.doc.is_return){
|
||||
return erpnext.queries.company_address_query(this.frm.doc);
|
||||
}
|
||||
|
||||
return erpnext.queries.supplier_address_query(this.frm);
|
||||
return erpnext.queries.address_query(this.frm.doc);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,23 +112,6 @@ $.extend(erpnext.queries, {
|
||||
};
|
||||
},
|
||||
|
||||
supplier_address_query: function (frm) {
|
||||
if (!frm.doc.supplier) {
|
||||
frm.scroll_to_field("supplier");
|
||||
frappe.show_alert({
|
||||
message: __("Please set {0} first.", [
|
||||
__(frappe.meta.get_label(frm.doc.doctype, "supplier", frm.doc.name)),
|
||||
]),
|
||||
indicator: "orange",
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
query: "frappe.contacts.doctype.address.address.address_query",
|
||||
filters: { link_doctype: "Supplier", link_name: frm.doc.supplier },
|
||||
};
|
||||
},
|
||||
|
||||
dispatch_address_query: function (doc) {
|
||||
var filters = { link_doctype: "Company", link_name: doc.company || "" };
|
||||
var is_drop_ship = doc.items.some((item) => item.delivered_by_supplier);
|
||||
|
||||
Reference in New Issue
Block a user