Commit Graph

59535 Commits

Author SHA1 Message Date
Sudharsanan11
a1daad8d4f test(stock): add test for partial transfer status from pick list 2026-07-01 15:44:35 +05:30
Sudharsanan11
27d5165755 feat(stock): support partial transfer from pick list
Creating a Stock Entry from a Pick List blocked any further entry
(stock_entry_exists) and flipped the pick list to Completed as soon as
one entry existed, so picked stock could not be transferred in parts.

Track transferred_qty per Pick List Item (summed from submitted Stock
Entry rows via a new pick_list_item link, mirroring delivered_qty), add
a Partially Transferred status, and map each new Stock Entry from the
remaining qty so transfers can continue until fully transferred.
2026-07-01 15:44:26 +05:30
Mihir Kandoi
94a0c102a3 Merge pull request #56446 from aerele/fix/support-#72225
fix: support quality inspection for stock entry by purpose
2026-06-30 22:37:26 +05:30
Sudharsanan11
847fd8aa33 fix(stock): exclude consumption from outgoing quality inspection
The QI-by-purpose check required an inspection on every outgoing
(s_warehouse) row for any purpose that was not incoming. Material
Consumption for Manufacture rows are source-only and the Work Order
mapper copies inspection_required from the BOM, so this silently
blocked submission. An inspection_required BOM inspects the finished
good, not each consumed raw material.

