Commit Graph

60454 Commits

Author SHA1 Message Date
Diptanil Saha
372dff2ffa refactor(accounts): repost accounting ledger (#56442)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-28 22:51:06 +00:00
Vishnu Priya Baskaran
5125d64b7f fix: clear deferred revenue/expense fields on uncheck (#57140) 2026-07-29 04:18:45 +05:30
Krishna Pramod Shirsath
e0c31f1745 fix: recover failed POS closings (#57203)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: diptanilsaha <diptanil@frappe.io>
2026-07-28 22:29:47 +05:30
Mihir Kandoi
6d748c5523 Merge pull request #57571 from mihir-kandoi/move-warehouse-defaults-to-company
refactor: move warehouse defaults from Stock Settings to Company
2026-07-28 20:28:55 +05:30
Mihir Kandoi
2095073688 fix: check company permission before reading sample retention stock
validate_sample_quantity and move_sample_to_retention_warehouse are
whitelisted and take company from the caller, which selects whose retention
warehouse gets read. The retained batch qty then reaches the return value and
the max-retained warning, so an authenticated user could probe another
company's stock with a known item and batch.

Gate the shared company -> warehouse resolution on read permission for the
Company, which respects User Permissions. validate_sample_quantity only grew
a company argument in this branch; move_sample_to_retention_warehouse already
took one, so this closes that path too.
2026-07-28 20:15:19 +05:30
Mihir Kandoi
ac477bb33c test: stop relying on companies having no default warehouse
Companies now get their Stores warehouse as Default Warehouse, so item
warehouse resolution succeeds where it previously came back empty.

test_internal_pr_reference cleared inter_company_reference and asserted a
ValidationError, but no validation covers that field - the mapper already
sets it. It was incidentally catching 'Row #1: Warehouse is mandatory for
stock Item' from the blank target warehouse, so the assertion never tested
what it claimed. Dropped it; the delivery_note_item assertion below still
covers the reference linkage.

test_inter_company_transaction_without_default_warehouse now establishes its
own premise by clearing the company's default warehouse instead of relying
on it being unset. Its failure previously skipped the teardown that restores
frappe.local.enable_perpetual_inventory, which db rollback cannot undo, which
in turn broke two later inter-company tests.
2026-07-28 20:06:47 +05:30
Mihir Kandoi
455251abe1 fix: throw when the transaction company has no sample retention warehouse
Item.retain_sample is validated against any company having one configured,
since Item is not company-scoped. The transaction company may still not be,
in which case get_batch_qty received warehouse=None and returned its batch
list, which was then compared numerically -> TypeError.

Resolve company -> retention warehouse through one helper that throws a
clear message instead, covering both the sample stock entry and the
whitelisted quantity validation.
2026-07-28 19:41:29 +05:30
Mihir Kandoi
26613d258e refactor: move warehouse defaults from Stock Settings to Company
Default Warehouse and Sample Retention Warehouse were global singles, so every
consumer had to re-check that the warehouse belonged to the transaction's
company before using it. Both now live on Company, under a new Warehouse
Defaults section that also collects the warehouse fields Company already had.

The company check moves to Company.validate_warehouses, which also rejects
group warehouses for all seven fields — a group or cross-company value there
already failed at SLE time, this just surfaces it at the source.

New companies get their Stores warehouse as Default Warehouse via
create_default_warehouses, replacing the setup-wizard and test-fixture code
that seeded the global.
2026-07-28 19:29:18 +05:30
Mihir Kandoi
c80a848216 Merge pull request #57567 from aerele/fix/stock-balance-for-none-row
fix: guard against None row in get_stock_balance_for
2026-07-28 19:26:26 +05:30
Shllokkk
3f0b894cdf Merge pull request #57566 from Shllokkk/item-def-accounting-desc
fix(item): correct description on deferred revenue/expense
2026-07-28 19:22:27 +05:30
Shllokkk
fa75aa08ab fix(item): correct description on deferred revenue/expense 2026-07-28 19:00:24 +05:30
R-Jayaraman
f9d25bc3d3 fix: guard against None row in get_stock_balance_for
row defaults to None but was dereferenced unconditionally when computing
the incoming rate for batch-tracked items, causing an AttributeError for
any caller (e.g. direct API calls) that omits row while still passing
batch_no. The other two row accesses in this function already guard
against None; this brings the incoming-rate check in line with them.
2026-07-28 18:57:06 +05:30
Smit Vora
986cea2331 feat: taxable-base resolver hook for custom charge types (#56175) 2026-07-28 17:21:55 +05:30
Mihir Kandoi
0cd95e1995 fix(manufacturing): fall back to UOM Conversion Factor in Production Plan (#57553)
Production Plan read the conversion factor straight off the item's own
UOM child table, so an item with a purchase UOM but no matching row threw
"UOM Conversion factor not found" while Stock Entry silently resolved it
from the item's variant template or the UOM Conversion Factor doctype.
Resolve it the same way, and keep returning None when nothing is
configured anywhere so the missing-setup error still fires.
2026-07-28 11:41:51 +00:00
Shllokkk
5fc20d6b8e fix: respect child warehouse account override in Stock and Account Value Comparison (#57552)
fix: respect child warehouse account override in stock vs account value comparison
2026-07-28 16:51:53 +05:30
Diptanil Saha
5835709402 fix: add permission check for get_item_details (#57515) 2026-07-28 10:38:40 +00:00
Mihir Kandoi
a051a12d9b Merge pull request #57540 from mihir-kandoi/fix-company-mfg-warehouse-filters
fix(setup): scope manufacturing warehouse filters to company
2026-07-28 14:16:44 +05:30
Mihir Kandoi
632113c309 fix(setup): scope manufacturing warehouse filters to company
Default WIP, Finished Goods and Scrap Warehouse fields on Company listed
warehouses of every company. Filter them by the current company and
exclude group warehouses, matching the other warehouse fields.
2026-07-28 14:10:50 +05:30
Mihir Kandoi
91e4a753b3 Merge pull request #57535 from frappe/fix/silently-swallowed-exceptions
fix: stop swallowing exceptions silently in six places
2026-07-28 13:06:46 +05:30
rohitwaghchaure
4a0a1db17e fix: skip stock expense GL entries for non-stock items (#57519)
* fix: skip stock expense gl entries for non stock items

* test: use a leaf expense account for the service item invoice
2026-07-28 13:00:32 +05:30
Mihir Kandoi
85a04772f6 fix: stop swallowing exceptions silently in six places
- Pricing Rule: log a broken condition instead of dropping the rule
- Payment Request: log gateway validation failures
- Supplier Quotation from RFQ portal: let errors surface instead of
  returning None to a dead submit button
- Bank Transaction Rule: drop the pointless try/except around the
  on_trash unlink; a failed write already aborts the delete
- Statement of Accounts: the CC handler was unreachable
  (frappe.get_value returns None, it does not raise); drop it and
  filter out users without an email
- Bank Statement Import: 'Bank Account' at column 0 is falsy, so the
  column was appended instead of filled
2026-07-28 12:49:08 +05:30
Mihir Kandoi
2f07dfc474 Merge pull request #57532 from mihir-kandoi/fix-update-cost-bom-creator-boms
fix(manufacturing): update cost of BOMs created via BOM Creator
2026-07-28 12:46:47 +05:30
Mihir Kandoi
d269c90838 fix(manufacturing): update cost of BOMs created via BOM Creator
`calculate_rm_cost` skipped rate refresh whenever `bom_creator` was set,
so neither the Update Cost button nor the BOM Update Tool could ever
refresh those BOMs. Every BOM in a multi-level tree carries the field, so
whole trees stayed frozen at their creation rates.

The guard replaced the removed `rm_cost_as_per == "Manual"` check in
0b63dbf, on the assumption that BOM Creator rows hold manual rates. They
do not: BOM Creator recomputes every row from `rm_cost_as_per` on save.
2026-07-28 12:33:12 +05:30
Mihir Kandoi
7d44bdbdc6 Merge pull request #57522 from mihir-kandoi/fix-subcontracting-receipt-title
fix(subcontracting): stop the Subcontracting Receipt title from going stale
2026-07-28 12:19:21 +05:30
Mihir Kandoi
8d7ac9f51d Merge pull request #57528 from mihir-kandoi/fix-bom-creator-dup-subassembly
fix(manufacturing): scope BOM Creator tree children to the parent row
2026-07-28 12:18:46 +05:30
Mihir Kandoi
15b7626eed Merge pull request #57521 from mihir-kandoi/fix-semi-fg-produced-qty
fix(manufacturing): sum semi-FG qty across split job cards
2026-07-28 12:14:09 +05:30
Mihir Kandoi
b37152752f fix(manufacturing): scope BOM Creator tree children to the parent row
The BOM Creator tree identified a node by the parent's item code
(fg_item) instead of the specific BOM Creator Item row, so every
occurrence of a repeated sub-assembly shared one child set: expanding
any one of them listed the raw materials of all of them, and deleting
one wiped the raw materials of its siblings.

Key the tree on fg_reference_id and make the node value the row name,
matching the framework convention that a tree node's value is its
docname. Item code now travels as its own field for the label and for
the fg_item argument sent back on add/convert.

Fixes #57311
2026-07-28 11:25:29 +05:30
Mihir Kandoi
bde118e7cf fix(manufacturing): exclude corrective job cards from semi-FG aggregate 2026-07-28 11:09:36 +05:30
Khushi Rawat
56a9ca334b Merge pull request #57451 from khushi8112/feature/request-for-quotation-print-formats
feat: add four Request for Quotation print formats built with the print format builder
2026-07-28 11:06:33 +05:30
Khushi Rawat
aacccfb958 Merge pull request #57450 from khushi8112/feature/quotation-print-formats
feat: add four Quotation print formats built with the print format builder
2026-07-28 11:06:20 +05:30
Khushi Rawat
bd5d6fb9d8 Merge pull request #57449 from khushi8112/feature/pos-invoice-print-formats
feat: add four POS Invoice print formats built with the print format builder
2026-07-28 11:06:06 +05:30
Khushi Rawat
22334def56 Merge pull request #57447 from khushi8112/feature/purchase-invoice-print-formats
feat: add four Purchase Invoice print formats built with the print format builder
2026-07-28 11:05:51 +05:30
Khushi Rawat
5631acc39b Merge pull request #57446 from khushi8112/feature/purchase-order-print-formats
feat: add four Purchase Order print formats built with the print format builder
2026-07-28 11:05:38 +05:30
Khushi Rawat
dd0f763613 Merge pull request #57445 from khushi8112/feature/delivery-note-print-formats
feat: add four Delivery Note print formats built with the print format builder
2026-07-28 11:05:25 +05:30
Khushi Rawat
b71a9b8273 Merge pull request #57437 from khushi8112/feature/sales-order-print-formats
feat: add four Sales Order print formats built with the print format builder
2026-07-28 11:05:12 +05:30
Khushi Rawat
7a76c5f268 Merge pull request #57430 from khushi8112/feature/sales-invoice-print-formats
feat: add four Sales Invoice print formats
2026-07-28 11:04:59 +05:30
Mihir Kandoi
5548f0726a fix(manufacturing): sum semi-FG qty across split job cards
update_semi_finished_good_details assigned the current job card's
manufactured_qty to Work Order.produced_qty instead of accumulating it,
so a second job card on the same operation overwrote the first. Nothing
corrected it afterwards because StatusService.update_work_order_qty
returns early for track_semi_finished_goods work orders, leaving the
work order stuck below its planned qty with no way to progress.

Aggregate manufactured_qty and completed_qty over the operation's
submitted job cards instead.
2026-07-28 11:04:17 +05:30
Mihir Kandoi
543301701e fix(subcontracting): stop storing "{supplier_name}" as the Subcontracting Receipt title
Subcontracting Receipt was left out of #57493. Its title_field is "title",
so the template does get rendered on insert, but never again — the title
goes stale as soon as the supplier changes.

Point title_field at supplier_name like Purchase Receipt, and give the
title field the same shape as its subcontracting siblings. Existing rows
already hold a rendered name, so no data patch is needed.

Also guard the whole class of bug: a "{...}" default on a title field is
only ever rendered when title_field is "title".
2026-07-28 11:00:57 +05:30
Shllokkk
14fd045555 Merge pull request #57471 from Shllokkk/routing-hour-rate-operating-cost
fix: update operating cost when propagating workstation hour rate to routing
2026-07-28 10:50:06 +05:30
Mihir Kandoi
43acbae5a1 Merge pull request #57493 from aerele/fix-subcontracting-title-template
fix: stop storing raw title template on subcontracting orders
2026-07-28 10:41:59 +05:30
Shllokkk
a5250d8e80 Merge branch 'develop' into routing-hour-rate-operating-cost 2026-07-28 01:33:50 +05:30
Sudharsanan Ashok
73224d3650 fix(stock): keep manufactured item rate at zero when inputs are free (#57334)
* fix(stock): keep manufactured item rate at zero when inputs are free

when a finished item is produced from raw materials consumed at zero
valuation, the incoming rate fell back to the item's own valuation
rate (or BOM cost), valuing free inputs as output and inflating the fg
value on every production run.

add has_consumption_basis() to detect when the consumed cost is known
even if it is zero (consumed rows present, or a consumption entry
exists for the work order). when it is, skip the get_valuation_rate and
BOM-cost fallbacks so a real cost of zero is preserved.

* test(stock): cover manufacture rate for zero-valued raw materials

- manufacture from a free input keeps fg basic_rate and sle
  incoming_rate/stock_value_difference at zero even when the fg already
  carries a valuation in the target warehouse
- material consumption on with no consumption entry does not fall back
  to bom/price-list rate for free inputs
- zero-valued consumption entry keeps the manufacture entry's fg rate
  at zero
2026-07-27 23:35:00 +05:30
Sudharsanan Ashok
d37e905322 fix(stock): value batched packed-item returns from the original bundle (#57327)
* fix(stock): value batched packed-item returns from the original bundle

when a return delivery note or sales invoice bundle is built via the
use_serial_batch_fields / sle-driven path, its voucher_detail_no keeps the
packed item instead of being remapped to the parent dn/si item. the return
valuation lookup then misses and the bundle values at zero, so the sle
stock_value_difference stays wrong even after a repost.

resolve the original dn/si item via the packed item's parent_detail_docname
when the direct lookup fails, so the return values from the original outward
bundle on both submit and repost.

* test(stock): cover batched packed-item return valuation on repost
2026-07-27 23:33:41 +05:30
Diptanil Saha
28c96999e2 fix(quotation): carry forward communications from opportunity (#57507) 2026-07-27 23:29:57 +05:30
Sudharsanan Ashok
425191e57e fix(stock): narrow legacy serial ledger lookup by item (#57499)
Filter legacy Stock Ledger Entry lookups by item code so the existing
item and warehouse index can reduce rows scanned during serial valuation.
2026-07-27 21:40:44 +05:30
ruthra kumar
05a15dff71 Merge pull request #57500 from frappe/mergify/bp/develop/pr-57484
fix(test): flaky test in exchange rate revaluation (backport #57484)
2026-07-27 17:21:41 +05:30
ruthra kumar
4e77c9d6e6 fix(test): flaky test in exchange rate revaluation
- remove redundant setup on system settings

(cherry picked from commit 484ff8e349)
2026-07-27 11:40:37 +00:00
Raffael Meyer
bdf586c670 fix: error message wording (#57495) 2026-07-27 11:15:18 +00:00
Mihir Kandoi
3f93887ec8 Merge pull request #57492 from frappe/production-plan-recalculate-bin
fix: recalculate whole bin in Production Plan reservation patch
2026-07-27 16:01:04 +05:30
Mihir Kandoi
88b02130e7 fix: recalculate whole bin for Production Plan raw material items
projected_qty is derived from every bin quantity, so refreshing only
reserved_qty_for_production_plan leaves it stale wherever another field
had drifted. Call Bin.recalculate_values() instead.

Renamed so the patch re-runs on sites that already applied
recompute_production_plan_reserved_qty.
2026-07-27 15:26:25 +05:30