Commit Graph

59288 Commits

Author SHA1 Message Date
Mihir Kandoi
5fb16ca20c fix(postgres): get_item_price picks undated price on Postgres
Both Item Price lookups order by valid_from desc and take the first valid row.
MariaDB sorts NULL valid_from last; Postgres first, so the undated base price was
winning over a dated one. Order by (valid_from IS NULL) asc, valid_from desc (the
get_all is converted to qb since its order_by won't take such an expression).
MariaDB output is unchanged.
2026-06-25 14:39:07 +05:30
Mihir Kandoi
b10cf2fb65 fix(postgres): POS item price ignores NULL valid_from ordering on Postgres
get_items orders Item Price by valid_from and picks the first match. MariaDB sorts
NULL valid_from last under DESC (so a dated price wins); Postgres sorts it first,
so the undated base price wins and POS shows the wrong rate. Order by
(valid_from IS NULL) asc, valid_from desc so NULLs sort last on both backends
regardless of any real date value (MariaDB unchanged).
2026-06-25 14:39:05 +05:30
Mihir Kandoi
da8ac36b92 Merge pull request #56410 from mihir-kandoi/mariadb-ci-fanout
ci(mariadb): self-hosted fan-out MariaDB CI (ARC runners, datadir bake)
2026-06-25 13:58:48 +05:30
Mihir Kandoi
f3315ecb34 ci(mariadb): un-wire warm-bench (no measurable gain)
Measured A/B on the self-hosted setup: warm-bench restore 85s vs full
bench init 82s — no gain (slightly slower). bench init is already fast
because the uv/pip caches are mounted warm, so the cache only replaces a
~13s init while adding a ~200MB untar and still running bench build.

Drop BENCH_CACHE_DIR so warm-bench stays inert (the helper functions
remain, matching develop's install.sh).
2026-06-25 13:47:54 +05:30
Mihir Kandoi
61f0a39716 Merge remote-tracking branch 'frappe/develop' into mariadb-ci-fanout
# Conflicts:
#	.github/helper/hydrate.sh
#	.github/helper/install.sh
#	.github/helper/start-db.sh
2026-06-25 13:31:28 +05:30
Mihir Kandoi
368ea75e38 ci: address self-review findings
- Wire up warm-bench: set BENCH_CACHE_DIR on the setup job so the bench-base
  cache actually activates (was inert with no dir set, so every run did a
  full bench init). Lives on the node-local bench-staging hostPath; any
  miss/failure still falls back to a full init.
- run_ci_step: capture the timeout exit code under `set -e` (the previous
  `timeout ...` + `ec=$?` aborted at the timeout line on failure, skipping
  ::endgroup:: and the exit-code return).
- Raise the per-step timeout 600s -> 1800s so a contended reinstall isn't
  killed before the 40-min job timeout.
- Propagate DB through the su re-exec in start-db.sh / hydrate.sh so a
  DB=postgres invocation can't silently fall back to the mariadb branch.
- Simplify the coverage job `if` to the equivalent plain non-PR gate.
2026-06-25 13:24:15 +05:30
ruthra kumar
bd53db61cc Merge pull request #56304 from ruthra-kumar/reports_on_duckdb
feat: faster (synced) financial statements using duckdb
2026-06-25 12:40:08 +05:30
ruthra kumar
963bbc8729 refactor: synced reports should be enabled on sites based on requirements 2026-06-25 12:03:42 +05:30
Mihir Kandoi
beec05ce1c ci: restore postgres durability-off settings in install.sh
The fan-out moved fsync/synchronous_commit/full_page_writes=off into
start-db.sh startup flags, but the Postgres workflow runs a postgres:13.3
service container and calls install.sh directly — it never runs start-db.sh.
So those flags never reached the Postgres CI, regressing it to full durability
on a commit-heavy suite. Re-apply them via ALTER SYSTEM (reloadable) in the
DB == "postgres" path, where the service-container workflow executes. MariaDB
is unaffected (DB != postgres).
2026-06-25 12:03:07 +05:30
Mihir Kandoi
694f46f7f7 ci(mariadb): track the erpnext branch for frappe, drop hardcoded develop
Remove the `|| 'develop'` fallback on FRAPPE_BRANCH so install.sh resolves the
frappe framework branch from the git context (GITHUB_BASE_REF/GITHUB_REF), the
same as the Postgres workflow. This makes the workflow backportable unchanged:
on version-15-hotfix / version-16-hotfix it now clones the matching frappe
branch instead of develop.
2026-06-25 11:54:26 +05:30
Khushi Rawat
ce44d9192d Merge pull request #56432 from iamejaaz/fix-letterhead-no-company
fix(letter-head): guard company lookups when doc has no company field
2026-06-25 11:11:23 +05:30
ruthra kumar
6a93baacf0 feat(profit-and-loss): implement execute_synced_report with full parity to normal report
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 11:01:32 +05:30
ruthra kumar
bb19540816 feat(balance-sheet): implement execute_synced_report with full parity to normal report
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 11:01:32 +05:30
ruthra kumar
6b4895bcc9 feat(general-ledger): implement execute_synced_report with full parity to normal report
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 11:01:32 +05:30
ruthra kumar
f40cd41801 refactor: DB agnostic method names 2026-06-25 11:01:32 +05:30
ruthra kumar
5c536b8ad1 refactor: maintain sync dependency in report master 2026-06-25 11:01:32 +05:30
ruthra kumar
55862f98f4 refactor(trial-balance): execute_duckdb only reads GL Entry from duckdb
Replaces the previous over-engineered stub with 7 short functions.
Account data, Account Closing Balance, and all metadata come from
frappe.db as normal; only tabGL Entry is read from the duckdb_conn.

Reuses get_opening_balance() for Account Closing Balance unchanged,
reuses all downstream compute helpers (calculate_values, prepare_data,
etc.) unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 11:01:32 +05:30
ruthra kumar
b1c8e2cb5c feat(trial-balance): implement execute_duckdb with full parity to normal report
Replaces the placeholder stub with 8 focused functions that mirror the
normal execute() flow using parameterized DuckDB SQL queries: account
fetch, period GL entries, opening balances (with Period Closing Voucher
path), and all filters (cost center, project, finance book, accounting
dimensions). Reuses existing pure-Python processing functions unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 11:01:32 +05:30
ruthra kumar
adb768505a refactor: reports on duckdb 2026-06-25 11:01:32 +05:30
Mihir Kandoi
dfdfcb8ca1 ci(mariadb): fix stale 'restore DB dump' fan-out comment
The shards start MariaDB on the baked datadir; there is no DB dump restore.
Aligns the overview comment with the corrected Hydrate step (greptile).
2026-06-25 06:28:28 +05:30
Mihir Kandoi
fcfaa8843b Merge pull request #56439 from mihir-kandoi/migrate-request-type-json
fix!: switch ERPNext to JSON request body (use_json_request_body)
2026-06-24 22:37:59 +05:30
Mihir Kandoi
3be80d8e87 fix: include list in get_events filters type hint
The calendar view sends filters as a list of [doctype, field, op, value]
conditions (filter_area.get()); get_filter_conditions_qb accepts dict or list.
2026-06-24 22:01:55 +05:30
Mihir Kandoi
f034bb55d3 fix: correct process_genericode_import filters hint to str | dict | None
import_genericode consumes filters via (filters or {}).items(), so it is a
dict, not a list.
2026-06-24 22:01:55 +05:30
Mihir Kandoi
71b4cc4f12 refactor: drop dead except TypeError in add_bank_accounts
frappe.parse_json never raises TypeError (unlike json.loads on a non-str),
so the try/except guarding the parse is now unreachable.
2026-06-24 20:55:01 +05:30
Mihir Kandoi
6a4afd1733 fix: parse native JSON contacts args in CRM prospect/customer endpoints
create_prospect_against_crm_deal and create_customer read `contacts`
from form_dict (json.loads(doc.contacts) / customer_data.get("contacts")),
which arrives as a native list under JSON body mode. Use frappe.parse_json.
2026-06-24 20:55:01 +05:30
Mihir Kandoi
3fa7ec656b fix: parse native JSON schedules arg in make_payment_request
make_payment_request(**args) is whitelisted and the client passes
`schedules` as a list, so json.loads(args.get("schedules")) raised
TypeError under JSON body mode. Use frappe.parse_json.
2026-06-24 20:55:01 +05:30
Mihir Kandoi
8854f0c153 feat!: send ERPNext requests as native JSON (use_json_request_body)
Opt ERPNext into native application/json request bodies (frappe#40237).
Non-GET requests to erpnext.* endpoints now send args as a JSON body
instead of form-encoded, per-key JSON-stringified values. Safe after the
preceding commits hardened every whitelisted endpoint with frappe.parse_json.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
9955adb2fc refactor: parse native JSON request args in www/book_appointment/index.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
785c34e0ad refactor: parse native JSON request args in utilities/query.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
7e8965c6be refactor: parse native JSON request args in utilities/bulk_transaction.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
7cbebc0545 refactor: parse native JSON request args in support/doctype/issue/issue.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
b3526db643 refactor: parse native JSON request args in stock/utils.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
f707da40ec refactor: parse native JSON request args in stock/report/stock_qty_vs_batch_qty/stock_qty_vs_batch_qty.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
cb2679ba2c refactor: parse native JSON request args in stock/get_item_details.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
a6ede74b2d refactor: parse native JSON request args in stock/doctype/warehouse/warehouse.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
5aeb711f69 refactor: parse native JSON request args in stock/doctype/stock_reconciliation/stock_reconciliation.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
9506a9d62a refactor: parse native JSON request args in stock/doctype/stock_entry/stock_entry.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
63a1b7d8e5 refactor: parse native JSON request args in stock/doctype/stock_entry/services/subcontracting.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
f5bf9392a0 refactor: parse native JSON request args in stock/doctype/stock_entry/services/manufacturing.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
ddd57ca12e refactor: parse native JSON request args in stock/doctype/serial_no/serial_no.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
2c7cea2879 refactor: parse native JSON request args in stock/doctype/repost_item_valuation/repost_item_valuation.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
8ca2e99cf2 refactor: parse native JSON request args in stock/doctype/putaway_rule/putaway_rule.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
a11eb741e5 refactor: parse native JSON request args in stock/doctype/purchase_receipt/mapper.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:35 +05:30
Mihir Kandoi
487aff80e0 refactor: parse native JSON request args in stock/doctype/pick_list/mapper.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:34 +05:30
Mihir Kandoi
68e92a893a refactor: parse native JSON request args in stock/doctype/packed_item/packed_item.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:34 +05:30
Mihir Kandoi
ccd115e769 refactor: parse native JSON request args in stock/doctype/material_request/mapper.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:34 +05:30
Mihir Kandoi
5a77df6560 refactor: parse native JSON request args in stock/doctype/delivery_note/mapper.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:34 +05:30
Mihir Kandoi
04a93cabf1 refactor: parse native JSON request args in stock/doctype/batch/batch.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:34 +05:30
Mihir Kandoi
460b8c5d8d refactor: parse native JSON request args in setup/doctype/terms_and_conditions/terms_and_conditions.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:34 +05:30
Mihir Kandoi
76705dd736 refactor: parse native JSON request args in setup/doctype/holiday_list/holiday_list.py
Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
2026-06-24 20:37:34 +05:30