Replace the "anything not incoming" fallthrough with an explicit
QI_OUTGOING_PURPOSES allow-list (mirrored in transaction.js) so a new
purpose cannot silently start requiring a QI. Consumption and Return
Raw Material to Customer now need no QI; Issue, Transfer, Transfer for
Manufacture, Send to Subcontractor, Subcontracting Delivery and
Disassemble keep their outgoing checks. Scope item_query to the same
set and add a regression test.
2026-06-30 21:32:30 +05:30
Mihir Kandoi
5afabb089d Merge pull request #56665 from mihir-kandoi/pg-greptile-audit-learnings
ci(greptile): DISTINCT row-count trap + refactor/conversion row-set faithfulness
2026-06-30 21:08:43 +05:30
Shllokkk
6425b9afaf Merge pull request #56661 from Shllokkk/fix-bulk-transaction-method
fix: handle None args in transaction_processing
2026-06-30 21:02:05 +05:30
Mihir Kandoi
f560767eb0 ci(postgres): include §6 in the How-to-review closing summary
The closing paragraph named only the §2/§3 semantic divergences as static-checker-invisible;
§6 (refactor/conversion row-set changes) is equally invisible and belongs there too. (greptile nit.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 20:58:52 +05:30
Mihir Kandoi
e79c24791f ci(greptile): flag the DISTINCT row-count trap and refactor-smuggled row-set changes
Mirror the two new POSTGRES_COMPATIBILITY.md rules into the greptile instructions so the bot flags
them on changed queries: (1) adding an ORDER BY column to a SELECT DISTINCT grows the distinct key
and the MariaDB row count unless it is functionally dependent; (2) a refactor / raw-frappe.db.sql->qb
conversion can silently change the WHERE/row set on both engines -- review the predicate, not just
the query shape.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 20:41:35 +05:30
Mihir Kandoi
a26329b2a0 ci(postgres): teach the parity guide the DISTINCT row-count trap + refactor faithfulness
Two review lessons from the post-merge net-diff/whole-repo re-audit of the SQL-dialect classes:

- Section 3 (row-count trap) now covers SELECT DISTINCT too: adding the ORDER BY column to the
  select to satisfy Postgres grows the DISTINCT key and changes the MariaDB row count when the
  column is not single-valued per distinct row -- sort in Python instead.
- New section 6: a 'refactor' / raw-SQL->qb conversion is not automatically 1:1. Diff the
  WHERE/predicate and the resulting row set, not just the SELECT shape -- a conversion that widens
  a filter (e.g. posting_datetime > X gaining an OR (== X AND creation > ...) branch under a
  sql->qb refactor) changes the rows touched on both engines and hides under a refactor label.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 20:41:34 +05:30
Mihir Kandoi
78a64cd79b Merge pull request #56662 from mihir-kandoi/st72149
fix: use correct variable to fetch valuation method
2026-06-30 20:33:48 +05:30
Mihir Kandoi
1492c9fbc3 fix: use correct variable to fetch valuation method 2026-06-30 20:23:14 +05:30
Diptanil Saha
5b3e6e4714 Revert "chore: remove unused whitelisted method from project" (#56660) 2026-06-30 20:12:03 +05:30
Shllokkk
0db4af22e0 fix: handle None args in transaction_processing 2026-06-30 20:11:28 +05:30
Venkatesh
3b0e1fbb79 fix: remove translation for filter (#56629)
Co-authored-by: SowmyaArunachalam <sowmyaarunachalam57@gmail.com>
2026-06-30 14:52:11 +02:00
Mihir Kandoi
1c92dac274 Merge pull request #56450 from aerele/fix/support-#70387
fix(selling): update sales order per billed on credit note submission
2026-06-30 17:54:09 +05:30
ruthra kumar
d389a03c15 Merge pull request #56655 from ruthra-kumar/bootstrap_test_data_in_warmed_db
ci: warmup test data along with DB
2026-06-30 17:44:45 +05:30
ruthra kumar
dcdbf9df17 ci: warmup test data along with DB 2026-06-30 17:30:36 +05:30
rohitwaghchaure
b8be1c8efd refactor: frappe.db.sql to frappe.qb for update_qty_in_future_sle (#56609) 2026-06-30 15:40:10 +05:30
Nikhil Kothari
8447f551e7 fix(banking): use custom renderer for translated strings and parser for rules (#56643)
fix(banking): use custom renderer for translated strings and parser for formula evaluation
2026-06-30 09:21:42 +00:00
Sudharsanan Ashok
6184c057db 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
2026-06-30 14:28:04 +05:30
Mihir Kandoi
3d7bcd1f6a Merge pull request #56630 from mihir-kandoi/pg-convergence-fixes
fix: Postgres transaction-abort savepoints + div0/tiebreaker convergence fixes
2026-06-30 13:40:07 +05:30
Sudharsanan11
710d0667fa test(selling): add test to validate the per billed after credit note submission 2026-06-30 13:03:07 +05:30
Mihir Kandoi
460bb9e5d0 fix(crm): scope create_address rollback to a savepoint (review)
create_address is a helper called by create_prospect/create_customer AFTER they insert the Prospect/Customer. Its full frappe.db.rollback() on an address-save failure rolled back the caller's just-inserted parent doc, then swallowed the exception, so the caller returned a Prospect/Customer name that no longer existed. Scope the rollback to savepoint('crm_create_address') so only the address work is undone; the parent doc survives and the failed address is just logged.
2026-06-30 13:01:32 +05:30
Sudharsanan11
1202e79a16 fix(stock): fix tests 2026-06-30 12:31:14 +05:30
Khushi Rawat
8dfabf0e19 Merge pull request #56569 from frappe/fix-asset-is-fully-depreciated-visibility
fix(asset): conditionally show Is Fully Depreciated field
2026-06-30 12:28:22 +05:30
Mihir Kandoi
a36065931d fix(telephony): scope link_existing_conversations rollback to a savepoint (review)
link_existing_conversations is the Contact after_insert hook; a full frappe.db.rollback() on a failed call_log.save() would discard the triggering Contact insert itself (and, in test mode, the whole unit of work). Savepoint the hook's DB work and roll back only to it.
2026-06-30 12:17:39 +05:30
Mihir Kandoi
bd57e43446 fix(setup): scope regional-tax-settings rollback to a savepoint (review)
from_detailed_data inserts tax templates/accounts before update_regional_tax_settings in the same transaction; a full frappe.db.rollback() on regional-setup failure discarded those templates while the wizard continued. Take a savepoint before the regional call and roll back only to it.
2026-06-30 12:17:38 +05:30
Mihir Kandoi
16a6a4913e fix(stock): log Material Request failure without the rolled-back doc (review)
After rollback(save_point=reorder_mr) discards the just-inserted Material Request, mr.log_error() left a dangling Error Log reference. Use frappe.log_error(title=...).
2026-06-30 12:17:37 +05:30
Mihir Kandoi
b0331f13f1 fix(accounts): log bank-entry failure without the rolled-back doc (review)
The savepoint rollback erases the just-inserted Bank Transaction row, so bank_transaction.log_error() created an Error Log pointing at a row that no longer exists. Use frappe.log_error(title=...) with no doc reference.
2026-06-30 12:17:36 +05:30
Mihir Kandoi
3a1b47435f Merge pull request #56621 from aerele/fix/support-72552
fix: set mr status to received when per_received is 100 even if per_o…
2026-06-30 11:10:31 +05:30
pandiyan
a3c5ef6aa3 fix: set mr status to received when per_received is 100 even if per_ordered < 100 2026-06-30 11:00:23 +05:30
MochaMind
5c17c7d285 fix: sync translations from crowdin (#56633)
* fix: Persian translations

* fix: Swedish translations
2026-06-29 23:20:06 +02:00
Mihir Kandoi
f41e8208d8 fix(crm): savepoint Email Campaign send loop (Postgres)
send_mail (called per campaign schedule in a loop) inserts a Communication via make(); on failure the except calls frappe.log_error with no rollback, raising InFailedSqlTransaction on Postgres and poisoning subsequent sends. Savepoint before make() + rollback(save_point=) before log_error. No-op on MariaDB.
2026-06-29 22:48:28 +05:30
Mihir Kandoi
4feb9f9910 fix(assets): savepoint per-entry depreciation posting (Postgres)
make_depreciation_entry posts a Journal Entry per schedule row in a loop; the except only stored the error, so the next row's je.save()/submit() ran on the Postgres-poisoned txn (InFailedSqlTransaction). Savepoint per iteration + rollback(save_point=) before storing the error; the final raise of the collected error is unchanged. No-op on MariaDB.
2026-06-29 22:48:27 +05:30
Mihir Kandoi
944eeb5921 fix(accounts): savepoint subscription-status update loop in Payment Entry (Postgres)
trigger_invoice_update_for_subscriptions loops invoices calling refresh_subscription_status (db_set/save); on failure the except calls frappe.log_error with no rollback, raising InFailedSqlTransaction on Postgres, and the next invoice runs in the poisoned txn. Savepoint per iteration + rollback(save_point=) before log_error. No-op on MariaDB.
2026-06-29 22:48:26 +05:30
Mihir Kandoi
f3785f10a2 fix(accounts): savepoint per-row merge in Ledger Merge (Postgres)
start_merge merges accounts in a loop; on failure it only rolled back when not in_test, so in tests a failed merge_account left the Postgres txn poisoned and the except log_error + the finally db_set(status) raised InFailedSqlTransaction. Wrap each row in savepoint('ledger_merge_row') and rollback to it unconditionally before log_error - this recovers the txn in both paths without the full rollback discarding the rest of the test transaction. Production still commits per successful merge, so the per-iteration savepoint rollback is equivalent to the prior full rollback. No-op on MariaDB.
2026-06-29 22:48:25 +05:30
Mihir Kandoi
6b0f3cd243 fix(crm): rollback before logging in Frappe CRM webhook handlers (Postgres)
create_prospect/create_address/create_customer insert docs and on failure call frappe.log_error with no rollback; on Postgres (untrusted external CRM webhook input) a failed insert poisons the txn so log_error raises InFailedSqlTransaction. Full frappe.db.rollback() before each log_error. No-op on MariaDB.
2026-06-29 22:45:22 +05:30
Mihir Kandoi
5110e7f0fd fix(accounts): rollback before log_error in deferred-accounting in_test branch (Postgres)
book_deferred_entries' make_gl_entries failure path: the else branch already rolls back before log_error, but the frappe.in_test branch ran doc.log_error then re-raised with no rollback -> on Postgres log_error hits InFailedSqlTransaction and masks the original error. Rollback before log_error in the in_test branch too. No-op on MariaDB.
2026-06-29 22:45:21 +05:30
Mihir Kandoi
c643fe5274 fix(manufacturing): rollback before marking BOM Creator failed (Postgres)
create_production_plan_bom (background job) save+submits BOMs in a loop; on failure the except runs self.db_set(status=Failed, error_log) with no rollback, raising InFailedSqlTransaction on Postgres so status is never set. Full frappe.db.rollback() at the top of the except. No-op on MariaDB.
2026-06-29 22:45:20 +05:30
Mihir Kandoi
790560ebf8 fix(stock): rollback before marking Stock Closing Entry failed (Postgres)
prepare_closing_stock_balance (background job) saves Stock Closing Balance rows + db_set status; on failure the except runs db_set('Failed')+log_error with no rollback, raising InFailedSqlTransaction on Postgres so the doc is never marked Failed and the job dies. Full frappe.db.rollback() before the handler's db_set. No-op on MariaDB.
2026-06-29 22:45:19 +05:30
Mihir Kandoi
44458b0ba5 fix(setup): rollback before logging in update_regional_tax_settings (Postgres)
Regional tax-template setup writes docs; on failure the except calls frappe.log_error with no rollback -> InFailedSqlTransaction on Postgres. Full rollback before log_error. No-op on MariaDB.
2026-06-29 22:42:49 +05:30
Mihir Kandoi
8c0b4a99cf fix(setup): rollback before logging in install_country_fixtures (Postgres)
Regional fixture setup writes docs; on failure the except calls frappe.log_error before frappe.throw with no rollback -> InFailedSqlTransaction on Postgres. Full rollback before log_error. No-op on MariaDB.
2026-06-29 22:42:48 +05:30
Mihir Kandoi
01811ccf85 fix(telephony): rollback before logging in call_log link_existing_conversations (Postgres)
The hook saves Call Logs in a loop; on failure the except calls frappe.log_error (INSERT) with no rollback, raising InFailedSqlTransaction on Postgres (it runs on every Contact create/update). Full frappe.db.rollback() before log_error. No-op on MariaDB.
2026-06-29 22:42:48 +05:30
Mihir Kandoi
09a3eb8509 fix(integrations): savepoint the Plaid bank-account update branch + rollback add_institution (Postgres)
add_bank_accounts hardened only the INSERT branch with savepoint('plaid_bank_account'); the parallel else/UPDATE branch ran log_error+throw after a failed existing_account.save() with no rollback -> InFailedSqlTransaction on Postgres (masking the friendly throw). Mirror the insert branch with savepoint('plaid_update_account')+rollback. Also add_institution's except log_error after a failed bank.insert() now rolls back first. No-op on MariaDB.
2026-06-29 22:42:47 +05:30
Mihir Kandoi
298df4d3aa fix(stock): savepoint per-company Material Request creation in reorder (Postgres)
create_material_request loops companies inserting+submitting a Material Request; the except calls mr.log_error (INSERT) with no rollback, raising InFailedSqlTransaction on Postgres in the scheduled reorder job, and the next company runs in the poisoned txn. Savepoint per iteration + rollback(save_point=) before log_error. No-op on MariaDB.
2026-06-29 22:38:02 +05:30
Mihir Kandoi
c97eac34bf fix(accounts): savepoint per-row bank entry in Bank Transaction upload (Postgres)
create_bank_entries loops rows inserting+submitting a Bank Transaction; on failure the except calls bank_transaction.log_error (INSERT) with no rollback, raising InFailedSqlTransaction on Postgres, and the next row runs in the poisoned txn. Savepoint per row + rollback(save_point=) before log_error. No-op on MariaDB.
2026-06-29 22:38:02 +05:30
Mihir Kandoi
4a572311bc fix(buying): insert default Supplier Scorecard records with ignore_if_duplicate (Postgres)
make_default_records inserted Scorecard Variable/Standing rows in a loop and swallowed DuplicateEntryError (frappe.NameError). On Postgres the failed insert poisons the txn so the next iteration's insert raises InFailedSqlTransaction. insert(ignore_if_duplicate=True) emits ON CONFLICT DO NOTHING, never poisoning the txn. No-op on MariaDB.
2026-06-29 22:38:01 +05:30
Mihir Kandoi
1dde2b5f1e fix(stock): savepoint repost loop in Stock Ledger Invariant Check (Postgres)
Same shape: the rows loop submits a Repost Item Valuation; a caught DuplicateEntryError poisons the Postgres txn so the next iteration's submit raises InFailedSqlTransaction. Savepoint + rollback(save_point=) before continue. No-op on MariaDB.
2026-06-29 22:38:00 +05:30
Mihir Kandoi
d7a81affc2 fix(stock): savepoint repost loop in Stock and Account Value Comparison (Postgres)
The item/warehouse loop submits a Repost Item Valuation; a DuplicateEntryError poisons the Postgres transaction, so the next iteration's .submit() raises InFailedSqlTransaction. MariaDB continues. Savepoint per iteration + rollback(save_point=) on the caught duplicate (mirrors repost_item_valuation:782). No-op on MariaDB.
2026-06-29 22:37:59 +05:30
Mihir Kandoi
91dae91769 fix(setup): deterministic tiebreaker in get_exchange_rate Currency Exchange lookup (Postgres)
get_exchange_rate orders Currency Exchange by 'date desc' LIMIT 1 with no unique tiebreaker. Currency Exchange autoname {date}-{from}-{to}-{purpose} allows multiple same-date rows (different purpose) for one currency pair; on the no-purpose-filter path all match, so MariaDB and Postgres can return a different exchange_rate for the same inputs. Add 'name desc' so both engines pick the same row. MariaDB row count unchanged.
2026-06-29 22:25:39 +05:30