Commit Graph

58787 Commits

Author SHA1 Message Date
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
Diptanil Saha
f0adbd2bd3 fix(journal_entry): validation message for blocked purchase invoice (#57896) 2026-08-08 13:36:05 +00:00
Mihir Kandoi
d3e0b1041b Merge pull request #57890 from mihir-kandoi/backport-57887-v16
fix: repost read stale sibling SLE rate for moving average returns (backport #57887)
2026-08-08 12:02:40 +05:30
Mihir Kandoi
43e1e70199 Merge pull request #57889 from frappe/mergify/bp/version-16-hotfix/pr-57886
fix: incorrect entry detection in Stock Ledger Invariant Check (backport #57886)
2026-08-08 11:14:13 +05:30
Mihir Kandoi
81f81fff32 fix: zero-rate repost fallback could still read sibling SLE
When the in-memory running rate is zero, the fallback went through
get_incoming_rate, whose previous-SLE lookup matches the same
posting_datetime and can land on a sibling line of the voucher being
replayed. Replace it with get_previous_sle_of_current_voucher excluding
the current voucher, keeping the get_valuation_rate chain when no
previous entry exists. get_incoming_rate is no longer used in this
module.
2026-08-08 11:12:02 +05:30
Mihir Kandoi
4571a8fa14 test: repost of multi-line moving average return is idempotent
Reposting a return that removes most of the stock across several lines
of the same item must keep every line at the running average and produce
identical results on a second repost. Before the fix the first repost
already drifted, seeding each line from a sibling row of the same
voucher.
2026-08-08 11:12:02 +05:30
Mihir Kandoi
ffa65b0c48 fix: repost read stale sibling SLE rate for moving average returns
During repost, a return line with recalculate_rate resolved its moving
average rate through get_incoming_rate -> get_previous_sle, which matches
posting_datetime <= and orders by creation desc. For a multi-line return
of the same item, every line shares one posting_datetime, so the query
landed on a sibling line of the same voucher whose stored valuation_rate
was still the previous repost run's output, not the rate before the
voucher.

Each repost run therefore re-seeded the voucher from its own prior
output. The error gain per run is (qty returned at the stale rate) /
(qty remaining after the return), so whenever a return removes most of
the stock the loop diverges instead of converging, alternating sign and
growing until stock_value overflows decimal(21,9) and the repost dies
with 'Out of range value for column stock_value'.

Use the in-memory running valuation rate that update_entries_after
already tracks for the warehouse at this point in the repost. It is the
authoritative pre-entry state, is immune to sibling rows, and makes the
repost idempotent. The database lookup is kept only as a fallback for a
zero in-memory rate, preserving the existing zero-rate fallback chain.
2026-08-08 11:12:02 +05:30
Mihir Kandoi
f7bae888cf fix: incorrect entry detection in Stock Ledger Invariant Check (#57886)
(cherry picked from commit b3f97cd389)
2026-08-08 05:32:11 +00:00
Mihir Kandoi
be0c505972 Merge pull request #57884 from frappe/mergify/bp/version-16-hotfix/pr-57873
fix: declare precision 9 on all conversion_factor fields (backport #57873)
2026-08-07 23:00:15 +05:30
Mihir Kandoi
dbfe7e199e fix: add type hints to conversion factor API 2026-08-07 22:47:17 +05:30
Mihir Kandoi
2cd8e39f04 chore: resolve conflict 2026-08-07 22:28:30 +05:30
Mihir Kandoi
206ed28924 fix: round computed conversion factors to field precision
The inverse (1 / value) and intermediate-UOM branches of
get_uom_conv_factor returned raw float quotients like
0.4535922921968971, bypassing the precision the docfields now declare.
Same for the client-side back-calculation from an edited stock qty.
Round both to the UOM Conversion Factor value precision.

(cherry picked from commit ca5a673409)
2026-08-07 16:51:40 +00:00
Mihir Kandoi
db49b03913 fix: declare precision 9 on all conversion_factor fields
The Float control parses values with the field precision, falling back
to the global float precision when the docfield declares none
(frappe ControlFloat.parse / get_precision). On a site with float
precision 2, a fetched UOM factor of 0.453592292 was written back to
the model as 0.45, silently corrupting every derived quantity by 0.8
percent. A ratio must not inherit display precision meant for
quantities, so declare the same precision 9 the UOM Conversion Factor
master already uses on every transaction-level conversion_factor
field.

(cherry picked from commit 69a35a12cb)

# Conflicts:
#	erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json
#	erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
#	erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
#	erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.json
#	erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.json
#	erpnext/selling/doctype/quotation_item/quotation_item.json
#	erpnext/selling/doctype/sales_order_item/sales_order_item.json
#	erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
#	erpnext/stock/doctype/packed_item/packed_item.json
#	erpnext/stock/doctype/pick_list_item/pick_list_item.json
#	erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
#	erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
#	erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json
#	erpnext/subcontracting/doctype/subcontracting_receipt_supplied_item/subcontracting_receipt_supplied_item.json
2026-08-07 16:51:40 +00:00
Shllokkk
83a0a1c687 Merge pull request #57882 from frappe/mergify/bp/version-16-hotfix/pr-57880
fix: guard reconciliation table deletes when tables are missing (backport #57880)
2026-08-07 20:50:10 +05:30
Shllokkk
21fbfa541d fix: guard reconciliation table deletes when tables are missing
(cherry picked from commit 8a2b2a2b68)
2026-08-07 14:35:21 +00:00
Mihir Kandoi
08af36d86e Merge pull request #57870 from frappe/mergify/bp/version-16-hotfix/pr-57866
fix: optimize product bundle item search (backport #57866)
2026-08-07 16:11:03 +05:30
Mihir Kandoi
693cade177 chore: resolve conflict 2026-08-07 16:07:36 +05:30
Krishna Shirsath
29349711e4 fix: optimize product bundle item search
(cherry picked from commit b3867f1428)

# Conflicts:
#	erpnext/selling/doctype/product_bundle/product_bundle.js
2026-08-07 10:33:43 +00:00
Diptanil Saha
eb7dfa1337 Merge pull request #57846 from diptanilsaha/backport/57825
refactor(accounts)!: rework Purchase Invoice hold actions and enforce them on Journal Entry (backport #57825)
2026-08-07 15:06:59 +05:30
Mihir Kandoi
e1473140cc Merge pull request #57852 from frappe/mergify/bp/version-16-hotfix/pr-57851
fix: round Production Plan mr_items quantity to field precision (backport #57851)
2026-08-07 03:24:10 +05:30
Mihir Kandoi
460fe9af3e chore: resolve conflict 2026-08-06 21:32:24 +05:30
Mihir Kandoi
9f8aa3cf1b test: remaining purchase qty is rounded to field precision
Covers the _add_remaining_purchase_request path: partial stock in
another warehouse is allocated as a transfer and the residual purchase
qty goes through the second rounding site.

(cherry picked from commit 75145cc72c)
2026-08-06 15:41:41 +00:00