Commit Graph

60206 Commits

Author SHA1 Message Date
Nabin Hait
4177101ac0 feat(selling): warn when total proforma exceeds the ordered qty/amount
Show a non-blocking notice below the item table when a line's total proforma
quantity (or amount) — this proforma plus already-issued ones — exceeds the
Sales Order line's ordered value. It updates live as the qty/amount or the
basis changes, and the user can still create the proforma.

Issued-proforma qty/amount are aggregated per line on demand (cancelled
proformas excluded); nothing is stored on the Sales Order.
2026-07-17 13:42:11 +05:30
Nabin Hait
f711375885 feat(selling): keep cancelled proformas visible with their PDF
Cancelling a proforma should void it, not erase history.

- Persist the Cancelled status on cancel (db_set) and keep the PDF attached
- Proforma tab now lists cancelled proformas with a red status badge, so the
  voided document and its PDF stay reachable for audit
2026-07-17 12:50:44 +05:30
Nabin Hait
473c655cb2 feat(selling): add amount-based proforma option
Let a proforma be created by editing item amount instead of quantity, for
value/advance-style proformas.

- "Based On" (Quantity | Amount) on the proforma and the create dialog
- Amount basis keeps the ordered qty and derives a rate so the line totals
  the entered amount; the PDF renders the same in-memory Sales Order copy
- Proforma Invoice Item now stores rate and amount
2026-07-17 12:50:44 +05:30
Nabin Hait
f9a09e1b3d refactor(selling): drop proforma quantity tracking
Remove the pending/proforma-qty machinery: it only fit staged, incremental
proformas and misrepresented the common whole-order / re-issued cases.

- Drop proforma_qty from Sales Order Item and its submit/cancel write-back
- Drop pending-qty aggregation and the over-qty soft warning
- The create dialog now pre-fills the ordered qty (editable down)
2026-07-17 11:51:03 +05:30
Nabin Hait
b0c53ac5a4 test(selling): add Proforma Invoice tests
Cover partial proforma being non-blocking on delivery/billing,
pending-qty aggregation with cancelled proformas excluded, tax scaling
to the partial qty, over-qty as a soft warning, and the settings gate.
2026-07-17 11:45:49 +05:30
Nabin Hait
fdc8879ce1 feat(selling): wire Proforma Invoice into Sales Order form
- Create > Proforma Invoice dialog with naming series, print format and
  letter head selectors, and an item-wise pending-qty grid
- Proforma tab listing issued proformas with inline view/email actions,
  shown only once at least one proforma exists
- Register the client script and add the connections dashboard link
2026-07-17 11:45:49 +05:30
Nabin Hait
65db3e374b feat(selling): add Proforma Invoice print format
Jinja print format on Sales Order, rendered against the in-memory
qty-adjusted copy so taxes and totals reflect the partial quantity.
2026-07-16 16:51:56 +05:30
Nabin Hait
07756f2bec feat(selling): add Proforma Invoice doctype and server API
- Submittable, non-accounting Proforma Invoice + Proforma Invoice Item
  child doctype (in_create; posts no GL/stock, stores item + qty only)
- Server API: pending-qty aggregation per Sales Order line (issued
  proformas only), make_proforma_invoice (sole creation path, gated on
  the settings toggle), PDF rendered from an in-memory qty-adjusted copy
  of the Sales Order and attached, send_proforma_email
- Non-blocking proforma_qty write-back to the Sales Order on submit/cancel
2026-07-16 16:51:48 +05:30
Nabin Hait
fbdc1f5b1f feat(selling): add proforma invoice settings and tracking field
- Selling Settings: "Enable Proforma Invoice" toggle (opt-in) and a
  default proforma print format
