Skip to content

Commit

Permalink
Fixed: PR selection in Asset
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek8848 authored and Abhishek8848 committed Oct 21, 2024
1 parent 75b867d commit 168bf96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion erpnext/assets/doctype/asset/asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ frappe.ui.form.on("Asset", {
frm.set_query("purchase_receipt", (doc) => {
return {
query: "erpnext.controllers.queries.get_purchase_receipts",
filters: { item_code: doc.item_code },
filters: { item_code: doc.item_code, company: frm.doc.company },
};
});
frm.set_query("purchase_invoice", (doc) => {
Expand Down
5 changes: 5 additions & 0 deletions erpnext/controllers/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,11 @@ def get_purchase_receipts(doctype, txt, searchfield, start, page_len, filters):
item_code=frappe.db.escape(filters.get("item_code"))
)

if filters and filters.get("company"):
query += " and pr.company = {company}".format(
company=frappe.db.escape(filters.get("company"))
)

return frappe.db.sql(query, filters)


Expand Down

0 comments on commit 168bf96

Please sign in to comment.