Commit Graph

55465 Commits

Author SHA1 Message Date
pandiyan
5cedc50c55 fix: use change_settings decorator matching version-15-hotfix test utils
ERPNextTestSuite doesn't exist on this branch; the cherry-picked test
used the develop-branch decorator style, breaking ruff (F821) in CI.
2026-07-04 12:53:57 +05:30
Pandiyan P
da623eb124 fix: resolve conflicts 2026-07-04 12:45:09 +05:30
pandiyan
1a52c58666 test: cover cost center fallback to item group default in manufacture entry
the existing test_cost_center_for_manufacture only checks a raw material
row against an item-level override, which is set independently of the
":company" default guard and never exercised the bug.

(cherry picked from commit a168bb7ea4)
2026-07-03 15:42:58 +00:00
pandiyan
b170913880 fix: remove company default on cost center in stock entry detail
the ":company" default pre-filled every row before set_default_cost_center()
ran, so its "if not row.cost_center" guard was always false and the
project/item group/brand priority chain in get_default_cost_center()
never ran.

(cherry picked from commit edfa0a7a1d)

# Conflicts:
#	erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
2026-07-03 15:42:58 +00:00
Khushi Rawat
3e6a5b3a0b Merge pull request #56797 from Jatin3128/fix/asset-expense-account-purchase-receipt
fix: fetch asset category expense account on purchase receipt
2026-07-03 17:31:26 +05:30
mergify[bot]
1cf94f5501 fix: replay immutable SLE qty for serial/batch bundle valuation (backport #56814) (#56834)
fix: replay immutable SLE qty for serial/batch bundle valuation (#56814)

(cherry picked from commit ecc8ec672b)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
2026-07-03 12:37:11 +05:30
mergify[bot]
b0446b6a09 fix: don't attempt to create SABB for non-serialized / non-batch items (backport #56627) (#56802)
* fix: don't attempt to create SABB for non-serialized / non-batch items (#56627)

* fix: don't attempt to create SABB for non-serialized / non-batch items

* fix(stock): skip serial batch lookup for rows without item code

(cherry picked from commit 5b738b7b0d)

# Conflicts:
#	erpnext/stock/services/serial_batch_bundle_service.py

* chore: resolve conflicts

---------

Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
2026-07-03 10:35:17 +05:30
mergify[bot]
5666fd1334 fix(company): ignore user permissions for link fields having link to Account and Cost Center (backport #56748) (#56794)
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
2026-07-02 13:02:09 +00:00
jatin3128
b7e0331d56 fix: fetch asset category expense account on purchase receipt
Backport of #41024. Fixed-asset items now resolve expense_account from
the asset category (CWIP account when CWIP accounting is enabled,
otherwise the fixed asset account) for Purchase Receipt, Purchase Order
and Material Request, matching v16 behavior. v15 previously did this only
for Purchase Invoice.
2026-07-02 16:38:02 +05:30
ruthra kumar
16b90ab20f Merge pull request #56776 from frappe/mergify/bp/version-15-hotfix/pr-54783
fix: disallow editing on reversal journals (backport #54783)
2026-07-02 14:57:21 +05:30
mergify[bot]
44a7013ab4 fix: block serialized to non-serialized item change when SABB exists (backport #56773) (#56774)
* fix: block serialized to non-serialized item change when SABB exists (#56773)

(cherry picked from commit 0e8ae7548d)

# Conflicts:
#	erpnext/stock/doctype/item/item.py
#	erpnext/stock/doctype/item/test_item.py

* chore: fix conflicts

* chore: fix conflicts

Remove test for variant UOM mismatch and related logic.

---------

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
2026-07-02 09:26:04 +00:00
ruthra kumar
ac2e69fbfd fix: disallow editing on reversal journals
(cherry picked from commit 26ca7445eb)
2026-07-02 09:07:45 +00:00
Nabin Hait
080b8d5183 Merge pull request #56768 from frappe/backport/clear-clearance-date-amend-v15
fix(accounts): clear clearance date when amending reconciled voucher (backport #55947)
2026-07-02 13:31:07 +05:30
Mihir Kandoi
7f2fb78d94 Merge pull request #56763 from frappe/mergify/bp/version-15-hotfix/pr-56757
fix: don't treat batch slot at FIFO queue head as qty slot (backport #56757)
2026-07-02 13:19:20 +05:30
Nabin Hait
5f14f2ccd6 fix(accounts): clear clearance date when amending reconciled voucher (backport #55947)
When a reconciled voucher (Payment Entry / Journal Entry / Purchase
Invoice / Sales Invoice) is cancelled, amended and resubmitted, the
stale clearance date was carried into the amended draft because the
framework ignores `no_copy` while amending.

Add a shared `before_insert` hook on AccountsController that clears
`clearance_date` (top-level field and Sales Invoice `payments` rows)
on amendment. Reconciliation still sets the value post-submit via
`frappe.db.set_value`, which bypasses this path.

Manual backport of #55947 to version-15-hotfix (Mergify's auto-backport
#55972 committed conflict markers; this replaces it).
2026-07-02 12:54:27 +05:30
Mihir Kandoi
4a6587b48e test: assert full negative batch slot in ageing regression test
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 8928b42d5d)
2026-07-02 07:14:14 +00:00
Mihir Kandoi
a9330e8900 fix: don't treat batch slot at FIFO queue head as qty slot
An incoming SLE without resolvable serial/batch details hit the
negative-head branch in _compute_incoming_stock even when the head was
a batch slot, because flt() on the batch number string returns 0.0.
_add_to_negative_fifo_head then crashed with
"TypeError: can only concatenate str (not 'float') to str".

Guard the branch with is_qty_slot, mirroring the existing check in
_add_transfer_slot_to_fifo_queue.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit c47a95a4d2)
2026-07-02 07:14:14 +00:00
mergify[bot]
71a2d6e43d fix: validate reverse GL entries on current date under immutable ledger (backport #56709) (#56751)
* fix: validate reverse GL entries on current date under immutable ledger (#56709)

* fix: validate reverse GL entries on current date under immutable ledger

When Immutable Ledger is enabled, the reverse GL entry is posted on the
current date, but the closed-period checks in make_reverse_gl_entries still
validate against the original (backdated) posting date. This blocks cancelling
a backdated voucher, such as a suspense Journal Entry for a migrated NPA loan,
with a books-closed error even though the reverse entry lands in an open period.

Validate both check_freezing_date and validate_against_pcv against the current
date when Immutable Ledger is enabled. When it is disabled, behaviour is
unchanged.

Follow-up to #55268.

* test: reset frozen till date after reverse entry test

The freeze date set on the company was not reset, so it leaked into the next
test which posts entries in that period. Reset it in a finally block.

* fix: prefer explicit posting_date under immutable ledger

Prefer the posting_date argument before frappe.form_dict and getdate, at both
the validation and the GL entry site, so an explicit date passed by the caller
is honoured and validation still matches the posted date.

(cherry picked from commit cab1b129c0)

# Conflicts:
#	erpnext/accounts/general_ledger.py

* fix: resolved conflicts

Removed outdated check for freezing date in general ledger validation.

* fix: Update check_freezing_date function call parameters

* fix: accounts_frozen_till_date to acc_frozen_upto

* test: acc_frozen_upto setting in test_period_closing_voucher

---------

Co-authored-by: Nihantra C. Patel <141945075+Nihantra-Patel@users.noreply.github.com>
2026-07-02 12:27:20 +05:30
ruthra kumar
a0b527d019 refactor: update title for process statement of accounts (backport #56754) (#56755)
refactor: update title for process statement of accounts

(cherry picked from commit 04468c3c33)

Co-authored-by: ruthra kumar <ruthra@erpnext.com>
2026-07-02 12:17:01 +05:30
ruthra kumar
f139466851 refactor: update title for process statement of accounts
(cherry picked from commit 04468c3c33)
2026-07-02 06:42:36 +00:00
Mihir Kandoi
9d3f9cce36 Merge pull request #56692 from aerele/backport-55585
fix(stock): set stock received but not billed account for purchase (#…
2026-07-01 13:55:00 +05:30
Pandiyan P
38b7042481 fix(stock): set stock received but not billed account for purchase (#55149)
(cherry picked from commit c4d28a2612)
2026-07-01 13:21:31 +05:30
Mihir Kandoi
5ee3a183b3 Merge pull request #56682 from frappe/mergify/bp/version-15-hotfix/pr-56671
fix(selling): update sales order per billed on credit note submission (backport #56671)
2026-07-01 12:44:58 +05:30
Sudharsanan11
a6d790f321 test(selling): add test to validate the per billed after credit note submission
(cherry picked from commit 710e021638)
2026-07-01 09:59:36 +05:30
Sudharsanan11
63e85c6551 fix(selling): update sales order per billed on credit note submission
(cherry picked from commit 224cf19f33)
2026-07-01 03:59:59 +00:00
Diptanil Saha
3b1bc7e916 Merge pull request #56679 from frappe/mergify/bp/version-15-hotfix/pr-56678
fix(gross_profit): correct GP calculation for rate adjustment debit notes (backport #56678)
2026-07-01 08:49:35 +05:30
diptanilsaha
fa82da509b test(gross_profit): added test cases for rate adjustment entry
(cherry picked from commit 17ef5d6034)
2026-07-01 03:02:28 +00:00
diptanilsaha
17733a5641 fix: gross profit calculation with rate adjustment entries
(cherry picked from commit b9f330a158)
2026-07-01 03:02:27 +00:00
Mihir Kandoi
f5df9f7948 Merge pull request #56663 from frappe/mergify/bp/version-15-hotfix/pr-56662
fix: use correct variable to fetch valuation method (backport #56662)
2026-06-30 22:54:55 +05:30
mergify[bot]
345587754f fix: add permission checks in whitelisted functions (backport #53103) (#56668)
* fix: add permission checks in whitelisted functions (#53103)

(cherry picked from commit a6e78c2eea)

# Conflicts:
#	erpnext/stock/report/stock_qty_vs_batch_qty/stock_qty_vs_batch_qty.py

* chore: resolve conflict

---------

Co-authored-by: Priyal Rawal <135015851+Priyal208@users.noreply.github.com>
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
2026-06-30 16:43:26 +00:00
Diptanil Saha
b5735531c1 refactor: port bulk_transaction_log existence check to the query builder (#56667)
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 16:16:03 +00:00
Mihir Kandoi
04a6831645 chore: resolve conflicts 2026-06-30 20:35:44 +05:30
Mihir Kandoi
c2b7718455 fix: use correct variable to fetch valuation method
(cherry picked from commit 1492c9fbc3)

# Conflicts:
#	erpnext/controllers/sales_and_purchase_return.py
2026-06-30 15:04:27 +00:00
Mihir Kandoi
1d24e1ef62 Merge pull request #56653 from aerele/backport-56635
fix: set mr status to received when per_received is 100 even if per_o…
2026-06-30 20:16:16 +05:30
pandiyan
53bdccee5f fix: set mr status to received when per_received is 100 even if per_ordered < 100 2026-06-30 16:37:41 +05:30
mergify[bot]
3479d65bd4 fix(stock): value batch/serial return from ledger when original receipt has no bundle (backport #56631) (#56645)
fix(stock): value batch/serial return from ledger when original receipt has no bundle (#56631)

* fix(stock): value batch/serial return from ledger when original receipt has no bundle

* test(stock): add test to validate the valuation of serial/batch for return when original receipt has no bundle

(cherry picked from commit 6184c057db)

Co-authored-by: Sudharsanan Ashok <135326972+Sudharsanan11@users.noreply.github.com>
2026-06-30 15:33:00 +05:30
mergify[bot]
25764520c2 fix: update qty in future SLEs when cancelling documents (backport #56638) (#56644)
fix: update qty in future SLEs when cancelling documents (#56638)

(cherry picked from commit 01374db8da)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
2026-06-30 14:47:33 +05:30
Mihir Kandoi
1e241b8463 Merge pull request #56603 from frappe/mergify/bp/version-15-hotfix/pr-56231
fix(controllers): fix supplier-RFQ portal list query (wrong column + Postgres DISTINCT) (backport #56231)
2026-06-30 12:02:24 +05:30
Mihir Kandoi
9125ab6c77 fix(controllers): fix supplier-RFQ portal list query (wrong column + Postgres DISTINCT)
rfq_transaction_list had two defects introduced when it was converted to the query
builder:

1. `party.supplier == party[0]` compared supplier to a column literally named "0"
   (a stray index on the DocType, not the intended `parties[0]` value). This renders
   as `supplier = \`0\`` / `supplier = "0"` and errors on BOTH engines
   (MariaDB: Unknown column '0'; Postgres: column "0" does not exist), so the
   supplier portal RFQ list was completely broken.
2. SELECT DISTINCT ordered by `creation`, which is not in the select list. Postgres
   rejects this ("for SELECT DISTINCT, ORDER BY expressions must appear in select list").

Compare against `parties[0]` and add `creation` to the select list.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit a7d9078bf4)

# Conflicts:
#	erpnext/controllers/tests/test_website_list_for_contact.py
2026-06-29 23:14:45 +05:30
mergify[bot]
83e8d1eb2f fix: carry item-level project to Purchase Receipt GL entries (backport #56568) (#56618)
fix: carry item-level project to Purchase Receipt GL entries (#56568)

Purchase Receipt stock and asset GL lines used the item row's cost center
but always fell back to the document-level project, unlike Purchase Invoice
which uses the item-level project. add_gl_entry accepted a project argument
but never wrote it to the GL dict, so the inward, Stock Received But Not
Billed, landed cost, divisional loss, sub-contracting and exchange rate
lines dropped the row's project.

Write project into the GL dict and pass project=item.project on the entries
that were missing it, so project behaves like cost center and matches
Purchase Invoice.

Ticket: 72523
(cherry picked from commit 6f97c7199c)

Co-authored-by: Jatin3128 <140256508+Jatin3128@users.noreply.github.com>
2026-06-29 23:12:20 +05:30
Mihir Kandoi
5278cb44ae Merge pull request #56589 from aerele/fix-production-plan-reservation
fix: reserve projected stock for production plan based on BOM qty
2026-06-29 20:54:57 +05:30
mergify[bot]
52d04ad834 fix: Use correct doctype name for PCV perm-check (backport #56606) (#56610)
fix: Use correct doctype name for PCV perm-check (#56606)

closes https://github.com/frappe/erpnext/issues/56593

(cherry picked from commit 747374e767)

Co-authored-by: Ankush Menat <ankush@frappe.io>
2026-06-29 19:04:44 +05:30
rohitwaghchaure
f50e529f8a fix: update_qty_in_future_sle skips SLEs with same posting datetime (#56615) 2026-06-29 17:21:17 +05:30
rohitwaghchaure
ab98d19f26 fix: negative stock issue (#56616) 2026-06-29 17:20:12 +05:30
Mihir Kandoi
926e4cfba6 Merge pull request #56613 from frappe/backport/55774-stock-balance
fix: backport stock balance changes from #55774
2026-06-29 15:23:56 +05:30
Mihir Kandoi
8abc27863a fix: extract stock ageing data helper in stock balance (backport #55774)
The v15 backport (#55776) of #55774 dropped the stock_balance.py changes.
A separate backport left an inline version that sorts/filters the FIFO queue
by itemgetter(1) *before* normalizing, so for batchwise valuation slots
itemgetter(1) reads the count flag instead of the posting date. The queue is
then ordered wrong and earliest_age/latest_age come out swapped.

Extract get_stock_ageing_data, which normalizes before sorting/filtering so
itemgetter(1) is always the posting date, and add the regression test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 15:06:21 +05:30
Mihir Kandoi
43496ac3ca Merge pull request #56434 from aerele/backport-56375
fix: skip over-allowance qty validation for non-stock items (backport #56335)
2026-06-28 19:39:20 +05:30
mergify[bot]
562563553c fix: sync Stock Reconciliation difference amount with GL after reposting (backport #56574) (#56584)
* fix: sync Stock Reconciliation difference amount with GL after reposting (#56574)

* fix: sync Stock Reconciliation difference amount with GL after reposting

* fix: placement of recalculate differece amount function

(cherry picked from commit c7ef42ef98)

# Conflicts:
#	erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
#	erpnext/stock/stock_ledger.py

* chore: fix conflicts

Removed unused imports and fixed import structure.

* chore: fix conflicts

Refactor update_rate_on_stock_reconciliation method to use recalculation from ledger instead of manual updates for stock reconciliation items.

* chore: fix conflicts

---------

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
2026-06-28 12:16:40 +05:30
pandiyan
3f00a0ffa9 test: add tests for non stock item over billing against so/po 2026-06-28 00:23:04 +05:30
pandiyan
bba7fe9831 fix: skip qty over-allowance check for non-stock items only 2026-06-28 00:23:04 +05:30