Commit Graph

58681 Commits

Author SHA1 Message Date
Sudharsanan11
113b5ecaec test(stock): cover quality inspection readings in every number format
covers the reported case, a 1,15 reading in the space grouped "# ###,##"
format, which was read as 115 and rejected. also covers the dot grouped
comma format, and asserts that a reading written with the wrong separator,
or one that is not a number at all, is now rejected with an error rather
than read as a different value.

(cherry picked from commit b1f188146e)
2026-08-03 06:56:48 +00:00
Sudharsanan11
e2466780b9 test(stock): drop non numeric reading from formula based quality inspection
a numeric reading of "random text" was read as 0 and pulled the mean from
0.6 down to 0.4, which the test then asserted as accepted. such a reading
is now rejected outright, and the test is about formula evaluation, so drop
the row. its assertions are unchanged.

(cherry picked from commit 3752be809f)
2026-08-03 06:56:47 +00:00
Sudharsanan11
3b7fb6851a fix(stock): read quality inspection readings in the user's number format
readings are Data fields, so they are parsed server side. parse_float only
swapped the separators for "#.###,##", so in the space grouped "# ###,##"
(polish) a reading of 1,15 was read as 115, fell outside the acceptance
range and silently rejected the inspection. strip whatever the group
separator is and normalise whatever the decimal separator is instead.

it also read the global number format, while the desk formats numbers with
the user's own. a user whose locale differs from the site therefore typed
readings in a format the server did not parse them with. read the user
default, which falls back to the global one.

a reading that is not a valid number in that format is now rejected with an
error instead of being read as a different number.

