* fix(stock): reset bin when a repost finds no stock ledger entries
`build()` wipes `prev_sle_dict` in `initialize_reposting()` before `update_bin()`
runs, so a repost over an item and warehouse whose ledger is empty writes no bin
at all. `actual_qty`, `stock_value` and `valuation_rate` keep their last values,
bin totals drift from the stock balance, and reposting again cannot heal it.
Reset those bins as a terminal step in `update_bin()`, guarded by a re-check that
no live SLE exists so ordinary valuation is untouched.
Cancel is already correct on this branch, since `initialize_previous_data()` seeds
zeros when there is no previous SLE and the sle_id path never calls
`initialize_reposting()`. That seeding stays; this is a repost-path fix only.
develop drops it in #58362 because the `cancelled` guard makes it dead code there.
* test(stock): cover bin reset when the stock ledger is empty
* fix: keep source rate on re-fetch when maintain same rate is enabled (backport #57479)
With "maintain same rate" on, re-fetching item details on a row mapped from a
source document (e.g. a Purchase Order) pulled the latest Item Price, giving a
rate the document can never be saved with. Skip the price list fetch for such
rows and keep the source rate, both for a single-row re-fetch and the bulk
apply_price_list path (price list / party / conversion rate change).
The rate is read from the linked source row in the database (not the mutable
target row) and permission-checked against the source document, so an unsaved
edit can't lock in a different rate and a crafted request can't disclose
another document's pricing.
Fixesfrappe/erpnext#57436
* fix: resolve linter findings in get_item_details
Add missing type hints on the whitelisted get_item_details
signature and rename maintain_same_rate_enabled's sole "args"
parameter, both flagged by the semgrep security/code-quality
rules. Also drops an extra blank line that ruff-format rejected.
* fix: widen get_item_details doc type hint to include Document
accounts_controller.py calls get_item_details(args, self, ...)
during validate, passing the transaction Document itself, not
a dict/JSON string. The narrower hint tripped Frappe's runtime
argument type validation on every whitelisted call with a live
Document, failing test-record creation across the suite.
* fix: keep Currency and Price List section open for foreign currency (#58074)
The section is marked collapsible with no condition, so it always
rendered collapsed. When the transaction currency differs from the
company currency the exchange rate is relevant and was hidden behind
a click.
Adds collapsible_depends_on so the section starts expanded whenever
the transaction currency differs from the company currency, and stays
collapsed otherwise.
(cherry picked from commit 4a8342496e)
# Conflicts:
# erpnext/accounts/doctype/pos_invoice/pos_invoice.json
# erpnext/accounts/doctype/sales_invoice/sales_invoice.json
# erpnext/buying/doctype/purchase_order/purchase_order.json
# erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
# erpnext/selling/doctype/sales_order/sales_order.json
# erpnext/stock/doctype/delivery_note/delivery_note.json
# erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
* fix: resolve unresolved cherry-pick conflict markers in modified timestamps
Mergify's automatic cherry-pick of #58074 left conflict markers
committed on the modified field, breaking JSON parsing.
---------
Co-authored-by: Jatin3128 <140256508+Jatin3128@users.noreply.github.com>
Co-authored-by: Jatin3128 <jatinsarna8@gmail.com>