Commit Graph

60786 Commits

Author SHA1 Message Date
Mihir Kandoi
6c5aca0b37 Merge pull request #57983 from Jatin3128/fix/disabled-party-validation-opportunity-rfq
fix: block disabled/frozen party on Opportunity and Request for Quotation
2026-08-11 16:31:52 +05:30
Mihir Kandoi
f3a8f02c5f Merge pull request #58031 from mihir-kandoi/gate-naming-property-setters
perf: rewrite customer and supplier naming setters only on change
2026-08-11 16:27:39 +05:30
Mihir Kandoi
27f0ffdde5 Merge pull request #58018 from mihir-kandoi/codex/reduce-test-setup-overhead
perf(tests): reduce repeated setup work
2026-08-11 16:27:15 +05:30
Diptanil Saha
2f1548c0f8 chore: disable mergifyio queue comment (#58030) 2026-08-11 16:11:31 +05:30
Mihir Kandoi
909e7b1457 test: cover customer and supplier naming setter gating 2026-08-11 16:10:15 +05:30
Mihir Kandoi
94320a9928 perf: rewrite customer and supplier naming setters only on change
Every Selling Settings save reran set_by_naming_series for Customer and
every Buying Settings save reran it for Supplier, rewriting the
naming_series property setters with their cache clears and running the
naming_series backfill UPDATE on the master table.

Gate both on has_value_changed, following Stock Settings. Naming
behaviour is unaffected: Customer.autoname and Supplier.autoname read
the master-name default, which is still set on every save.
2026-08-11 16:09:08 +05:30
Mihir Kandoi
d6e2d7105f perf(tests): run sales partner summary reports on shared fixtures
Both sales partner summary suites created identical submitted, draft,
cancelled, and returned transactions per doctype. Run both reports
against one fixture set and receive stock only for Delivery Note and
POS Invoice, the doctypes that consume it.
2026-08-11 16:03:51 +05:30
Mihir Kandoi
7aa6a07e74 test(stock): cover item metadata rewrite gating 2026-08-11 16:03:50 +05:30
Mihir Kandoi
a8e2351169 perf(stock): skip item metadata rewrite when settings unchanged
Every Stock Settings save rewrote the Item naming property setters and
the barcode visibility property setters. make_property_setter without a
doctype fans out to every doctype that has the fieldname and clears each
doctype's cache, and set_by_naming_series also backfills tabItem.

Gate both on has_value_changed. Item naming behaviour is unaffected: it
reads the item_naming_by default, which is still set on every save.
2026-08-11 16:03:49 +05:30
Jatin3128
58491723e7 feat(accounts): add Bank Charges account for Payment Entry deductions (#57840)
* feat(accounts): add Bank Charges account for Payment Entry deductions

Add an optional Bank Charges Account field on Company. When a Payment
Entry has a difference between the paid and received amount (e.g. a
same-currency Internal Transfer where the bank deducted a fee), that
amount now books to the Bank Charges account in the deductions table
instead of always going to the Exchange Gain/Loss account. Left blank,
behavior is unchanged.

Mirrors the resolution on both the server (set_exchange_gain_loss) and
client (set_exchange_gain_loss_deduction) so the deduction row is
pre-filled consistently before and after save. A user's manual account
edit on an existing deduction row is preserved across recalculation,
same as before this change.

* fix(accounts): only route Payment Entry difference to Bank Charges for same-currency transfers

Cross-currency Payment Entries were also matching the unconditional
bank_charges_account precedence, misrouting a genuine exchange
gain/loss into the Bank Charges account. Only prefer Bank Charges
Account when paid_from and paid_to share a currency; cross-currency
differences continue to book to Exchange Gain/Loss Account.

* test(payment_entry): assert against actual exchange gain/loss account, not a hardcoded name

CI failed: _Test Company's exchange_gain_loss_account is auto-provisioned
as "Exchange Gain/Loss - _TC" by the standard chart of accounts, not the
"_Test Exchange Gain/Loss - _TC" account used only by a sibling test.

* fix(accounts): auto-set Bank Charges Account from chart of accounts default

The standard chart of accounts already ships a "Bank Charges" ledger
account, but set_default_accounts() never picked it up into the
Company's bank_charges_account field, unlike its write_off_account and
exchange_gain_loss_account siblings. New and existing companies now
get it auto-populated the same way.

---------

Co-authored-by: test <test@test.com>
2026-08-11 15:47:51 +05:30
Smit Vora
4c5d54096f Merge pull request #57965 from ljain112/set-missing-values
fix: run set_missing_values before creating Purchase Order from MRP report
2026-08-11 15:46:28 +05:30
Sudharsanan Ashok
b5a3815a64 fix(selling): read overdue amount from payment ledger, not gl tags (#57786) 2026-08-11 15:37:17 +05:30
Jatin3128
6b35c51ff1 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).
2026-08-11 15:35:28 +05:30
Mihir Kandoi
e258921681 Merge pull request #58020 from mihir-kandoi/codex/fix-driver-supplier-address
fix(setup): fetch driver address by supplier link
2026-08-11 15:17:24 +05:30
Mihir Kandoi
3ffb888d26 fix(setup): fetch driver address by supplier link 2026-08-11 15:09:48 +05:30
Mihir Kandoi
575f34e7c6 Merge pull request #58016 from mihir-kandoi/fix-job-card-operation-row-id
fix: preserve original operation idx in manually created Job Cards
2026-08-11 14:19:25 +05:30
Mihir Kandoi
cb7201cc18 fix: preserve original operation idx in manually created Job Cards
The Create Job Card dialog on Work Order lists only pending operations,
so the row idx sent to make_job_card is the dialog's position, not the
Work Order Operation idx. create_job_card stamped that dialog idx into
operation_row_id, and get_required_items then matched raw materials of
whichever operation held that idx originally.

Resolve idx server-side from the Work Order Operation row that
get_operation_details already looks up by name.

Fixes https://github.com/frappe/erpnext/issues/57985
2026-08-11 14:05:21 +05:30
Mihir Kandoi
3c000929e2 Merge pull request #58005 from mihir-kandoi/restore-manufactured-qty-check
fix: reinstate mandatory manufactured qty check for manufacture entries
2026-08-11 14:00:05 +05:30
Mihir Kandoi
1543ee9350 test: manufacture entry blocked without manufactured qty 2026-08-11 13:47:26 +05:30
Mihir Kandoi
b6ca708d9f fix: reinstate mandatory manufactured qty check for manufacture entries 2026-08-11 13:46:40 +05:30
Mihir Kandoi
3379907564 Merge pull request #58004 from mihir-kandoi/restore-duplicate-entry-check
fix: reinstate duplicate entry check for manufacture entries
2026-08-11 13:45:07 +05:30
Mihir Kandoi
148d6aad5f Merge pull request #58009 from mihir-kandoi/require-transfer-before-job-card-start
fix: require material transfer before job card start and completion
2026-08-11 13:31:05 +05:30
Mihir Kandoi
e5344cc07e test: overproduction allowance permits a further manufacture entry 2026-08-11 13:27:02 +05:30
Mihir Kandoi
492ee05727 fix: honor overproduction allowance in duplicate entry check
Compare already-entered finished good qty against the work order qty plus
the configured overproduction percentage, mirroring the submit-time guard
in work_order/services/status.py, so a save is never rejected that the
submission contract would accept.
2026-08-11 13:27:02 +05:30
Mihir Kandoi
1665873fc9 test: duplicate manufacture entry against a work order
A second Manufacture stock entry saved while existing entries already
cover the full work order qty must raise DuplicateEntryForWorkOrderError.
2026-08-11 13:27:02 +05:30
Mihir Kandoi
22fa520500 fix: reinstate duplicate entry check for manufacture entries
The stock_entry.py split (#54466) dropped check_duplicate_entry_for_work_order
and DuplicateEntryForWorkOrderError with no replacement. The Work Order still
throws StockOverProductionError when submitted entries exceed the planned qty,
but nothing blocks saving another Manufacture entry, draft or submitted, once
existing entries already cover the full work order qty.

Restore the validation in the manufacture purpose handler, gated to work
orders without track_semi_finished_goods, matching the pre-split behaviour.
2026-08-11 13:27:02 +05:30
Mihir Kandoi
fee2672bf9 Merge pull request #58000 from mihir-kandoi/restore-operations-completed-check
fix: reinstate operations completed check for manufacture entries
2026-08-11 13:25:04 +05:30
Mihir Kandoi
704adeb96e Merge pull request #58003 from mihir-kandoi/codex/fix-sales-invoice-return-redelivery
fix(selling): bill re-delivered sales order quantities
2026-08-11 13:20:01 +05:30
Mihir Kandoi
e9533495fc fix: keep job card actions visible for corrective job cards
Corrective job cards regenerate required items but are exempt from the
transfer gate on the server; mirror that exemption in materials_ready.
2026-08-11 13:18:55 +05:30
Mihir Kandoi
c95705dc64 test: job card start and completion blocked until material transfer 2026-08-11 13:14:38 +05:30
Mihir Kandoi
808b2e2984 fix: require material transfer before job card start and completion
When the work order transfers material against Job Card, the Start Job
and Complete Job actions (and the whitelisted start_timer and
complete_job_card methods behind them) accepted work before any
Material Transfer for Manufacture existed; the transfer gate only fired
on job card submission.

Run validate_transfer_qty on both actions, and drop the finished_good
escape in materials_ready so the dashboard hides the buttons while
transfer is pending. Job cards that skip material transfer, corrective
job cards, and work orders transferring against Work Order are exempt,
as on submit.
2026-08-11 13:08:33 +05:30
Mihir Kandoi
af234a2d16 Merge pull request #58006 from mihir-kandoi/subcontracting-fg-items-list
fix: pass finished goods as list to subcontracting BOM lookup
2026-08-11 12:57:55 +05:30
Mihir Kandoi
3704d1513b Merge pull request #57963 from frappe/codex/fix-bom-explorer-quantities
fix(manufacturing): correct nested BOM Explorer quantities
2026-08-11 12:56:08 +05:30
Mihir Kandoi
40fc6c8b8a fix: pass finished goods as list to subcontracting BOM lookup
set_service_items_for_finished_goods built a set and passed it to
get_subcontracting_boms_for_finished_goods, whose filter builder only
handles str and list. Whitelist type validation lax-coerces the set to a
list during HTTP requests and tests, hiding the mismatch, but from
console, bench execute or background contexts the set reaches
frappe.get_all verbatim and is inlined into invalid SQL on both MariaDB
and PostgreSQL.

Ref #57996
2026-08-11 12:41:47 +05:30
Mihir Kandoi
9f108e4b75 fix(selling): clamp pending qty to qty field precision 2026-08-11 12:38:26 +05:30
Mihir Kandoi
dd23cf40e1 perf(selling): batch billed quantity lookup 2026-08-11 12:27:22 +05:30
Mihir Kandoi
26a05044c0 fix: link an active non-corrective job card in the operations error
Cancelled, amended, and corrective job cards do not contribute to the
operation's completed qty, so the error should not direct users there.
2026-08-11 12:16:46 +05:30
Mihir Kandoi
114ba42850 fix(selling): bill re-delivered sales order quantities 2026-08-11 12:16:00 +05:30
Mihir Kandoi
fe8bedef93 Merge pull request #57997 from kaulith/fix/bom-item-query-barcode-search
fix: keep item code searchable when a barcode matches the same text
2026-08-11 12:12:07 +05:30
Mihir Kandoi
2d022ffb66 test: manufacture entry blocked until operations are completed 2026-08-11 12:11:19 +05:30
Mihir Kandoi
401eb30963 fix: reinstate operations completed check for manufacture entries
The stock_entry.py split (#54466) dropped check_if_operations_completed
and OperationsNotCompleteError with no replacement, so a Manufacture or
Material Consumption for Manufacture entry could be submitted against a
work order whose operations (job cards) were never completed.

Restore the validation in the manufacture purpose handler, gated to
work orders without track_semi_finished_goods, which has its own
per-operation enforcement.
2026-08-11 12:09:33 +05:30
Mihir Kandoi
70f236ae2e Merge pull request #57972 from aerele/fix/workstation-time-in-mins
refactor: drop redundant time_in_mins assignment in workstation complete_job
2026-08-11 12:08:43 +05:30
Kaushal Shriwas
23024d1ea9 test(manufacturing): cover BOM item search when item code collides with a barcode 2026-08-11 11:58:36 +05:30
Kaushal Shriwas
bf5d506637 fix(manufacturing): keep item code searchable when a barcode matches the same text 2026-08-11 11:58:33 +05:30
Mihir Kandoi
3cffeb68e3 refactor: drop redundant time_in_mins assignment in complete_job 2026-08-11 11:56:13 +05:30
Nabin Hait
e4f9c664a8 refactor: stock write-path cleanups (SLE/Bin chokepoint groundwork) (#57980)
* fix: skip zero-qty rows in make_sl_entries instead of reusing the previous entry

A row with zero actual_qty that is not a Stock Reconciliation never gets an
SLE, but the loop body still ran with the previous iteration's sle_doc:
repost_current_voucher and the bin update executed twice for the previous
row, or the whole call crashed with UnboundLocalError when the zero-qty row
came first. Skip such rows entirely.

* refactor: remove dead update_entries_after.update_bin_data

No callers anywhere in the codebase; it duplicates update_bin() with subtly
different semantics (no update_modified) and would only invite accidental
resurrection as a second Bin write path.

* refactor: rename bin.update_qty to update_qty_from_sle

Two unrelated functions circulated under the name update_bin_qty:
bin.update_qty (recomputes quantities from the ledger, aliased on import in
stock_ledger.py) and stock_balance.update_bin_qty (writes caller-supplied
absolute values, imported by six modules). Give the SLE-driven one a name
that states its semantics and drop the alias.
2026-08-11 11:35:24 +05:30
Jatin3128
8c0a945417 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.
2026-08-11 11:02:29 +05:30
Diptanil Saha
b55c6d16c9 refactor(queries): using frappe.get_query in get_filtered_child_rows (#57991) 2026-08-10 19:33:29 +00:00
Diptanil Saha
02118e7ba0 fix: preserve custom title on new JV (#57987)
Co-authored-by: rehanrehman389 <rehanrehman389@gmail.com>
2026-08-10 21:27:44 +05:30
Jatin3128
4bf65ffc1d 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.
2026-08-10 18:02:34 +05:30