Commit Graph

58808 Commits

Author SHA1 Message Date
Mihir Kandoi
ae00a09cdf test: transfer qty exemption only applies when material transfer is skipped
(cherry picked from commit 1478e2a4cb)
2026-08-09 14:42:14 +00:00
Mihir Kandoi
f810d780c0 fix: keep the transfer qty check for legacy semi FG cards without an FG item
Existing submitted BOMs may carry operations without a finished good,
and no migration repairs them. Exempting every semi FG job card from
the transfer check let such a card submit after a partial transfer.
Exempt only cards that skip material transfer; legacy cards with
transfer enabled keep the strict transferred qty check.

(cherry picked from commit 1deae664ce)
2026-08-09 14:42:14 +00:00
Mihir Kandoi
5f391a2531 test: partial entries consume exactly the job card's material requirement
(cherry picked from commit 8f0617c834)
2026-08-09 14:42:14 +00:00
Mihir Kandoi
acba9945b0 fix: scale generated raw materials to the manufacture entry's production share
Every generated entry copied each Job Card Item's full required_qty in
the skip-transfer and BOM-backflush paths, so two entries for one job
card consumed the requirement twice. Scale the rows to the share of
production this entry accounts for and cap them at the requirement
still unconsumed, dropping rows that have nothing left. An entry whose
materials are exhausted then fails the existing at-least-one-raw-material
check instead of minting finished goods from nothing.

(cherry picked from commit 0428cddf5b)
2026-08-09 14:42:14 +00:00
Mihir Kandoi
a815a756b7 test: update-after-submit save keeps the manufacture entry intact
(cherry picked from commit 424a1dfa87)
2026-08-09 14:42:13 +00:00
Mihir Kandoi
491f9fa3fe fix: skip the pending production check on update-after-submit saves
Saving a submitted manufacture entry to change an allowed field re-ran
the pending production cap with a manufactured aggregate that already
includes the entry itself, so the save was rejected against the
post-entry remainder. Quantities are not editable after submit, so the
check has nothing to protect there.

(cherry picked from commit bed957fa67)
2026-08-09 14:42:13 +00:00
Mihir Kandoi
e252329df4 test: target warehouse stays optional for semi FG work orders
(cherry picked from commit db99657c47)

# Conflicts:
#	erpnext/manufacturing/doctype/work_order/test_work_order.py
2026-08-09 14:42:13 +00:00
Mihir Kandoi
c598cf9010 fix: keep Target Warehouse optional for work orders tracking semi finished goods
The WIP warehouse change also removed the Target Warehouse exemption
for semi FG orders, but those may validly carry the target on each
operation instead. Restore the exemption in the form and the submit
check; the WIP warehouse requirement stays.

(cherry picked from commit 9df527bf3f)
2026-08-09 14:42:12 +00:00
Mihir Kandoi
e885902864 test: partial manufacture entry then finishing the job card
(cherry picked from commit eb7537c8df)
2026-08-09 14:42:12 +00:00
Mihir Kandoi
2548751673 fix: generate the next manufacture entry net of booked process loss
After a partial entry booked the job card's full process loss, the
next generated entry was sized qty-to-produce minus manufactured only.
It exceeded the pending production cap, so Make Stock Entry could not
finish the card. Subtract the consumed loss when sizing the entry.

(cherry picked from commit b8dd886cd4)

# Conflicts:
#	erpnext/manufacturing/doctype/job_card/job_card.py
2026-08-09 14:42:12 +00:00
Mihir Kandoi
f25c54e9d7 test: stale manufacture draft cannot over-produce without an operation BOM
(cherry picked from commit 7157e4357b)
2026-08-09 14:42:11 +00:00
Mihir Kandoi
79ad410cc1 fix: cap a manufacture entry at the job card's pending production
Entries from operations without their own BOM carry no For Quantity,
so the finished-good reconciliation cannot run for them and a draft
created before other entries were submitted could still over-produce.

Validate every job-card manufacture entry against the job card
directly: finished goods plus process loss must fit in what the job
card still has left to produce after earlier submitted entries.

(cherry picked from commit 94cd27ce5d)
2026-08-09 14:42:11 +00:00
Mihir Kandoi
605821f04c test: operation BOM materials expand on single-pass submit, final FG must match the BOM item
(cherry picked from commit 9ef386dfd2)
2026-08-09 14:42:11 +00:00
Mihir Kandoi
3e0d0b2d68 fix: derive operation FG items before material expansion, keep the final one the BOM's item
The finished_good derivation ran in validate_semi_finished_goods,
after set_materials_based_on_operation_bom had already expanded
operation BOM materials. A single-pass insert-and-submit (API or
import) with bom_no set but finished_good empty skipped the expansion,
persisting a submitted BOM without the referenced components. The
derivation also let a final operation inherit another item from its
bom_no, so downstream job cards would produce the wrong item.

