mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-13 09:43:49 +00:00
fix: current qty in stock reco
(cherry picked from commit 58315bc963)
# Conflicts:
# erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
This commit is contained in:
committed by
Mergify
parent
367bd58e76
commit
5979683e8e
@@ -13,7 +13,11 @@ from erpnext.controllers.stock_controller import StockController
|
||||
from erpnext.stock.doctype.batch.batch import get_batch_qty
|
||||
from erpnext.stock.doctype.inventory_dimension.inventory_dimension import get_inventory_dimensions
|
||||
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
|
||||
<<<<<<< HEAD
|
||||
from erpnext.stock.utils import get_stock_balance
|
||||
=======
|
||||
from erpnext.stock.utils import get_combine_datetime, get_incoming_rate, get_stock_balance
|
||||
>>>>>>> 58315bc963 (fix: current qty in stock reco)
|
||||
|
||||
|
||||
class OpeningEntryAccountError(frappe.ValidationError):
|
||||
@@ -646,6 +650,7 @@ class StockReconciliation(StockController):
|
||||
self.posting_date,
|
||||
self.posting_time,
|
||||
self.name,
|
||||
sle_creation,
|
||||
)
|
||||
|
||||
precesion = row.precision("current_qty")
|
||||
@@ -705,8 +710,11 @@ class StockReconciliation(StockController):
|
||||
return allow_negative_stock
|
||||
|
||||
|
||||
def get_batch_qty_for_stock_reco(item_code, warehouse, batch_no, posting_date, posting_time, voucher_no):
|
||||
def get_batch_qty_for_stock_reco(
|
||||
item_code, warehouse, batch_no, posting_date, posting_time, voucher_no, sle_creation
|
||||
):
|
||||
ledger = frappe.qb.DocType("Stock Ledger Entry")
|
||||
posting_datetime = get_combine_datetime(posting_date, posting_time)
|
||||
|
||||
query = (
|
||||
frappe.qb.from_(ledger)
|
||||
@@ -719,12 +727,11 @@ def get_batch_qty_for_stock_reco(item_code, warehouse, batch_no, posting_date, p
|
||||
& (ledger.docstatus == 1)
|
||||
& (ledger.is_cancelled == 0)
|
||||
& (ledger.batch_no == batch_no)
|
||||
& (ledger.posting_date <= posting_date)
|
||||
& (
|
||||
CombineDatetime(ledger.posting_date, ledger.posting_time)
|
||||
<= CombineDatetime(posting_date, posting_time)
|
||||
)
|
||||
& (ledger.voucher_no != voucher_no)
|
||||
& (
|
||||
(ledger.posting_datetime < posting_datetime)
|
||||
| ((ledger.posting_datetime == posting_datetime) & (ledger.creation < sle_creation))
|
||||
)
|
||||
)
|
||||
.groupby(ledger.batch_no)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user