- Sales Order Item: non-blocking proforma_qty counter
2026-07-16 16:51:37 +05:30
Diptanil Saha
ac68db3fa6 refactor(dunning): converted get_dunning_letter_text to doc method and restrict_globals on render_template (#57205) 2026-07-16 16:06:13 +05:30
rohitwaghchaure
7b517a4e64 feat: book Expenses Added To Stock GL entries for stock vouchers (configurable) (#57190)
* feat: book Expenses Added To Stock GL entries for Stock Entry, Stock Reconciliation and LCV

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat: make stock expense GL booking configurable via Accounts Settings

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: skip stock expense booking for unconfigured companies, check flag once per compose

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 10:04:45 +00:00
Mihir Kandoi
a25acee43f Merge pull request #57179 from aerele/link-portal-users-to-contact-from-relevent-doctype
feat(stock): automatically link portal users to their associated contact profiles for customers and suppliers
2026-07-16 15:23:49 +05:30
Afsal Syed
9ae2069bd9 test(stock): add portal user contact link verification for customer and supplier 2026-07-16 15:11:28 +05:30
Afsal Syed
337a06dfb6 feat(stock): automatically link portal users to their associated contact profiles for customers and suppliers 2026-07-16 15:11:28 +05:30
Mihir Kandoi
103f3e50a7 Merge pull request #57202 from mihir-kandoi/pg-read-committed-gates
fix(stock): serialize postgres stock writes per (item, warehouse); block GL inserts during account rename
2026-07-16 14:10:56 +05:30
Mihir Kandoi
d0010fda68 Merge pull request #57204 from mihir-kandoi/fix-production-plan-min-order-qty
fix: consider min order qty in the purchase/transfer flow of production plan
2026-07-16 13:28:55 +05:30
Mihir Kandoi
448316fe8e test: assert row count in the min order qty split scenario 2026-07-16 12:56:11 +05:30
Mihir Kandoi
2f8d588093 fix: consider min order qty in the purchase/transfer flow of production plan
The transfer flow ignored Consider Minimum Order Qty twice: the JS
handler force-reset the checkbox before fetching items, and the
purchase remainder left after allocating transfers from other
warehouses was never raised to min_order_qty (the check runs on the
total requirement before the split).

Drop the JS reset and apply min order qty to the purchase remainder,
in stock UOM before the purchase UOM conversion.
2026-07-16 12:46:21 +05:30
Mihir Kandoi
b100e6d414 fix(stock): serialize pick list allocation per item on postgres
Two simultaneous allocations for the same item can both claim the same stock
on postgres: the picked-items locking read cannot see the rows another
in-flight creation is inserting, while MariaDB's gap locks make the creations
take turns. Advisory-gate set_item_locations per item (sorted against
deadlocks) so the second allocation waits, then subtracts the first's claim.
MariaDB unchanged.
2026-07-16 09:58:09 +05:30
Mihir Kandoi
897eca895a fix(stock): fall back gracefully when transaction_advisory_lock is unavailable
Same hasattr pattern as repost_gate: an ERPNext ahead of its frappe build keeps
the status-quo serialization-failure retries instead of failing every stock
submission on postgres.
2026-07-16 09:32:03 +05:30
Mihir Kandoi
35a9d7b09c fix(accounts): block GL Entry inserts during account rename on postgres
The for_update read in _ensure_idle_system only blocks new GL inserts on
MariaDB, via the gap lock it takes; a postgres row lock never blocks inserts,
so the guard silently degraded to the 5-minute recency check. LOCK TABLE IN
EXCLUSIVE MODE blocks writers (not readers) until the rename commits and NOWAIT
keeps the wait=False fail-fast, feeding the existing QueryTimeoutError path.
2026-07-16 09:21:17 +05:30
Mihir Kandoi
9cfdb482fc fix(stock): serialize stock writes per (item, warehouse) with a txn advisory lock on postgres
Postgres locking reads never see rows a concurrent transaction is inserting
(MariaDB's gap locks block the insert, then its locking reads return the fresh
row), so two concurrent writers for the same (item, warehouse) compute from the
same stale previous SLE and the loser overwrites Bin with a wrong absolute qty.
Today only the REPEATABLE READ serialization-failure retry catches this; the
gate makes correctness lock-based, covers the empty-history first-transaction
case (nothing exists to row-lock), and keeps negative-stock validation accurate
against concurrently inserted SLEs. Taken at the top of make_sl_entries (sorted
pairs, before the future_sle_exists cache warms) and in
update_entries_after.__init__ for the repost paths; re-entrant, released at
commit. MariaDB paths unchanged.
2026-07-16 09:21:07 +05:30
Mihir Kandoi
7fe4dc1367 Merge pull request #56746 from frappe/mergify/configuration-deprecated-update
ci(mergify): upgrade configuration to current format
2026-07-15 12:53:07 +05:30
Mihir Kandoi
d5126dcad5 Merge pull request #56884 from aerele/fix/v16-report-date-guard
fix: validate mandatory date filters in reports
2026-07-15 12:51:29 +05:30
Diptanil Saha
fee3a6e0fd fix(accounts): update AU standard chart of accounts (#57145)
Co-authored-by: Jebajebas <jeba.j@arus.co.in>
2026-07-15 12:22:02 +05:30
Diptanil Saha
72b72a81fa fix(project): improved access control for project users (#56675)
* fix: permission check for `get_task_html` and `get_timesheet_html`

* fix(project): enabled project access control for users without `Projects User` Role

* fix(portal): validate user permissions for project portal

* fix: patch to add docshare for the project users

* fix(patch): selecting correct column on the query

* fix(project): grant access to all the current users for new project

* fix(portal): fixed condition to display timesheets on project

* test(portal): add access control tests for project user

* fix(project): using `frappe.has_permission` instead of `self.has_permission` to validate user permissions

* fix(project): granting docshare access for every ProjectUser

Roles for an User can be removed any time or an User Permission can be added which might restrict the access to the Project.

* fix(patch): create docshare documents for non-cancelled projects and users who have no docshare documents

* test(project): removed `test_control_access_does_not_touch_users_with_real_permission`
2026-07-15 12:20:27 +05:30
rohitwaghchaure
e99966a38e fix: skip redundant reposting of dependent items (#57092)
* fix: skip redundant reposting of dependent items

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: use earliest cascade datetime and batch repost item lookup

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-15 12:09:34 +05:30
Mihir Kandoi
1d6edf9674 fix: name every conflicting voucher in the reserved batch error (#57174)
* fix: name every conflicting voucher in the reserved batch error

* fix: exclude fully-delivered reservations from the conflict message

* fix: round outstanding qty guard consistently with the conflict gate
2026-07-15 06:13:32 +00:00
Mihir Kandoi
67587a79e9 Merge pull request #57169 from mihir-kandoi/fix-shared-reserved-batch-delivery
fix: allow delivery when a batch is reserved across multiple sales orders
2026-07-15 11:10:58 +05:30
Mihir Kandoi
2310c4c005 fix: allow delivery when a batch is reserved across multiple sales orders
validate_reserved_batches compared the voucher's own qty against the
remaining batch qty, so delivering one order's reserved unit threw
Reserved Batch Conflict whenever the remainder exactly matched another
order's reservation. Compare the remaining batch qty against the
aggregated outstanding reserved qty (qty - delivered_qty) of other
vouchers instead, excluding reservations the voucher itself delivers.
2026-07-15 10:59:52 +05:30
Mihir Kandoi
576a5d26df Merge pull request #57137 from aerele/projects_status
feat: add on hold status to project
2026-07-15 10:51:28 +05:30
Mihir Kandoi
b6b19790d2 Merge pull request #57164 from mihir-kandoi/gh57158
fix: set correct currency in supplier quotation net rate field
2026-07-15 10:46:32 +05:30
Mihir Kandoi
117bb912cb Merge pull request #57163 from mihir-kandoi/hide-job-card-poi
fix: hide job card field in purchase order item
2026-07-15 10:42:58 +05:30
Mihir Kandoi
27672851cd fix: set correct currency in supplier quotation net rate field 2026-07-15 10:34:07 +05:30
Mihir Kandoi
f44bcae47d fix: hide job card field in purchase order item 2026-07-15 10:31:07 +05:30
Mihir Kandoi
71f843e5bf Merge pull request #57154 from aerele/fix-production-plan-bom-warehouse-n-plus-one
fix: batch BOM source warehouse lookup in get_production_items to avo…
2026-07-14 22:18:58 +05:30
pandiyan
4705909cee fix: batch BOM source warehouse lookups to avoid n+1 queries in production plan work order creation 2026-07-14 22:07:52 +05:30
Nabin Hait
04f75cc64f Merge pull request #56983 from nabinhait/fix-flaky-usd-exchange-rate-tests
test: seed current-dated USD↔INR exchange rate to fix flaky currency tests
2026-07-14 18:13:28 +05:30
Nabin Hait
5133ba47b7 fix: make currency exchange truly idempotent against any pre-existing state
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-07-14 18:02:59 +05:30
rohitwaghchaure
1fd2faa68d fix: permission issue (#57112) 2026-07-14 12:22:48 +00:00
Soham Kulkarni
4d2b603ba6 Merge pull request #57134 from sokumon/merge-workspaces
fix: merge erpnext workspaces
2026-07-14 17:10:28 +05:30
Poovitha Palanivelu
672fadaa78 feat: add on hold status to project 2026-07-14 16:43:32 +05:30
Mihir Kandoi
d7f4524cdd refactor: convert Hide Currency Symbol in Global Defaults to a Check field (#57135) 2026-07-14 11:10:07 +00:00
Mihir Kandoi
876adcb535 Merge pull request #57129 from SandraFrappe/fix/purchase-order-duplicate-material-request-item
fix: prevent duplicate material request items in purchase order
2026-07-14 16:31:26 +05:30
Mihir Kandoi
b2ec906ff3 test: remove test 2026-07-14 16:18:53 +05:30
sokumon
f2e8c7b664 fix: add sequence for erpnext 2026-07-14 16:05:44 +05:30
Mihir Kandoi
b6cce627a8 feat: company-wise restriction for Item, Customer and Supplier masters (#57124) 2026-07-14 10:30:47 +00:00
SandraFrappe
2d6f89a7f5 fix: prevent duplicate material request items in purchase order 2026-07-14 14:32:06 +05:30
sokumon
ac99d28100 chore: merge erpnext workspaces 2026-07-14 14:27:39 +05:30
Mihir Kandoi
823dbb7a2b Merge pull request #57127 from mihir-kandoi/naming-posting-date-default-on
feat: make naming series based on posting datetime on by default on n…
2026-07-14 13:49:34 +05:30