Move the derivation into set_operation_finished_goods, called before
the expansion, prefer the BOM's own item for the final operation, and
reject a final operation whose FG item is not the BOM's item.

(cherry picked from commit 1e2e87daac)

# Conflicts:
#	erpnext/manufacturing/doctype/bom/bom.py
2026-08-09 14:42:10 +00:00
Mihir Kandoi
b4eceeda2d test: raw material dialog adds a row for its operation despite duplicates
(cherry picked from commit 0aec62a8dd)
2026-08-09 14:42:10 +00:00
Mihir Kandoi
35f9bec988 fix: add raw material to its operation even when another operation uses the item
get_item_details returns the whole Item document, so the dialog row's
name became the item code. get_item_data then matched that item code
against every Components row regardless of operation, so adding an item
already used by another operation silently updated that row's qty
instead of appending one for the target operation — which stayed empty
and failed 'please add raw materials or set a BOM' on submit.

Match the existing row by item code within the same operation: same
operation updates the qty, any other match appends a new row.

(cherry picked from commit 24f1f3dea8)

# Conflicts:
#	erpnext/manufacturing/doctype/bom/bom.py
2026-08-09 14:42:10 +00:00
Mihir Kandoi
0de97159ea test: manufacture entry keeps process loss scoped to its own operation
(cherry picked from commit 5e0f056284)
2026-08-09 14:42:09 +00:00
Mihir Kandoi
a0b370b2e9 fix: scope manufacture entry process loss to its own job card
set_process_loss_qty stamped MAX(process_loss_qty) across every
operation of the work order onto each manufacture entry. With semi
finished goods tracking, one operation's process loss leaked into the
entries of every other operation: validate_fg_completed_qty then
rejected the entry when it had a BOM, or the wrong loss was recorded
silently when it did not, double-counting the loss across operations.

When the entry belongs to a job card, use that job card's loss net of
what its earlier entries already booked. The MAX fallback stays for
work-order level entries without a job card.

Fixes frappe/erpnext#57892

(cherry picked from commit 1b335973b7)

# Conflicts:
#	erpnext/stock/doctype/stock_entry/stock_entry.py
2026-08-09 14:42:09 +00:00
Mihir Kandoi
f58c0adbf5 test: previous operation shortfall from process loss gets the right message
(cherry picked from commit 335dbdaca4)
2026-08-09 14:42:09 +00:00
Mihir Kandoi
104c8df765 fix: stop asking for a manufacturing entry when process loss explains the shortfall
When a previous operation manufactured less than the current job card
is completing, the error always said 'Submit the manufacturing entry
for the operation first' — even when the entry was already submitted
and the missing quantity was booked as process loss, which made the
advice a dead end.

Sum the process loss of the previous operation's job cards alongside
the manufactured quantity. When manufactured + process loss covers the
requested quantity, say the shortfall is process loss so the user
knows to reduce the completed quantity; keep the submit-first message
for genuinely pending manufacturing entries.

(cherry picked from commit 1e22695eae)

# Conflicts:
#	erpnext/manufacturing/doctype/job_card/job_card.py
2026-08-09 14:42:08 +00:00
Mihir Kandoi
e822efe6a1 test: WIP warehouse required for work orders tracking semi finished goods
(cherry picked from commit f61f6523b9)

# Conflicts:
#	erpnext/manufacturing/doctype/work_order/test_work_order.py
2026-08-09 14:42:08 +00:00
Mihir Kandoi
24cd5f22b5 fix: require WIP warehouse for work orders tracking semi finished goods
Work orders with track_semi_finished_goods were exempt from the
Work-in-Progress Warehouse requirement in three places: the field's
mandatory_depends_on, the fg_warehouse reqd toggle in the form script,
and validate_warehouse on submit.

The exemption was misleading. The flow still transfers materials to a
WIP warehouse when 'Skip Material Transfer' is unchecked: operations
default their WIP warehouse from the work order, and
set_default_warehouse silently restores the company default after the
user clears the field. Make the field genuinely required instead of
pretending it is optional.

(cherry picked from commit 198eb60df7)
2026-08-09 14:42:08 +00:00
Mihir Kandoi
87e725e43b test: semi FG job card is exempt from the legacy transfer qty check
(cherry picked from commit 4b3904c6d7)

