fix(stock): skip returns when recalculating item last purchase rate

(cherry picked from commit e27989f201)
This commit is contained in:
R-Jayaraman
2026-10-24 10:01:20 +00:00
committed by Mergify
parent 90921e5494
commit d2b83d4b1f
+1
View File
@@ -1371,6 +1371,7 @@ def get_purchase_voucher_details(doctype, item_code, document_name=None):
query = query.where(parent_doc.name != document_name)
if doctype in ("Purchase Receipt", "Purchase Invoice"):
query = query.where(parent_doc.is_return == 0)
query = query.select(parent_doc.posting_date, parent_doc.posting_time)
query = query.orderby(
parent_doc.posting_date, parent_doc.posting_time, parent_doc.name, order=Order.desc