Commit Graph

60820 Commits

Author SHA1 Message Date
Vishnu Priya Baskaran
39403a5ef3 refactor:fix item property updates in POS and transactions, and add styling (#57189)
Co-authored-by: Afsal Syed <afsalsyed12@gmail.com>
2026-08-11 22:50:28 +05:30
Vishnu Priya Baskaran
8802000ba2 fix(consolidated cash flow): correct totals and labels in section foo… (#57336) 2026-08-11 21:58:53 +05:30
Raffael Meyer
e591c7e8b6 fix: mirror rounding adjustment on distributed_discount_amount (#58047) 2026-08-11 18:26:26 +02:00
Mihir Kandoi
a7e5e1209b Merge pull request #58051 from mihir-kandoi/codex/fix-sales-order-item-reset
fix(selling): reset stale item details on item change
2026-08-11 21:05:04 +05:30
Mihir Kandoi
e8c890a844 fix(selling): preserve explicit UOM during item selection 2026-08-11 20:54:04 +05:30
Mihir Kandoi
e6966627b8 Merge pull request #58050 from mihir-kandoi/codex/fix-bom-creator-item-selection
fix(manufacturing): preserve BOM Creator item details
2026-08-11 20:53:31 +05:30
Mihir Kandoi
009961edc7 fix(selling): reset stale item details on item change 2026-08-11 20:41:47 +05:30
Mihir Kandoi
439eb250f5 fix(manufacturing): preserve BOM Creator item details 2026-08-11 20:40:30 +05:30
Mihir Kandoi
7e4e9860ef Merge pull request #58045 from mihir-kandoi/codex/repair-underbilled-pr-status
fix(stock): repair existing underbilled purchase receipts
2026-08-11 19:52:08 +05:30
Mihir Kandoi
620465220b test: cover repair of underbilled receipts from mixed billing 2026-08-11 19:21:38 +05:30
Mihir Kandoi
e99ae3796c fix(stock): repair existing underbilled purchase receipts
The qty-sync fix corrects allocation going forward, but receipts billed
before it can keep understated billed_amt, per_billed, and status. The
earlier repair patch only selects over-billed PO items, so it never picks
these up.

Recompute every candidate PO item (multiple submitted receipts, PO-level
invoicing, no invoice-created receipts). update_billed_amount_based_on_po
only writes rows whose recomputed value differs, so already-correct items
are untouched and the patch stays idempotent. This also converges receipts
left with direct-only billed_amt by last-event-wins overwrites.
2026-08-11 19:21:38 +05:30
Mihir Kandoi
4108be4637 Merge pull request #58036 from mihir-kandoi/codex/fix-disabled-warehouse-account-resolution
fix(stock): validate warehouse accounts when used
2026-08-11 18:54:39 +05:30
Mihir Kandoi
ce847b6c29 Merge pull request #58044 from mihir-kandoi/fix-po-billing-qty-sync-develop
fix: keep PO billed qty in sync when allocating amount to receipts
2026-08-11 18:53:46 +05:30
Mihir Kandoi
031e7c0eb7 test: cover mixed direct and PO-invoice billing across receipts 2026-08-11 18:40:35 +05:30
Mihir Kandoi
7803998fce fix: keep PO billed qty in sync when allocating amount to receipts
The amount-capped allocation branch reduced the remaining PO-invoiced
amount but left the invoiced qty untouched. A later receipt entering the
qty-proportional branch then divided by the stale qty and was under-billed:
PO 10 x 500, PO-level PI for 5 (2500), PR1 qty 3 with 500 billed directly
consumes 1000 (pool 2500 -> 1500, qty stuck at 5), PR2 qty 3 got
1500 * 3/5 = 900 instead of its full 1500. Scale the remaining qty by the
consumed fraction so both stay proportional.

Follow-up to #58021.
2026-08-11 18:39:52 +05:30
Mihir Kandoi
abb23fffdc Merge pull request #58021 from harisansari008/fix-po-invoice-billing-distribution-develop
fix: distribute PO-invoice billed amount across receipts without duplication
2026-08-11 18:36:09 +05:30
Mihir Kandoi
b54a4f6285 test(stock): cover named validation error and same-transaction parent inheritance 2026-08-11 18:26:10 +05:30
Mihir Kandoi
624e97f6c1 chore(stock): drop redundant supplier warehouse comment 2026-08-11 18:26:09 +05:30
Mihir Kandoi
d2b5c6ad40 fix(stock): validate new warehouse inventory account after naming
Move the insert-time check from before_insert to validate. before_insert
runs before set_new_name, so the validation message rendered the
warehouse name as None. validate runs after naming and only applies to
new documents via is_new().

Resolve inheritance through the parent's lft/rgt bounds instead of the
request-cached warehouse account map. The cached map can be stale within
a request (a parent created moments earlier is missing from it), which
made get_warehouse_account trigger a full nested-set rebuild_tree and
could falsely reject a child whose parent carries a valid account.
rebuild_tree enables auto_commit_on_many_writes, which must not run
inside a document insert.
2026-08-11 18:26:08 +05:30
Mihir Kandoi
0171b07023 Merge pull request #58032 from aerele/perf/batch-bin-lookups
perf: batch per-row bin lookups in sales invoice and delivery note
2026-08-11 18:20:50 +05:30
Mihir Kandoi
13883a00b0 fix(stock): validate warehouse accounts when used 2026-08-11 18:16:47 +05:30
Mihir Kandoi
d34519f536 test: cover repair patch exclusion for invoice-created receipts 2026-08-11 18:16:38 +05:30
Mihir Kandoi
ace4230f97 fix: skip PO items with invoice-created receipts in billing repair patch
A Purchase Receipt row created from a Purchase Invoice carries both
purchase_order_item and purchase_invoice_item, and its billed_amt is pinned
to the row amount by update_billing_status. Redistributing the PO-invoiced
pool over such rows zeroes the invoice-created receipt and flips it from
Completed to To Bill, so the repair leaves those PO Items untouched.
2026-08-11 18:16:38 +05:30
Mihir Kandoi
d8d0ea01c4 Merge pull request #58041 from mihir-kandoi/fix-auto-reserve-packed-items
fix: set auto reserve stock flag before packing list generation
2026-08-11 18:07:39 +05:30
Mihir Kandoi
b879c491b0 fix: set auto reserve stock flag before packing list generation
enable_auto_reserve_stock ran at the end of validate, after
make_packing_list. On a new Sales Order saved with auto_reserve_stock
enabled, packed item rows were built while the parent reserve_stock
flag was still unset, so they never inherited it. Since the stamping in
packed_item.py is gated on doc.is_new(), later saves could not repair
the rows either; only the client-side toggle could. Move the
auto-enable before packing list generation so packed rows are stamped
on first save.
2026-08-11 17:53:47 +05:30
pandiyan
6bf00d3c8b perf: batch per-row bin lookups in sales invoice and delivery note
sales invoice's update_current_stock ran one bin query per item row and one
per packed row. delivery note already batched the same work by warehouse, so
lift that into get_bin_qty_map in stock/utils.py and have both call it.

also batch the per-batch expiry_date lookup in get_batches_by_oldest, and drop
three now-unused per-row setters: delivery note's set_actual_qty (already dead
before this change), sales invoice item's set_actual_qty and packed item's
set_actual_and_projected_qty.
2026-08-11 17:52:27 +05:30
Mihir Kandoi
27da94610c Merge pull request #58037 from aerele/feat/multi-select-item-warehouse-filters
feat(stock): multi select item and warehouse filters in warehouse wise item balance
2026-08-11 17:04:41 +05:30
Mihir Kandoi
db78dd1ef3 Merge pull request #58033 from mihir-kandoi/gate-selling-toggle-setters
perf: rewrite selling settings toggle setters only on change
2026-08-11 16:42:36 +05:30
Sudharsanan11
eb4bb2cbce test(stock): cover multi select item and warehouse filters in warehouse wise item balance
three cases: multiple warehouses get a column each plus the total qty
column, a selected group warehouse still expands to its children, and
multiple items report side by side while unselected items stay out.
2026-08-11 16:34:12 +05:30
Sudharsanan11
3c92a9e853 feat(stock): multi select item and warehouse filters in warehouse wise item balance
the item and warehouse filters took one value at a time, so comparing a
few warehouses meant re-running the report for each one.

both are multiselectlist now, matching the stock balance report. the
warehouse column list unions the subtree of every selected warehouse,
and get_items passes a list through instead of wrapping it. plain string
values still work, so saved filters and existing callers are unaffected.
2026-08-11 16:34:12 +05:30
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
Mihir Kandoi
c9f74e21a0 test: cover selling settings toggle setter gating 2026-08-11 16:22:21 +05:30
Mihir Kandoi
136e00d513 perf: rewrite selling settings toggle setters only on change
on_update reran toggle_hide_tax_id, toggle_editable_rate_for_bundle_items
and toggle_discount_accounting_fields on every save, rewriting 11
property setters and clearing the meta cache of five doctypes.

Gate each toggle on has_value_changed. Fresh installs save the settings
with pure defaults (set_single_defaults), so the gated-off state must
match the JSON schema: align sales_invoice.json and
sales_invoice_item.json with the values every saved site already has —
tax_id printed when hide_tax_id is off, discount accounts hidden while
discount accounting is disabled. Packed Item rate already matches.
2026-08-11 16:21:21 +05:30
Mihir Kandoi
8b7e04eae1 fix(stock): repair duplicated purchase receipt billing 2026-08-11 16:16:53 +05:30
harisansari008
5e33a3c0bf fix: distribute PO-invoice billed amount across receipts without duplication
When a Purchase Invoice is raised directly from a Purchase Order (po_detail
set, pr_detail null), update_billed_amount_based_on_po distributes the billed
amount across the PO's Purchase Receipts in FIFO order.

The proportional branch, taken when the invoiced qty exceeds a single
receipt's qty, computed each receipt's share but never deducted the consumed
amount/qty from the running po_billed_amt_details total. As a result every
subsequent receipt was billed against the same amount again, so the receipts
together showed more billed amount than was actually invoiced. A receipt with
no invoice truly against it could reach 100% billed and become Completed,
dropping out of pending-invoice reports.

Deduct the consumed billed_amt and billed_qty in the proportional branch,
mirroring the existing else branch, so each receipt only consumes what is
left. Add a regression test covering a PO invoice spanning two receipts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-11 16:16:33 +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