# Conflicts:
#	erpnext/manufacturing/doctype/job_card/test_job_card.py
2026-08-09 14:42:07 +00:00
Mihir Kandoi
99d9d845bd fix: don't demand raw material transfer for semi FG job cards on submit
validate_transfer_qty uses an empty finished_good to detect legacy job
cards, and unlike validate_semi_finished_goods it ignores
skip_material_transfer. A job card tracking semi finished goods whose
operation had no finished_good fell into the legacy branch and could
not be submitted even with 'Skip Material Transfer' checked on the
work order.

Return early for semi FG job cards; validate_semi_finished_goods
already enforces the transfer requirement for them and honours
skip_material_transfer.

(cherry picked from commit 6c8f0b9b56)
2026-08-09 14:42:07 +00:00
Mihir Kandoi
c23b16751e test: BOM tracking semi finished goods rejects operations without FG item
(cherry picked from commit aed7c70b1c)
2026-08-09 14:42:06 +00:00
Mihir Kandoi
03eeb839fb fix: require FG / Semi FG Item on operations when tracking semi finished goods
A BOM with track_semi_finished_goods enabled could be saved with no
finished_good on any operation: validate_semi_finished_goods only
checked that one row had 'Is Final Finished Good' set, and a list
containing None passed the emptiness check.

Such a BOM breaks every downstream step. The work order copies the
empty finished_good into its operations, job cards inherit it, and
Make Stock Entry finally fails with 'Item None not found' because the
manufacture entry has no production item.

Derive the finished good where it is unambiguous: an operation that
references a BOM produces that BOM's item, and the final operation
produces the BOM's own item. Otherwise require it on the row, since
each operation's job card books its output through it.

