mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
Merge pull request #46824 from frappe/mergify/bp/version-15-hotfix/pr-46808
fix: condition to update the last purchase rate (backport #46808)
This commit is contained in:
@@ -1196,7 +1196,7 @@ def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0):
|
|||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
def get_purchase_voucher_details(doctype, item_code, document_name):
|
def get_purchase_voucher_details(doctype, item_code, document_name=None):
|
||||||
parent_doc = frappe.qb.DocType(doctype)
|
parent_doc = frappe.qb.DocType(doctype)
|
||||||
child_doc = frappe.qb.DocType(doctype + " Item")
|
child_doc = frappe.qb.DocType(doctype + " Item")
|
||||||
|
|
||||||
@@ -1215,9 +1215,11 @@ def get_purchase_voucher_details(doctype, item_code, document_name):
|
|||||||
)
|
)
|
||||||
.where(parent_doc.docstatus == 1)
|
.where(parent_doc.docstatus == 1)
|
||||||
.where(child_doc.item_code == item_code)
|
.where(child_doc.item_code == item_code)
|
||||||
.where(parent_doc.name != document_name)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if document_name:
|
||||||
|
query = query.where(parent_doc.name != document_name)
|
||||||
|
|
||||||
if doctype in ("Purchase Receipt", "Purchase Invoice"):
|
if doctype in ("Purchase Receipt", "Purchase Invoice"):
|
||||||
query = query.select(parent_doc.posting_date, parent_doc.posting_time)
|
query = query.select(parent_doc.posting_date, parent_doc.posting_time)
|
||||||
query = query.orderby(
|
query = query.orderby(
|
||||||
|
|||||||
Reference in New Issue
Block a user