fix: ignore cancelled svd while updating GLE for PR
This happens because LCV cancels and reposts entries so unless filtered by non-cancelled entries you can randomly get old values.
This commit is contained in:
parent
772336bb43
commit
8858c703a8
@ -537,8 +537,11 @@ class PurchaseInvoice(BuyingController):
|
|||||||
|
|
||||||
voucher_wise_stock_value = {}
|
voucher_wise_stock_value = {}
|
||||||
if self.update_stock:
|
if self.update_stock:
|
||||||
for d in frappe.get_all('Stock Ledger Entry',
|
stock_ledger_entries = frappe.get_all("Stock Ledger Entry",
|
||||||
fields = ["voucher_detail_no", "stock_value_difference", "warehouse"], filters={'voucher_no': self.name}):
|
fields = ["voucher_detail_no", "stock_value_difference", "warehouse"],
|
||||||
|
filters={"voucher_no": self.name, "voucher_type": self.doctype, "is_cancelled": 0}
|
||||||
|
)
|
||||||
|
for d in stock_ledger_entries:
|
||||||
voucher_wise_stock_value.setdefault((d.voucher_detail_no, d.warehouse), d.stock_value_difference)
|
voucher_wise_stock_value.setdefault((d.voucher_detail_no, d.warehouse), d.stock_value_difference)
|
||||||
|
|
||||||
valuation_tax_accounts = [d.account_head for d in self.get("taxes")
|
valuation_tax_accounts = [d.account_head for d in self.get("taxes")
|
||||||
|
@ -286,7 +286,7 @@ class PurchaseReceipt(BuyingController):
|
|||||||
if warehouse_account.get(d.warehouse):
|
if warehouse_account.get(d.warehouse):
|
||||||
stock_value_diff = frappe.db.get_value("Stock Ledger Entry",
|
stock_value_diff = frappe.db.get_value("Stock Ledger Entry",
|
||||||
{"voucher_type": "Purchase Receipt", "voucher_no": self.name,
|
{"voucher_type": "Purchase Receipt", "voucher_no": self.name,
|
||||||
"voucher_detail_no": d.name, "warehouse": d.warehouse}, "stock_value_difference")
|
"voucher_detail_no": d.name, "warehouse": d.warehouse, "is_cancelled": 0}, "stock_value_difference")
|
||||||
|
|
||||||
if not stock_value_diff:
|
if not stock_value_diff:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user