Skip to content

Commit

Permalink
fix: valuation rate for batch in stock reconciliation (backport #44657)…
Browse files Browse the repository at this point in the history
… (#44664)

fix: valuation rate for batch in stock reconciliation  (#44657)

fix: valuation rate for batch in stock reco
(cherry picked from commit 15c7d26)

Co-authored-by: rohitwaghchaure <[email protected]>
  • Loading branch information
mergify[bot] and rohitwaghchaure authored Dec 11, 2024
1 parent 44f798c commit 2466e4c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ frappe.ui.form.on("Stock Reconciliation", {
posting_time: frm.doc.posting_time,
batch_no: d.batch_no,
row: d,
company: frm.doc.company,
},
callback: function (r) {
const row = frappe.model.get_doc(cdt, cdn);
Expand Down
18 changes: 18 additions & 0 deletions erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ def _changed(item):
batch_no=item.batch_no,
inventory_dimensions_dict=inventory_dimensions_dict,
row=item,
company=self.company,
)

if (
Expand Down Expand Up @@ -974,6 +975,7 @@ def recalculate_current_qty(self, voucher_detail_no):
self.posting_date,
self.posting_time,
row=row,
company=self.company,
)

current_qty = item_dict.get("qty")
Expand Down Expand Up @@ -1308,6 +1310,7 @@ def get_stock_balance_for(
with_valuation_rate: bool = True,
inventory_dimensions_dict=None,
row=None,
company=None,
):
frappe.has_permission("Stock Reconciliation", "write", throw=True)

Expand Down Expand Up @@ -1367,6 +1370,21 @@ def get_stock_balance_for(
or 0
)

if row.use_serial_batch_fields and row.batch_no:
rate = get_incoming_rate(
frappe._dict(
{
"item_code": row.item_code,
"warehouse": row.warehouse,
"qty": row.qty * -1,
"batch_no": row.batch_no,
"company": company,
"posting_date": posting_date,
"posting_time": posting_time,
}
)
)

return {
"qty": qty,
"rate": rate,
Expand Down

0 comments on commit 2466e4c

Please sign in to comment.