Commit Graph

60047 Commits

Author SHA1 Message Date
Pandiyan P
8b3caeb578 fix(stock): pick list serial batch posting date (#56957)
* fix(stock): fall back to current date/time for serial and batch bundle posting datetime

Pick List has no posting_date/posting_time fields, so creating or updating a
Serial and Batch Bundle from a Pick List row crashed with
"TypeError: combine() argument 1 must be datetime.date, not None". Fall back
to today/now when the parent voucher doesn't carry its own posting date.

Fixes #56951

* fix(stock): accept a plain dict for add_serial_batch_ledgers' doc and child_row

The whitelisted add_serial_batch_ledgers only converted child_row into an
attribute-accessible frappe._dict when it arrived as a JSON string, and doc's
type hint only allowed Document | str. Frappe's JSON API delivers both as
plain dicts (see frappe.app.make_form_dict, which parses the request body
with orjson and only wraps the top-level dict, not nested values), so every
real request was rejected before the handler body ever ran: first with a
FrappeTypeError on doc, and once that's fixed, with an AttributeError on
child_row.serial_and_batch_bundle. parse_json already wraps a plain dict in
frappe._dict (and leaves a real Document instance untouched), so routing
child_row through it unconditionally fixes both.
2026-07-09 17:28:03 +05:30
Pandiyan P
e2178a5f19 feat(manufacturing): create material request for raw materials from work order (#56961)
* feat(manufacturing): create material request for raw materials from work order

allow raising a material transfer request directly from a work order,
mirroring the existing job card flow, so stores can fulfil it into wip
before the actual stock entry happens

* test(manufacturing): cover work order material request flow

verify the material request created from a work order carries the
right bom/purpose onto the resulting stock entry, and that the work
order status still moves to in process on a partial material-request
transfer
2026-07-09 17:27:21 +05:30
mergify[bot]
d418dd9e70 fix(patch): moved create_company_custom_fields from pre_model_sync to post_model_sync (backport #56962) (backport #56965) (#56970)
Co-authored-by: diptanilsaha <diptanil@frappe.io>
2026-07-09 10:36:50 +00:00
Diptanil Saha
1885f9fb35 Merge pull request #56674 from diptanilsaha/fix/frappe_crm_sync
fix(crm_settings): skip allowed users check when frappe crm is installed locally
2026-07-09 15:30:46 +05:30
MochaMind
49228b458d fix: sync translations from crowdin (#56943) 2026-07-09 15:30:26 +05:30
Khushi Rawat
e3fb1340e1 Merge pull request #56964 from khushi8112/fix/depr-schedule-precision-match
fix: match depreciation schedule rows at currency precision to avoid duplicate JEs
2026-07-09 14:43:13 +05:30
khushi8112
947ed5dfe1 fix: match depreciation schedule rows at currency precision to avoid duplicate JEs 2026-07-09 14:14:44 +05:30
diptanilsaha
0f987d7135 chore: patch to clear out allowed users on crm_settings if frappe crm is installed on the site 2026-07-09 12:37:47 +05:30
diptanilsaha
2de423e225 fix(frappe_crm_api): handle failure for after_app_install and after_app_uninstall 2026-07-09 12:37:47 +05:30
diptanilsaha
c86aa2d6fe feat(crm_settings): auto-update crm sync settings on frappe crm install and uninstall 2026-07-09 12:37:41 +05:30
diptanilsaha
41badb3d74 fix(crm_settings): skip allowed users check when frappe crm is installed locally 2026-07-09 12:01:49 +05:30
Abdeali Chharchhodawala
95e2ce6d85 feat: add grouping by dimension functionality in financial reports (#54650)
Co-authored-by: Copilot <copilot@github.com>
2026-07-08 19:04:09 +05:30
Raffael Meyer
c12e3fba5e feat(sla): filter service level agreement link by document type (#56954) 2026-07-08 13:47:57 +02:00
Smit Vora
e7f81de159 Merge pull request #54855 from Abdeali099/growth-view-with-cfs-54675
refactor(financial-report): fix row transformation for growth calculations
2026-07-08 16:13:44 +05:30
Abdeali Chharchhoda
aad287d09e fix: enhance growth view filtering by validating period keys 2026-07-08 16:03:28 +05:30
Abdeali Chharchhoda
4c7499600c fix: update formatting of growth view for FS report 2026-07-08 16:03:28 +05:30
Abdeali Chharchhoda
698876672d refactor: simple utility for growth value computation for custom FS report 2026-07-08 16:03:28 +05:30
Abdeali Chharchhoda
c179460c98 refactor(financial-report): fix row transformation for growth calculations 2026-07-08 16:03:28 +05:30
Diptanil Saha
95212e5738 fix(tnc): get_terms_and_conditions render_template with safe_exec (#56944) 2026-07-08 00:18:35 +00:00
Diptanil Saha
8a940af7e1 fix: added permission checks on various whitelisted functions (#56745)
* fix: added permission checks on various whitelisted functions

* fix: permission checks on `get_party_account` and using "select" `ptype`

* test(`BootStrapTestData`): assign `Accounts User` role to User `test@example.com`
2026-07-08 05:29:52 +05:30
Shllokkk
c94973a932 Merge pull request #56926 from Shllokkk/pricing-rule-template-variant-validation
fix: validate template and its variant in the same Pricing Rule
2026-07-07 19:59:10 +05:30
Dany Robert
be10c8ced9 fix: precision issue causing reconciliation error (#54043)
* fix: precision issue causing reconciliation error

* chore: code styling changes

* test: precision causing reconciliation failure

* fix: enhance payment reconciliation tests for floating-point precision

* fix(test): incorrect assertion on status

---------

Co-authored-by: ruthra kumar <ruthra@erpnext.com>
2026-07-07 19:44:35 +05:30
MochaMind
eb37d3b14b fix: sync translations from crowdin (#56919) 2026-07-07 12:59:22 +02:00
Shllokkk
a88048b378 fix: validate template and its variant in the same Pricing Rule 2026-07-07 13:55:22 +05:30
rohitwaghchaure
607f0e943f fix: workspace for stock and manufacturing (#56906) 2026-07-06 11:48:15 +00:00
MochaMind
be93530b5f fix: sync translations from crowdin (#56866) 2026-07-06 10:49:55 +02:00
MochaMind
0688cedba2 chore: update POT file (#56899) 2026-07-05 20:29:59 +02:00
Mihir Kandoi
8aeca5922c Merge pull request #56905 from mihir-kandoi/pg-lock-races-and-advisory-valuation
fix(stock): close postgres locking races; gate batch valuation with a txn advisory lock
2026-07-05 22:42:18 +05:30
Mihir Kandoi
2ec469257e perf(stock): gate batch valuation with a txn advisory lock on postgres
On postgres, outward batch valuation row-locked the item's ENTIRE SLE / Serial and Batch Entry history (a separate plain SELECT ... FOR UPDATE per site, since FOR UPDATE is invalid with GROUP BY there). That writes a lock marker (xmax + WAL) on every historical tuple per outward movement - write amplification that grows with history forever - and locks nothing at all when the history is empty (negative-stock edge: two concurrent outwards don't serialize).

Replace all four history-wide postgres lock statements with one frappe.db.transaction_advisory_lock(("batch-valuation", item_code, warehouse)) at the top of BatchNoValuation.calculate_avg_rate's outward branch - every valuation read (bundle + the three deprecated paths) is downstream of it. Released at commit/rollback, participates in deadlock detection, and serializes regardless of history size, so the empty-history edge is closed by construction. Batch qty updates iterate in sorted order so concurrent vouchers lock Batch rows in the same sequence.

MariaDB is unchanged: it keeps the original grouped FOR UPDATE row locks (and its gap locks). Requires frappe#40621.

Test: outward delivery of a batched item must leave the xact advisory lock visible in pg_locks for the submitting transaction.
2026-07-05 22:31:45 +05:30
Mihir Kandoi
db58858c68 fix(stock): close postgres lock-then-read races in pick list and stock reservation
Postgres has no gap locks, so the lock-then-read pattern (plain SELECT ... FOR UPDATE before a grouped read) only serializes on rows that already exist. Two sites had reachable races where the lock set is empty or disjoint:

- Pick list: two pick lists against the same SO item submitted concurrently lock only docstatus=1 rows, so with no previously-submitted picks their lock sets are disjoint and both pass validate_picked_qty (over-pick; picked_qty last-writer-wins). Gate on the referenced Sales Order Item / Packed Item rows, which always exist.
- Stock reservation: the first concurrent reservations for an (item, warehouse) find no SRE rows to lock, so both pass and reserved qty can exceed actual. Gate on the Bin row, which exists once there is stock.

MariaDB is unchanged (its gap locks already serialize both; the gates are postgres-only). Also: ORDER BY on the small-set postgres lock selects for deterministic lock order, and the repost pre-lock in get_future_stock_vouchers selects a constant instead of shipping every matching SLE name to the client.
2026-07-05 22:31:29 +05:30
Nabin Hait
8abcb7decc Merge pull request #56301 from frappe/chore/payment-entry-purchase-coverage
test: purchase-side Payment Entry allocation coverage
2026-07-05 19:39:38 +05:30
Mihir Kandoi
c68bf89924 Merge pull request #56903 from mihir-kandoi/pg-second-order-groupby-docs
docs: catalog second-order GROUP BY traps (wrap-is-the-bug classes)
2026-07-05 19:11:14 +05:30
Mihir Kandoi
0922d85bf0 docs: catalog second-order GROUP BY traps (wrap-is-the-bug classes)
A full audit of the loose-GROUP-BY fixes found four recurring mistakes in the fixes themselves: incoherent Max/Min pairs over coupled columns, NULL-skipping Max on discriminators, Sum(x)*Max(y) fabricated arithmetic, and wrong-bound picks. Add them to the compatibility catalog (new 3.1) and to the Greptile review instructions so future PRs get flagged.
2026-07-05 19:00:47 +05:30
rohitwaghchaure
7844905e21 fix: dark theme shop floor (#56887) 2026-07-05 16:33:08 +05:30
Mihir Kandoi
00e6b44701 Merge pull request #56897 from mihir-kandoi/pg-requested-items-required-date
fix(buying): show earliest schedule date as required date
2026-07-05 15:45:52 +05:30
Mihir Kandoi
e3a38e3733 Merge pull request #56896 from mihir-kandoi/pg-production-planning-arrival-qty
fix(manufacturing): scope Production Planning arrival qty to open POs
2026-07-05 15:43:04 +05:30
Mihir Kandoi
1d7bb19620 Merge pull request #56898 from mihir-kandoi/pg-trends-empty-row-guard
fix(controllers): guard empty group-by detail row in trends
2026-07-05 15:39:53 +05:30
Mihir Kandoi
8486578c05 Merge pull request #56894 from mihir-kandoi/pg-procurement-tracker-coherent-row
fix(buying): make Procurement Tracker rows coherent PO lines
2026-07-05 15:39:33 +05:30
Mihir Kandoi
df82c7ac1c Merge pull request #56893 from mihir-kandoi/pg-bom-groupby-phantom-pair
fix(manufacturing): keep bom_no/is_phantom_item pair coherent in get_bom_items_as_dict
2026-07-05 15:38:29 +05:30
Mihir Kandoi
4cb622b8e3 Merge pull request #56895 from mihir-kandoi/pg-budget-requested-amount-per-row
fix(controllers): compute budget requested amount per row
2026-07-05 15:37:56 +05:30
Mihir Kandoi
a5d0b25ac4 test: assert earliest schedule date wins for duplicate MR item rows 2026-07-05 15:32:02 +05:30
Mihir Kandoi
2a6bc517bc fix: exclude fully received PO lines from arrival qty and date 2026-07-05 15:29:18 +05:30
Mihir Kandoi
5d56a04a84 fix(controllers): guard empty group-by detail row in trends
With an explicit GROUP BY, a zero-match detail query returns no rows (the old bare aggregate returned one all-NULL row), so row1[0][0] would raise IndexError. Skip the entry instead.
2026-07-05 15:10:32 +05:30
Mihir Kandoi
b5aee6a9cd fix(buying): show earliest schedule date as required date
When a Material Request lists the same item on multiple rows, the consolidated row showed Max(schedule_date), understating urgency. Use Min - the earliest date the item is needed.
2026-07-05 15:10:17 +05:30
Mihir Kandoi
efd777a1a8 fix(manufacturing): scope Production Planning arrival qty to open POs
arrival_qty summed the all-time ordered qty of every submitted PO line for the item+warehouse, so it grew monotonically with purchase history. Sum the pending qty (qty - received_qty) on open POs instead, and take the earliest schedule date from the same scope.
2026-07-05 15:10:03 +05:30
Mihir Kandoi
e52b1d6cff fix(controllers): compute budget requested amount per row
get_requested_amount multiplied the pooled pending qty of all matching Material Request items by a single Max(rate), fabricating the total whenever rates differ and biasing it upward - making false Budget Exceeded stops more likely. Sum (stock_qty - ordered_qty) * rate per row instead, matching get_ordered_amount.
2026-07-05 15:09:49 +05:30
Mihir Kandoi
39d2a62692 fix(buying): make Procurement Tracker rows coherent PO lines
get_po_entries aggregated every non-key column with Max() over (PO, material_request_item), which could stitch values from different PO lines into a row that never existed (one line's item_code with another's qty and amount). Select one representative line per group instead: a subquery picks Min(child.name) per group under the same filters and the outer query reads all columns bare from that line. Row count is unchanged.
2026-07-05 15:09:21 +05:30
Mihir Kandoi
db5ab9fb35 fix(manufacturing): keep bom_no/is_phantom_item pair coherent in get_bom_items_as_dict
When a BOM lists the same item twice (one line phantom via sub-BOM P, one non-phantom via sub-BOM N), grouping by item_code and aggregating bom_no and is_phantom_item with independent Max() could pair one line's phantom flag with the other line's bom_no, exploding the wrong sub-BOM or silently dropping a direct requirement. Group by the pair instead so each line keeps a coherent (bom_no, is_phantom_item); the consumer accumulates duplicate keys and explodes phantom rows with their own qty. Same fix as 41da9eb7fc, which missed this single-level path.
2026-07-05 15:08:58 +05:30
Nabin Hait
17851ceaae Merge pull request #56877 from frappe/chore/test-appointment-booking-settings
test: add coverage for Appointment Booking Settings
2026-07-05 13:16:15 +05:30
Nabin Hait
d2f0ec883e Merge pull request #56880 from frappe/chore/test-email-campaign
test: add coverage for Email Campaign
2026-07-05 13:16:06 +05:30