mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-13 20:05:09 +00:00
This commit is contained in:
@@ -992,3 +992,26 @@ def get_item_uom_query(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
limit_page_length=page_len,
|
limit_page_length=page_len,
|
||||||
as_list=1,
|
as_list=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
@frappe.validate_and_sanitize_search_inputs
|
||||||
|
def get_warehouse_address(doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict):
|
||||||
|
table = frappe.qb.DocType(doctype)
|
||||||
|
child_table = frappe.qb.DocType("Dynamic Link")
|
||||||
|
|
||||||
|
query = (
|
||||||
|
frappe.qb.from_(table)
|
||||||
|
.inner_join(child_table)
|
||||||
|
.on((table.name == child_table.parent) & (child_table.parenttype == doctype))
|
||||||
|
.select(table.name)
|
||||||
|
.where(
|
||||||
|
(child_table.link_name == filters.get("warehouse"))
|
||||||
|
& (table.disabled == 0)
|
||||||
|
& (child_table.link_doctype == "Warehouse")
|
||||||
|
& (table.name.like(f"%{txt}%"))
|
||||||
|
)
|
||||||
|
.offset(start)
|
||||||
|
.limit(page_len)
|
||||||
|
)
|
||||||
|
return query.run(as_list=1)
|
||||||
|
|||||||
@@ -38,18 +38,18 @@ frappe.ui.form.on("Stock Entry", {
|
|||||||
|
|
||||||
frm.set_query("source_warehouse_address", function () {
|
frm.set_query("source_warehouse_address", function () {
|
||||||
return {
|
return {
|
||||||
|
query: "erpnext.controllers.queries.get_warehouse_address",
|
||||||
filters: {
|
filters: {
|
||||||
link_doctype: "Warehouse",
|
warehouse: frm.doc.from_warehouse,
|
||||||
link_name: frm.doc.from_warehouse,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query("target_warehouse_address", function () {
|
frm.set_query("target_warehouse_address", function () {
|
||||||
return {
|
return {
|
||||||
|
query: "erpnext.controllers.queries.get_warehouse_address",
|
||||||
filters: {
|
filters: {
|
||||||
link_doctype: "Warehouse",
|
warehouse: frm.doc.to_warehouse,
|
||||||
link_name: frm.doc.to_warehouse,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user