Commit Graph

59187 Commits

Author SHA1 Message Date
Mihir Kandoi
ecbf8632aa refactor: parse native JSON request args in accounts/doctype/invoice_discounting/invoice_discounting.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:31 +05:30
Mihir Kandoi
348e3ac4ae fix: handle native JSON request args in financial report template
Replace json.loads(object_hook=...) with frappe.parse_json and wrap each
row in frappe._dict, fixing attribute access when args arrive as native
JSON (list of dicts) instead of a JSON string.
2026-06-24 20:37:31 +05:30
Mihir Kandoi
e37c7e9b32 refactor: parse native JSON request args in accounts/doctype/dunning/dunning.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:30 +05:30
Mihir Kandoi
475cd83861 refactor: parse native JSON request args in accounts/doctype/bank_transaction/bank_transaction_upload.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:30 +05:30
Mihir Kandoi
9d8f6d4ed9 refactor: parse native JSON request args in accounts/doctype/bank_statement_import_log/bank_statement_import_log.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:30 +05:30
Mihir Kandoi
2f0367807f refactor: parse native JSON request args in accounts/doctype/bank_statement_import/bank_statement_import.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:30 +05:30
Mihir Kandoi
ec496c42b5 refactor: parse native JSON request args in accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.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:30 +05:30
Mihir Kandoi
a847d15748 refactor: parse native JSON request args in accounts/doctype/accounting_dimension/accounting_dimension.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:30 +05:30
Mihir Kandoi
a869b748f1 refactor: parse native JSON request args in accounts/doctype/account/chart_of_accounts/chart_of_accounts.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:30 +05:30
rohitwaghchaure
9b0e1b61f2 fix: precision issue causing COGS in inter transfer PR (#56420) 2026-06-24 09:50:22 +00:00
Mihir Kandoi
67d314f32f Merge pull request #56421 from mihir-kandoi/gh56355
fix: exclude virtual child doctypes from deletion in transaction dele…
2026-06-24 15:17:35 +05:30
Mihir Kandoi
8bd8b28207 fix: exclude virtual child doctypes from deletion in transaction deletion record 2026-06-24 14:57:35 +05:30
ruthra kumar
314aa303e5 Merge pull request #56417 from ruthra-kumar/configurable_timeout_on_process_pcv
refactor: configurable timeout on process pcv
2026-06-24 13:27:43 +05:30
ruthra kumar
3da7eefebb refactor: patch, display depends on and json changes 2026-06-24 13:03:07 +05:30
ruthra kumar
13b6c4a165 feat(accounts): add configurable job timeout for Process Period Closing Voucher
Adds a `pcv_job_timeout` Int field (default 3600s) to Accounts Settings
so admins can tune the enqueue timeout for PCV background jobs without
a code change. All three `frappe.enqueue` calls in
`process_period_closing_voucher.py` now read this value at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 12:57:31 +05:30
Mihir Kandoi
eba851b4b5 Merge pull request #56408 from mihir-kandoi/pg-ci-fanout
ci(postgres): scheduled fan-out Postgres CI (daily + `postgres` label gate)
2026-06-24 12:57:13 +05:30
Mihir Kandoi
b919a7abff ci: wait_for_redis fail-fast (greptile) 2026-06-24 12:37:46 +05:30
Mihir Kandoi
a0cc645725 ci(postgres): address greptile review 2026-06-24 12:26:44 +05:30
Mihir Kandoi
882f83ffaf Merge pull request #56411 from mihir-kandoi/patch-cache-v14
ci(patch): cache the v14 baseline backup instead of re-downloading every run
2026-06-24 12:19:36 +05:30
Mihir Kandoi
afca370fa8 ci(patch): cache the v14 baseline backup instead of re-downloading it every run 2026-06-24 11:59:25 +05:30
Mihir Kandoi
c1006e79a4 ci(postgres): cleanup — drop baseline-restore code, debug step, stale restore vars 2026-06-24 11:54:48 +05:30
Mihir Kandoi
8fd0813614 ci(postgres): scheduled fan-out Postgres CI (daily 3am IST + 'postgres' label gate) 2026-06-24 10:39:44 +05:30
Mihir Kandoi
ead694c9cb fix(manufacturing): case-sensitive variant BOM lookup on Postgres (#56407)
Reapply "fix(manufacturing): case-sensitive variant BOM lookup on Postgres"

This reverts commit 1f86b57f94.
2026-06-24 04:51:29 +00:00
rohitwaghchaure
21541e3ad3 fix: job card timer issue (#56405) 2026-06-24 09:15:54 +05:30
Mihir Kandoi
9d28bea453 Merge pull request #56394 from mihir-kandoi/pg-revert-3-commits
Revert 3 Postgres-parity commits (bom variant lookup, traceability div-by-zero, POS NULL ordering)
2026-06-24 07:27:12 +05:30
Mihir Kandoi
40960a5ff9 Merge pull request #56393 from frappe/revert-56239-pg-parity-case-insensitive
Revert "fix: case-insensitive matching match MariaDB on Postgres"
2026-06-24 07:26:01 +05:30
Ravibharathi
022845e4e7 fix(pos): remove redundant opening balance dialog onchange handler (#54591) 2026-06-24 02:20:44 +05:30
Ravibharathi
1e37c4b9ac feat(opening invoice creation tool): add project to opening invoice child row (#54662) 2026-06-24 02:16:05 +05:30
Ravibharathi
32e971e374 fix(payment_entry): recompute base amount when exchange rate changes (#56136)
Co-authored-by: ervishnucs <ervishnucs369@gmail.com>
2026-06-24 01:59:16 +05:30
Mihir Kandoi
1f86b57f94 Revert "fix(manufacturing): case-sensitive variant BOM lookup on Postgres"
This reverts commit 2e5310f8a0.
2026-06-23 23:07:54 +05:30
Mihir Kandoi
c989e424f0 Revert "fix(stock): guard traceability qty division against a zero divisor (Postgres)"
This reverts commit 3859919263.
2026-06-23 23:07:54 +05:30
Mihir Kandoi
49e3830e7f Revert "fix(selling): make POS item-price NULL ordering match across engines (Postgres)"
This reverts commit 20e6a6e149.
2026-06-23 23:07:54 +05:30
Diptanil Saha
b356dbd59e fix(budget): ambiguous error message for budget assignment validation (#56390)
Co-authored-by: Wolfram Schmidt <wolfram.schmidt@phamos.eu>
2026-06-23 17:18:08 +00:00
Mihir Kandoi
a0bbca166f Merge pull request #56389 from frappe/revert-56330-pg-queries-locate-case
Revert "fix(controllers): case-insensitive employee/lead/bom search ranking on Postgres"
2026-06-23 22:29:50 +05:30
Mihir Kandoi
4fb781ae54 Merge pull request #56388 from frappe/revert-56380-pg-get-item-price-null-order
Revert "fix(stock): make get_item_price NULL ordering match across engines (Postgres)"
2026-06-23 22:26:45 +05:30
Mihir Kandoi
2b1a477fc8 Revert "fix: case-insensitive matching match MariaDB on Postgres" 2026-06-23 22:07:48 +05:30
Mihir Kandoi
e4e6e52a4d Revert "fix(controllers): case-insensitive employee/lead/bom search ranking on Postgres" 2026-06-23 22:02:17 +05:30
Mihir Kandoi
c868de324d Revert "fix(stock): make get_item_price NULL ordering match across engines (P…"
This reverts commit 116ef44ddb.
2026-06-23 22:02:00 +05:30
Shllokkk
934b1ff7dd Merge pull request #56337 from Shllokkk/cust-supp-dashboard
fix: show contextual balance label on party dashboard for net balances
2026-06-23 21:22:35 +05:30
Diptanil Saha
0ab812c3ec feat(crm_settings): enable frappe crm data synchronization (#56268) 2026-06-23 21:14:03 +05:30
Mihir Kandoi
116ef44ddb fix(stock): make get_item_price NULL ordering match across engines (Postgres) (#56380)
get_item_price orders Item Price rows by valid_from DESC and takes LIMIT 1 to
pick the most-recent applicable price. NULL-valid_from rows are kept (the
transaction-date guard uses IfNull(valid_from, '2000-01-01')), and MariaDB
sorts NULL last for DESC while PostgreSQL defaults to NULLS FIRST — so when an
item/price_list/uom has both a dated price and a NULL-valid_from price,
PostgreSQL returns the NULL one and MariaDB the most-recent dated one, a silent
price divergence.

Wrap the sort key in IfNull(valid_from, '1900-01-01') so the NULL row sorts
last on both engines. MariaDB already placed it last for DESC, so its pick is
unchanged. Same NULL-ordering class fixed in point_of_sale.get_items (#56378).
2026-06-23 14:55:44 +00:00
Mihir Kandoi
8591a0b6ad Merge pull request #56378 from mihir-kandoi/pg-audit13-fixes
fix(postgres): three parity fixes — POS NULL ordering, traceability div-by-zero, LIKE on non-text
2026-06-23 20:10:20 +05:30
Mihir Kandoi
8960e3ff4a fix(accounts): cast non-text Account fields for LIKE filters (Postgres)
Financial Report Template calculation_formula filters are user-authored and
only validated for field existence + operator membership, not that a
like/ilike operator targets a text field. A filter such as
["is_group", "like", "1"] builds `is_group ILIKE '%1%'`; PostgreSQL has no
LIKE/ILIKE operator for a smallint/int/numeric column
(`operator does not exist: smallint ~~* unknown`) and aborts the report, while
MariaDB implicitly casts the numeric column to text and matches.

For like-family operators, cast a numeric/Check Account field to varchar
(`Cast_(field, "varchar")`), reproducing MariaDB's implicit numeric->text
coercion on both engines. Text-field filters (the normal account_name/
account_number case) are left untouched, so MariaDB output is unchanged.
2026-06-23 19:38:27 +05:30
Mihir Kandoi
3859919263 fix(stock): guard traceability qty division against a zero divisor (Postgres)
get_materials divides stock_entry_detail.qty by a CASE that returns
fg_completed_qty when it is > 0 and otherwise the injected sabb_data.qty. The
code explicitly anticipates fg_completed_qty <= 0 (the else branch), and
neither fg_completed_qty nor sabb_data.qty is constrained non-zero, so the
divisor can be 0. MariaDB returns NULL for x/0; PostgreSQL raises
`division by zero` and aborts the report. Wrapping the CASE in NullIf(..., 0)
makes the divisor NULL instead of 0 — unchanged on MariaDB, valid on Postgres.
2026-06-23 19:38:27 +05:30
Mihir Kandoi
20e6a6e149 fix(selling): make POS item-price NULL ordering match across engines (Postgres)
POS get_items keeps Item Price rows with a NULL valid_from (open-ended base
price) alongside dated rows, orders by valid_from DESC, then picks the first
matching UOM positionally via next()/[0]. MariaDB sorts NULL last for DESC, so
a dated override wins; PostgreSQL defaults to NULLS FIRST for DESC, so the
NULL-valid_from base price wins instead — the POS shows a different
price_list_rate/currency on the two engines for an item that has both an
undated standing price and a dated price.

Coalesce(valid_from, "1900-01-01") in the ORDER BY forces the NULL row to sort
last on both engines. MariaDB already placed it last for DESC, so its output is
unchanged; PostgreSQL now picks the same dated override.
2026-06-23 19:38:25 +05:30
Mihir Kandoi
3d00c93822 fix(stock): keep item-search ordering for Quality Inspection on Postgres (#56372)
The Quality Inspection item link search builds a distinct, paginated
get_query with order_by="items.item_code". frappe's db_query silently drops
the ORDER BY for a distinct query on Postgres, so with offset/limit the
results come back in a different order AND a different page slice than MariaDB.

Append the ordering to the built query instead of passing order_by: item_code
is already in the DISTINCT select list, so ORDER BY on it is valid under
DISTINCT on Postgres, and it now applies before LIMIT on both engines. MariaDB
output is unchanged (it was already ordered by item_code). The items child
field is guarded for None so a doctype without it degrades gracefully rather
than raising AttributeError.
2026-06-23 14:05:35 +00:00
Mihir Kandoi
9fdeb5f991 fix(accounts): make two Query Report SQLs valid on Postgres (loose GROUP BY + no-op ORDER BY) (#56369)
* fix(accounts): wrap loose finance_book in max() in Trial Balance (Simple) (Postgres)

The Trial Balance (Simple) Query Report selects `finance_book` but groups only
by `fiscal_year, company, posting_date, account`. PostgreSQL rejects the
non-grouped, non-aggregated column:

    column "tabGL Entry.finance_book" must appear in the GROUP BY clause or be
    used in an aggregate function

MariaDB tolerates it and returns an arbitrary finance_book per group.

Wrapping it in `max(finance_book)` keeps the row count identical (the GROUP BY
is unchanged) and makes PostgreSQL valid. Adding finance_book to GROUP BY would
split each group into N rows and change the MariaDB row count, so it is not an
option. This replaces MariaDB's previously arbitrary finance_book value with a
deterministic one (the only sanctioned MariaDB-output change); the row count is
preserved.

* fix(accounts): make Sales Partners Commission valid on Postgres (ORDER BY + div-by-zero)

The Sales Partners Commission Query Report had two PostgreSQL problems:

1. It ended with `ORDER BY "Total Commission:Currency:120"`, but the alias the
   query produces is `"Total Commission:Currency:170"` (width 170, not 120), so
   the ORDER BY never referenced a real output column. On MariaDB a double-quoted
   token is a string literal — a no-op sort that never errored. On PostgreSQL a
   double-quoted token is an identifier, so it errors with
   `column "Total Commission:Currency:120" does not exist` (and single-quoting it
   instead trips `non-integer constant in ORDER BY`). Since the clause was always
   a no-op on MariaDB, it is removed — MariaDB's group-order output is unchanged
   and the report runs on PostgreSQL.

2. `sum(total_commission)*100 / sum(amount_eligible_for_commission)` has an
   unguarded divisor: the inner query filters `total_commission`/`base_net_total`
   but not `amount_eligible_for_commission`, so a partner whose rows sum to 0
   there makes MariaDB return NULL but PostgreSQL raise `division by zero`. Wrap
   it in `NULLIF(sum(amount_eligible_for_commission), 0)` — NULL on both engines.

Both verified live on MariaDB and PostgreSQL.
2026-06-23 13:53:38 +00:00
Mihir Kandoi
4aef3aa5b3 Merge pull request #56368 from mihir-kandoi/pg-divzero-nullif-guards
fix: guard division-by-zero divisors across reports/doctypes (Postgres parity)
2026-06-23 19:21:12 +05:30
Mihir Kandoi
df6437c49d Merge pull request #56335 from aerele/fix/skip-over-allowance-for-non-stock-items
fix: skip over-allowance qty validation for non-stock items
2026-06-23 19:14:42 +05:30
Mihir Kandoi
247d574283 Merge pull request #56370 from mihir-kandoi/pg-report-bool-and-fieldcase
fix: two Postgres hard errors — Check-vs-bool and capital-cased fieldname
2026-06-23 19:04:35 +05:30