Commit Graph

58797 Commits

Author SHA1 Message Date
Mihir Kandoi
e42a59c5d4 Merge pull request #57933 from frappe/mergify/bp/version-16-hotfix/pr-57687
fix(job_card): reject a completion split that cannot add up (backport #57687)
2026-08-09 22:31:48 +05:30
Mihir Kandoi
cc07918f06 Merge pull request #57936 from frappe/mergify/bp/version-16-hotfix/pr-57686
fix(job_card): leave the pending qty out of the job card's own output (backport #57686)
2026-08-09 22:12:24 +05:30
Mihir Kandoi
66aa97f7fe chore: update backport after dependent merges 2026-08-09 22:02:11 +05:30
Mihir Kandoi
4e8c2c7d37 Merge pull request #57935 from frappe/mergify/bp/version-16-hotfix/pr-57685
fix(job_card): apply the completion dialog's qty to manufacture (backport #57685)
2026-08-09 21:59:06 +05:30
Mihir Kandoi
816e21cf60 Merge pull request #57931 from frappe/mergify/bp/version-16-hotfix/pr-57684
fix(job_card): require the previous operation to be manufactured (backport #57684)
2026-08-09 21:58:48 +05:30
Mihir Kandoi
317dd18ce5 fix(manufacturing): align quantity split rounding 2026-08-09 21:43:00 +05:30
Mihir Kandoi
beed05ac18 test(manufacturing): isolate quantity split validation 2026-08-09 21:08:57 +05:30
Mihir Kandoi
1ededb70f4 chore: resolve conflict 2026-08-09 20:53:27 +05:30
Mihir Kandoi
c955f80675 chore: resolve conflict 2026-08-09 20:50:50 +05:30
Mihir Kandoi
f176a46722 chore: resolve conflict 2026-08-09 20:43:30 +05:30
Mihir Kandoi
7fcfea6db2 chore: resolve conflict 2026-08-09 20:42:02 +05:30
Mihir Kandoi
0c7919429e fix(job_card): leave the pending qty out of the job card's own output (#57686)
* fix(job_card): leave the pending qty out of the job card's own output

Pending qty is the part of a job card handed over to another job card, but the
status and the manufacturing entry still measured the card against its full
for_quantity. A card submitted with 3 completed and 2 pending was stuck at Work
In Progress with no way to change it, and its manufacturing entry was built for
the full 5.

Measure both against for_quantity minus pending qty, so the card reaches To
Manufacture on submission, its manufacturing entry covers the completed qty, and
it is Completed once that qty is manufactured.

* test(job_card): cover a job card completed with a pending qty

(cherry picked from commit 970039d8ec)

# Conflicts:
#	erpnext/manufacturing/doctype/job_card/job_card.py
#	erpnext/manufacturing/doctype/job_card/test_job_card.py
2026-08-09 15:03:18 +00:00
Mihir Kandoi
d97cf131a1 fix(job_card): apply the completion dialog's qty to manufacture (#57685)
* fix(job_card): apply the completion dialog's qty to manufacture

Both the desk dialog and the shop floor session dialog send for_quantity when
completing a job card, but complete_job_card dropped it. Reducing Qty to
Manufacture to 3 on a job card of 5 left for_quantity at 5, so set_process_loss
turned the untouched 2 into process loss on the next save.

The dialog qty covers the current cycle, so add it to the qty already completed
by the earlier cycles of the job card instead of overwriting for_quantity, and
validate the pending qty against the result.

* test(job_card): cover qty to manufacture from the completion dialog

Reducing the dialog qty resizes the job card without inventing process loss, and
a pending qty split across two cycles leaves for_quantity untouched.

(cherry picked from commit 0e1bc58b2e)

# Conflicts:
#	erpnext/manufacturing/doctype/job_card/job_card.py
2026-08-09 15:02:47 +00:00
Mihir Kandoi
3907d93f9f fix(job_card): reject a completion split that cannot add up (#57687)
* fix(job_card): reject a completion split that cannot add up

The completion dialogs silently dropped a recalculation whose result went
negative, so entering a pending qty larger than what is left of the qty to
manufacture kept the contradiction (3 to manufacture, 3 completed, 2 pending)
and the job card only failed much later, on submission.

Keep the split consistent while it is entered: reset the pending qty when the
qty to manufacture changes, and refuse a completed, pending or process loss qty
that leaves the others negative. complete_job_card validates the same rule, so
the shop floor and the API cannot store a split that will never submit.

Also name the three parts in the submission error instead of calling their sum
the Total Completed Qty, which read as a contradiction of the field itself.

* test(job_card): cover the completion qty split guard

(cherry picked from commit 7bffd84482)

# Conflicts:
#	erpnext/manufacturing/doctype/job_card/job_card.py
#	erpnext/manufacturing/doctype/job_card/test_job_card.py
#	erpnext/public/js/shop_floor/shop_floor.js
2026-08-09 15:01:38 +00:00
Mihir Kandoi
a22a7fddba fix(job_card): require the previous operation to be manufactured (#57684)
* fix(job_card): block next operation until previous operation is manufactured

With track semi finished goods, Work Order Operation completed_qty is set from
the submitted job cards' total completed qty, so a job card of the next
operation could be started and completed even when no Manufacture entry existed
for the previous operation. The semi-finished goods it consumes were never
produced.

Validate the sequence against the qty actually manufactured against the previous
operations' job cards (Manufacture entries / Subcontracting Receipts) when the
work order tracks semi finished goods.

* test(job_card): cover manufactured qty check across previous operations

Work order with operations A and B at sequence 1 and C at sequence 2, tracking
semi finished goods. C stays blocked while A's job card is submitted but its
Manufacture entry is missing, and once A is manufactured for 3, C can only be
completed for 3.

(cherry picked from commit 3bd3354152)

# Conflicts:
#	erpnext/manufacturing/doctype/job_card/job_card.py
#	erpnext/manufacturing/doctype/job_card/test_job_card.py
2026-08-09 14:42:47 +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