* 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>
* fix: block disabled/frozen customers on Opportunity
Opportunity inherits TransactionBase instead of AccountsController, so
it never ran validate_party_frozen_disabled like Quotation, Sales Order
and Sales Invoice do. A disabled Customer could be saved as an
Opportunity's party and only get caught later at Quotation stage.
Also fixes the party_name Link query on the client: it referenced
erpnext.queries.customer, which was never defined, so disabled
customers showed up in the picker.
(cherry picked from commit 90937ce6d9)
# Conflicts:
# erpnext/crm/doctype/opportunity/test_opportunity.py
* fix: block disabled/frozen suppliers on Request for Quotation
Request for Quotation overrides validate() entirely and never calls
super().validate(), so it never goes through AccountsController's
party validation. Suppliers also sit in a child table, so the shared
PartyValidator wouldn't have caught it anyway (it only checks a single
top-level party field). A disabled or frozen Supplier could be added
to an RFQ and the RFQ submitted without any warning.
Also filters the suppliers grid's supplier Link field to disabled=0,
matching the same client-side fix applied to Opportunity's party_name.
(cherry picked from commit 4bf65ffc1d)
# Conflicts:
# erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
# erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py
* fix: scope Opportunity party validation to Customer only
validate_party_frozen_disabled only enforces Customer/Supplier/Employee,
so passing opportunity_from straight through silently no-op'd for Lead
and Prospect. Made the Customer-only scope explicit instead of relying
on that implicit fallthrough.
Lead.disabled is not enforced anywhere else in the codebase (lead_query,
the picker used for this same field, only filters status/docstatus), so
deliberately not extending validation to Lead-sourced Opportunities.
(cherry picked from commit 8c0a945417)
* refactor: move RFQ supplier disabled filter to link_filters
Static filters with no doc-dependent values belong on the field
definition, not in JS. Matches the existing pattern used for
Warehouse/Item link_filters elsewhere (e.g. job_card_item.json,
product_bundle_item.json).
(cherry picked from commit 6b35c51ff1)
* fix: resolve backport conflicts for disabled/frozen party validation
The automated backport left unresolved merge conflict markers committed
in request_for_quotation.py, test_request_for_quotation.py and
test_opportunity.py. Also fixes validate_party_frozen_disabled being
called with 3 args here, this branch's version only takes
(party_type, party_name), unlike develop's (company, party_type, party_name).
Dropped test_duplicate_supplier_rejected, test_rfq_blocked_for_supplier_with_prevent_rfqs
and test_rfq_status_lifecycle from the conflict resolution, they don't exist on
this branch and aren't part of this backport.
---------
Co-authored-by: Jatin3128 <jatinsarna8@gmail.com>
* feat: validate purchase receipt exchange rate parity on purchase invoice (#58177)
(cherry picked from commit 70a8a2d0c5)
# Conflicts:
# erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
* chore: fix conflicts
Removed assertion for exchange rate discrepancy in purchase invoice test.
* test: fix backport of exchange rate difference test for non stock item
The conflict resolution left behind stale amount/discrepancy lookups
referencing a removed second item row (IndexError in CI and F841 ruff
failures). Align the test with the develop version: single non stock
item, PR at 80 / PI at 70, and assert no exchange gain/loss GL entry.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>