(cherry picked from commit 3497a6a6bf)
2026-08-09 14:42:06 +00:00
Mihir Kandoi
7d5c58b8d3 Merge pull request #57922 from frappe/mergify/bp/version-16-hotfix/pr-57917
fix(regional): rename Italy's duplicate Customer name fields (backport #57917)
2026-08-09 17:08:16 +05:30
Mihir Kandoi
6c8cb47984 Merge pull request #57923 from frappe/mergify/bp/version-16-hotfix/pr-57560
fix: handling negative grand total (backport #57560)
2026-08-09 16:59:48 +05:30
Mihir Kandoi
9820bb66fe chore: resolve conflict 2026-08-09 16:48:48 +05:30
Mihir Kandoi
51aecec598 fix(controllers): correct negative rate settings link
(cherry picked from commit 4089f138f2)
2026-08-09 11:16:00 +00:00
nishkagosalia
e657a7f19f fix: handling negative grand total
(cherry picked from commit 136f92db04)
2026-08-09 11:16:00 +00:00
Mihir Kandoi
f56867d843 fix(regional): rename Italy's duplicate Customer name fields
The Italy regional setup created Custom Fields first_name/last_name on
Customer. Since #46281 added standard quick-entry fields with the same
names, every Italian site carries duplicate field definitions:

- the setup wizard creates the duplicates silently because it skips
  validation, and any later Custom Field on Customer then raises
  UniqueFieldnameError (#50915)
- without the duplicates, creating an Italian company aborts inside
  install_country_fixtures; on MariaDB an interrupted fixture run
  persists Custom Field documents whose columns were never added, after
  which every Company insert fails with "Unknown column
  'fiscal_regime'" (#57215)

Re-land the rename from #50921 (reverted in #53409): the fields become
italy_customer_first_name/italy_customer_last_name and the e-invoice
template reads the new names. The migration patch runs only on sites
with Italy fixtures, re-runs them, explicitly syncs the schema of every
affected doctype (create_custom_fields skips unchanged fields, so its
own schema sync cannot restore missing columns), copies the old column
values wherever the new field is empty (also on sites that removed the
duplicate fields with the documented manual workaround), and deletes
the duplicate Custom Fields last so an interrupted run stays resumable.

The old insert_after anchor "salutation" no longer exists on Customer;
the renamed fields anchor after customer_type.

(cherry picked from commit 110d0a38a6)

# Conflicts:
#	erpnext/patches.txt
2026-08-09 11:15:31 +00:00
Mihir Kandoi
f6dc1251a3 Merge pull request #57919 from frappe/mergify/bp/version-16-hotfix/pr-57918
fix: sync open reference forms after Quality Inspection submit (backport #57918)
2026-08-09 16:15:25 +05:30
Mihir Kandoi
546def2c5a test: doc_update published for reference on Quality Inspection submit
(cherry picked from commit e8a6884d5e)
2026-08-09 10:35:17 +00:00
Mihir Kandoi
33eb6199d9 fix: sync open reference forms after Quality Inspection updates them
update_qc_reference() writes the QI link and bumps the reference
document's modified timestamp via raw db writes, which emit no realtime
event. A reference form (Purchase Receipt, Delivery Note, Stock Entry,
Job Card) still open in the browser keeps the old timestamp and fails
the timestamp conflict check on the next save/submit, forcing a manual
refresh after every QI submit/cancel/delete.

Calling notify_update() on the reference publishes the standard
doc_update event, so an open, unedited form silently reloads and syncs
its timestamp. get_lazy_doc skips child table loading since
notify_update only needs the parent row.

(cherry picked from commit 647452c95b)
2026-08-09 10:35:17 +00:00
MochaMind
bcf40ac318 chore: update POT file (#57916) 2026-08-09 10:04:19 +00:00
Mihir Kandoi
45cba4baef Merge pull request #57910 from frappe/mergify/bp/version-16-hotfix/pr-57876
fix: allow selecting a warehouse for new items in the update items dialog (backport #57876)
2026-08-09 13:11:22 +05:30
Mihir Kandoi
d8bbe865a8 fix: use stock settings for warehouse defaults 2026-08-09 13:01:00 +05:30
Mihir Kandoi
0f2284ec4f Merge pull request #57913 from frappe/mergify/bp/version-16-hotfix/pr-57911
fix: tolerate floating-point drift in sales team allocated percentage  (backport #57911)
2026-08-09 12:59:34 +05:30
Mihir Kandoi
c507d5f09b chore: resolve conflict 2026-08-09 12:49:07 +05:30
Mihir Kandoi
e0d39074be chore: resolve conflict 2026-08-09 12:39:39 +05:30
pandiyan
ee9026d62d test: sales team allocation totalling 100 in floating point
covers the case where the percentages are correct but the accumulated
sum is 100.00000000000001. two rows can never drift, since the second
reconstructs exactly as 100 - first, so the case needs three rows.

(cherry picked from commit 4afba94d1c)

# Conflicts:
#	erpnext/selling/doctype/sales_order/test_sales_order.py
2026-08-09 06:59:47 +00:00
pandiyan
39f15bb3e9 fix: tolerate floating-point drift in sales team allocated percentage
the total of allocated_percentage was compared to 100 with exact float
equality, so a correct allocation could be rejected when the sum drifts
in binary floating point (10.0 + 58.02 + 31.98 -> 100.00000000000001).

round the total to the field precision before comparing, in both
SellingController.calculate_contribution and Customer.validate.

(cherry picked from commit f7b2775829)
2026-08-09 06:59:47 +00:00
Pandiyan P
c9977be5d4 fix: allow selecting a warehouse for new items in the update items dialog (#57876)
(cherry picked from commit 55fe269046)

# Conflicts:
#	erpnext/accounts/services/child_item_update.py
#	erpnext/public/js/utils.js
2026-08-09 06:02:00 +00:00
Mihir Kandoi
a97beb6d9b Merge pull request #57908 from frappe/mergify/bp/version-16-hotfix/pr-57832
fix: validate webform for project (backport #57832)
2026-08-09 09:53:23 +05:30
Mihir Kandoi
a7648ad291 Merge pull request #57905 from frappe/mergify/bp/version-16-hotfix/pr-57903
fix: condition check with empty object for falsy case (backport #57903)
2026-08-09 09:44:42 +05:30
nishkagosalia
8d98fe8187 fix: validate webform for project
(cherry picked from commit 126966d1db)
2026-08-09 04:12:32 +00:00
Suhas Bharadwaj
838fb8e8df fix: condition check with empty object for falsy case
(cherry picked from commit e0b9351d49)
2026-08-08 18:49:06 +00:00
mergify[bot]
6b45002abc fix: set restrict_globals=True in frappe.render_template (backport #57899) (#57902)
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
2026-08-09 00:04:36 +05:30
rohitwaghchaure
ea5cbb116c feat: sync serial no status from stock ledger in Stock Qty vs Serial No Count report (version-16-hotfix) (#57864)
* feat: sync serial no status from stock ledger in Stock Qty vs Serial No Count report

* fix: pick last bundle move in SQL ordered by posting datetime and SLE creation

* fix: derive synced serial no status from stock ledger helper and validate sync args
2026-08-08 13:47:53 +00:00