(cherry picked from commit e74c0a3cdb)
2026-08-03 06:56:46 +00:00
MochaMind
833ccd3358 chore: update POT file (#57706) 2026-08-02 14:31:18 +02:00
Mihir Kandoi
4a5c416ee0 Merge pull request #57698 from frappe/mergify/bp/version-16-hotfix/pr-57676
feat: select a supplier per item when creating Purchase Orders from a Material Request (backport #57676)
2026-08-02 12:35:56 +05:30
Mihir Kandoi
4b6a4cc9c5 Merge pull request #57701 from frappe/mergify/bp/version-16-hotfix/pr-57699
fix: prevent duplicate shipping charges without cost center (backport #57699)
2026-08-02 12:29:29 +05:30
Mihir Kandoi
e5f8d0c84b fix: apply the supplier selection to this branch's own mapper module
The backport carried develop's mapper module across whole, while version 16
keeps its mappers in material_request.py. That left two copies of the mapping
layer: the dialog and the new tests reached for the imported module, and
make_purchase_order, which the rest of the branch and the older tests use, never
learned to set the supplier - so test_make_purchase_order_sets_supplier failed.

The feature now sits in material_request.py alongside the mappers it extends,
and the imported module is dropped.
2026-08-02 12:25:22 +05:30
Mihir Kandoi
7f81502cde chore: remove shipping rule comments
(cherry picked from commit 106ecd7120)
2026-08-02 06:49:06 +00:00
Mihir Kandoi
666b6167a1 fix: prevent duplicate shipping charges without cost center
(cherry picked from commit a4134af30b)
2026-08-02 06:49:06 +00:00
Mihir Kandoi
65a53a7012 Merge pull request #57697 from frappe/mergify/bp/version-16-hotfix/pr-57674
fix: preserve UOM conversion factor precision in transactions (backport #57674)
2026-08-02 12:06:19 +05:30
Mihir Kandoi
e98471d9c9 fix: resolve version 16 backport conflicts 2026-08-02 12:03:47 +05:30
Mihir Kandoi
187840b559 fix: label the items table in the supplier selection dialog
The grid template always renders its label line, so leaving the table unlabelled
left an empty line hanging above the description.

(cherry picked from commit 2e72846670)
2026-08-02 06:26:26 +00:00
Mihir Kandoi
2c9db13041 fix: keep the bulk supplier field to half the supplier selection dialog
A lone Link field stretched the full width of the dialog, which reads as a
search bar rather than a field. A column break holds it to half.

(cherry picked from commit 44fdf7bea9)
2026-08-02 06:26:26 +00:00
Mihir Kandoi
9b647bed5c feat: set one supplier across every item in the supplier selection dialog
A Material Request where few items carry a default supplier meant picking the
same supplier row by row. A Supplier field above the table copies its value
into every row, leaving the exceptions to be corrected by hand.

Both pickers skip suppliers that are disabled or barred from Purchase Orders by
their scorecard standing.

(cherry picked from commit e84bf44e51)
2026-08-02 06:26:25 +00:00
Mihir Kandoi
93331a1cf0 fix: warn about existing draft orders before the supplier selection creates more
Creating through the dialog calls the endpoint directly instead of going
through open_mapped_doc, so the draft link guard that every other Create action
runs never fired, and a repeated dialog quietly produced a second set of draft
orders for the same quantity.

(cherry picked from commit f0bb70539d)
2026-08-02 06:26:25 +00:00
Mihir Kandoi
380ee3b013 test: reject the same Material Request item twice in one supplier selection
(cherry picked from commit 8ffe5ba420)
2026-08-02 06:26:25 +00:00
Mihir Kandoi
ea770f6a8e fix: reject the same Material Request item twice in one supplier selection
Each row was checked against the pending quantity on its own, so a payload that
listed one item under two suppliers passed both checks and ordered the pending
quantity twice. The dialog cannot produce that, a direct call to the endpoint
can.

(cherry picked from commit 99d56cc850)
2026-08-02 06:26:25 +00:00
Mihir Kandoi
06a753faf3 fix: escape item code and UOM in the supplier dialog errors
Desk renders a client side message as HTML, so an Item or UOM whose name holds
markup ran as markup in the buyer's session.

(cherry picked from commit 21c6d10ad3)
2026-08-02 06:26:24 +00:00
Mihir Kandoi
e71cef02b3 fix: open the Purchase Order when the supplier selection creates only one
Naming a single order in a message and leaving the buyer to click it is a step
for nothing. The form opens directly when there is one order; the message stays
for the case it was meant for, several orders at once.

(cherry picked from commit 3856eaa35e)
2026-08-02 06:26:24 +00:00
Mihir Kandoi
6096e761b0 test: reject a supplier selection without items
(cherry picked from commit d233fdf198)
2026-08-02 06:26:24 +00:00
Mihir Kandoi
d6ee5436b8 feat: order only the items ticked in the supplier selection dialog
Every row is ticked when the dialog opens, so the common case of ordering
everything is unchanged, and a buyer who wants a partial order unticks what
should wait. Creating with nothing ticked is rejected.

(cherry picked from commit 07445b3675)
2026-08-02 06:26:23 +00:00
Mihir Kandoi
810b9ae28f fix: link the item and spell out the unit in the supplier dialog errors
A bare item code left the buyer to find the item themselves, and a bare number
gave no clue what the limit was counted in. Both messages now link the item and
state the pending quantity in bold with its UOM.

(cherry picked from commit 5a78e2290a)
2026-08-02 06:26:23 +00:00
Mihir Kandoi
6b056ebb36 test: alert when Required By falls back to today
(cherry picked from commit 671c289303)
2026-08-02 06:26:22 +00:00
Mihir Kandoi
1adeb66bdc feat: alert when Required By falls back to today
Items whose requested date has passed silently got today as Required By, which
is a date the buyer never asked for. A toast now says so.

(cherry picked from commit 53e09dfdd6)
2026-08-02 06:26:22 +00:00
Mihir Kandoi
5aaefec747 feat: show the UOM alongside the quantity in the supplier selection dialog
The quantity is meaningless without the unit it is counted in, which the buyer
had to look up on the Material Request itself.

(cherry picked from commit d0cae2eb9c)
2026-08-02 06:26:22 +00:00
Mihir Kandoi
d2fe4b623c fix: list the Purchase Orders created per supplier instead of opening one
Opening one of several created orders hid the rest and moved the buyer off the
Material Request. The created orders are now reported the way Production Plan
reports its documents, as links in a message, and the form stays put.

(cherry picked from commit 6f22551aae)
2026-08-02 06:26:22 +00:00
Mihir Kandoi
d718110216 test: Required By on Purchase Orders created per supplier
Backdates the Material Request item so the mapper drops its schedule date, and
asserts the created order still saves with today as Required By.

(cherry picked from commit 15d10bbaf1)
2026-08-02 06:26:21 +00:00
Mihir Kandoi
f99d66d578 fix: set Required By on Purchase Orders created per supplier
Mapping drops a schedule date that already passed, leaving the buyer to pick a
new one on the Purchase Order form. Nothing fills it in when the orders are
created straight from the supplier selection dialog, so a Material Request
whose required date has gone by failed to save with "Please enter the Required
By".

Items that lose their date now fall back to today, which is the earliest date a
Purchase Order raised today accepts.

(cherry picked from commit d05bd80b1e)
2026-08-02 06:26:21 +00:00
Mihir Kandoi
f19aa957cb test: quantity handling in the supplier selection dialog
Asserts the requested quantity reaches the Purchase Order item and that rows
without a supplier, or with a quantity that is zero, negative or beyond the
pending quantity, are rejected.

(cherry picked from commit 09cfd1fe91)
2026-08-02 06:26:21 +00:00
Mihir Kandoi
2c8c375ca6 feat: adjust the ordered quantity in the supplier selection dialog
The dialog prefilled the pending quantity of each Material Request item but
kept it read only, so ordering less than what was requested meant editing the
Purchase Order afterwards.

The quantity is now editable and is validated against the pending quantity of
its Material Request item, both in the dialog and on the server. The requested
quantity is handed to the mapper as the pending quantity of the source row, so
the existing mapping - including the subcontracting conversions - derives the
Purchase Order quantities from it unchanged.

(cherry picked from commit da83370c5c)
2026-08-02 06:26:20 +00:00
Mihir Kandoi
f4d3b2771b test: supplier selection when creating Purchase Orders from Material Request
Covers the default supplier lookup for pending items, the supplier passed
through to a single mapped order, the grouping of items into one order per
supplier, and the failure when an item is sent without a supplier.

(cherry picked from commit 65be201ed6)

# Conflicts:
#	erpnext/stock/doctype/material_request/test_material_request.py
2026-08-02 06:26:20 +00:00
Mihir Kandoi
95f7810948 feat: select a supplier per item when creating Purchase Orders from Material Request
Creating a Purchase Order from a Material Request mapped every pending item
into a single order, leaving the buyer to split it by hand whenever the items
came from different vendors.

The Create action now reads the default supplier of each pending item (item,
item group, then brand defaults). When the items resolve to more than one
distinct supplier - including the case where only some of them have a default -
a dialog lists the items with their default supplier prefilled and editable.
Submitting it groups the items by the chosen supplier and creates one draft
Purchase Order per group.

When every item resolves to the same supplier the order is mapped straight
away with that supplier set, and when none of them has a default supplier the
previous behaviour is unchanged.

(cherry picked from commit e8df7b4a90)

# Conflicts:
#	erpnext/stock/doctype/material_request/mapper.py
#	erpnext/stock/doctype/material_request/material_request.js
2026-08-02 06:26:20 +00:00
Mihir Kandoi
5463bd93aa test: fractional conversion factor survives Material Request to Purchase Order
Fails before the fix with 0.45 != 0.453592292 on a site with Float
Precision 2, and 0.454 on the default of 3.

(cherry picked from commit f4d70c2d60)
2026-08-02 06:25:58 +00:00
Mihir Kandoi
e5999b22c7 fix: preserve UOM conversion factor precision in transactions
calculate_item_values rounds every Float field on an item row to the
site's Float Precision (3 by default), and conversion_factor was one of
them. The factor is a ratio, not a rate: UOM Conversion Factor.value is
stored at precision 9, and Material Request keeps the full value because
it has no currency field and so never runs the calculation.

Mapping a Material Request to a Purchase Order therefore truncated the
factor - 0.453592292 for Pound -> Kg became 0.454 - and stock_qty, which
is recomputed as qty * conversion_factor, drifted from the quantity that
was requested, leaving the Material Request unable to close.

Exclude conversion_factor from the rounded fields on the server and on
the client. Factors below the site precision would otherwise round to
zero outright.

(cherry picked from commit 269cc6ee3b)
2026-08-02 06:25:58 +00:00
Shllokkk
1fbccd9823 Merge pull request #57694 from frappe/mergify/bp/version-16-hotfix/pr-57681
fix: set reservation voucher_qty to voucher demand not reserved qty (backport #57681)
2026-08-01 16:09:20 +05:30
Shllokkk
9457cae327 test: partial work order reservation records full voucher_qty
(cherry picked from commit 7a97dc3361)
2026-08-01 10:12:50 +00:00
Shllokkk
ecccedf0ed fix: set reservation voucher_qty to voucher demand not reserved qty
(cherry picked from commit 7995bb9960)
2026-08-01 10:12:50 +00:00
Diptanil Saha
5633c29223 Merge pull request #57692 from frappe/mergify/bp/version-16-hotfix/pr-57201
fix: permission checks on various whitelisted methods (backport #57201)
2026-08-01 15:12:53 +05:30
diptanilsaha
fcbbb251cf fix(payment_request): added permission checks on resend_payment_email
(cherry picked from commit 0659bd7049)
2026-08-01 15:01:34 +05:30
diptanilsaha
c7cf9d868b fix(item_variant): added permission checks on enqueue_multiple_variant_creation
(cherry picked from commit 3b0cbc972e)
2026-08-01 15:01:27 +05:30
diptanilsaha
99f249b1a0 fix(assets): add permission checks on whitelisted methods on asset_capitalization
(cherry picked from commit 09d721d1be)
2026-08-01 14:55:42 +05:30
Mihir Kandoi
38f7c824f1 Merge pull request #57683 from frappe/mergify/bp/version-16-hotfix/pr-57679
fix: exclude transferred and consumed qty from dashboard reserved stock (backport #57679)
2026-08-01 14:50:56 +05:30
Shllokkk
46317b063a fix: exclude transferred and consumed qty from dashboard reserved stock
(cherry picked from commit 6c36624d91)
2026-08-01 09:03:51 +00:00
Shllokkk
2ce88af3c9 Merge pull request #57672 from frappe/mergify/bp/version-16-hotfix/pr-57668
fix: drop row prefix in reserve stock message when row is unknown (backport #57668)
2026-07-31 23:31:20 +05:30
Shllokkk
684ae4d762 fix: drop row prefix in reserve stock message when row is unknown
(cherry picked from commit 517053bc25)
2026-07-31 22:51:30 +05:30
Sudharsanan Ashok
d09c04a623 fix: update stock variance account logic which defaults to default expense (#57656)
* fix(stock): update stock variance account logic which defaults to default expense account set in company

* test: add regression test for purchase invoice stock adjustment account fallback

---------

Co-authored-by: Afsal Syed <afsalsyed12@gmail.com>
2026-07-31 22:10:15 +05:30
mergify[bot]
624a236f88 fix(quotation): carry forward communications from opportunity at after_insert (backport #57639) (#57643)
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
2026-07-31 20:56:21 +05:30
mergify[bot]
7bc04752fc fix(plant_floor): add missing perm check on get_stock_summary (backport #57667) (#57670)
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
2026-07-31 15:19:50 +00:00
Mihir Kandoi
810da8f542 Merge pull request #57655 from aerele/backport-57567-version-16-hotfix
fix: guard against None row in get_stock_balance_for (backport #57567)
2026-07-31 18:56:42 +05:30
pandiyan
283ee6e07b fix: guard against None row in get_stock_balance_for (backport #57567)
get_stock_balance_for() takes row=None by default, but the batch-tracked
branch dereferenced it unconditionally while the two neighbouring row
accesses already guard. Calling it with a batch_no and no row raised
AttributeError: 'NoneType' object has no attribute 'use_serial_batch_fields'.

semgrep's missing-argument-type-hint rule matches the whole function body,
so touching any line inside it re-fingerprints the pre-existing untyped
arguments and reports them as introduced by this PR. Silenced with
nosemgrep instead of annotating: on a whitelisted method the hints are
enforced at runtime by pydantic, which is not a risk worth taking on a
hotfix branch.
2026-07-31 18:11:02 +05:30