Commit Graph

2826 Commits

Author SHA1 Message Date
rohitwaghchaure
d07f4bb857 feat: percentage based BOM (#58292)
* feat: percentage based BOM, fixed qty components and component qty tolerance

* fix: mandatory percentages, fixed qty explosion keys and expected qty aggregation

* fix: percentage BOM incompatible with semi FG tracking, fixed qty in production plan explosion

* refactor: remove component_qty_tolerance from Manufacturing Settings

* refactor: drop fixed qty components and consumption tolerance, keep percentage-based BOM only
2026-08-19 17:03:20 +05:30
Diptanil Saha
25dfcb17c8 fix: escape on status image for workstations in production status (#58279) 2026-08-18 17:58:23 +00:00
diptanilsaha
93d6ccd041 refactor: build document links with get_form_link in form scripts 2026-08-18 22:49:47 +05:30
diptanilsaha
cfb664804c refactor: build document links with get_form_link in report formatters 2026-08-18 22:49:45 +05:30
diptanilsaha
79284d8430 fix: escape item and document values in manufacturing preview templates 2026-08-18 22:49:39 +05:30
rohitwaghchaure
b68324ce78 fix: work order finish dialog with process loss qty from job card (#58256)
* fix(manufacturing): cap job card completed qty by previous operation and show process loss on finish dialog

* fix: revert job card finish dialog changes
2026-08-18 13:26:56 +05:30
Pandiyan P
1fa057b943 fix: skip covered rows when ordering from the mrp report (#58249)
* test: cover the rows that have nothing left to order in the mrp report

a row whose requirement is already met by stock or by an order placed earlier
fails the order it is selected for, takes the rows beside it down with it, and
what rounding leaves behind of it is ordered as if it were a real quantity. the
work order made from a row of the schedule also has to keep the work in progress
warehouse the company keeps for it.

* fix: skip covered rows when ordering from the mrp report

a row whose requirement is already met by stock or by orders that were placed
earlier nets down to a required qty of zero. making an order from it threw
"Qty To Manufacture cannot be 0", and since nothing caught it, none of the other
selected rows were created either. such rows are now left alone, and selecting
only covered rows says so instead of failing.

the quantity ordered stays the one that is still needed. taking the planned qty
instead would order everything that stock and the open orders already cover. it
is read at the precision an order stores it in, so what is left of a covered row
after all the subtracting does not become an order line of its own.
2026-08-18 11:22:18 +05:30
rohitwaghchaure
1f83906189 fix: don't set work order status to In Process only due to skip material transfer (#58244) 2026-08-17 18:29:24 +05:30
Mihir Kandoi
baa20e5e49 fix(manufacturing): preserve attribution through consumption (#58146)
* fix(manufacturing): preserve attribution through consumption

* fix(manufacturing): preserve consumed quantity matching

* fix(manufacturing): assign consumption once
2026-08-17 09:57:57 +00:00
Pandiyan P
4dc0b2ea52 fix(manufacturing): fall back to item group defaults for work order warehouses (#58231) 2026-08-17 08:06:01 +00:00
rohitwaghchaure
e5c24fb398 feat: cross-plan load and overlap validation in production plan scheduling (#58127)
* feat: cross-plan load and overlap validation in production plan scheduling

* fix: row-level job card exclusion and locking read in schedule overlap check

* fix: operation-level job card exclusion and workstation locking in capacity check

* fix: keep plan schedule load when job cards carry no booked time

* fix: qty-coverage based job card exclusion for plan schedule load
2026-08-14 10:24:48 +00:00
Mihir Kandoi
eae6d10304 fix(manufacturing): preserve alternative material attribution (#58131) 2026-08-14 03:44:39 +00:00
Mihir Kandoi
1534e2fad6 fix(manufacturing): derive material transfers from actual coverage (#58110) 2026-08-13 15:06:03 +05:30
rohitwaghchaure
c6d08979d3 feat: capacity aware scheduling for production plan (#58094)
* feat: capacity aware scheduling for production plan

* fix: do not apply incomplete schedule proposals

* fix: lock plan re-scheduling once work orders exist

* test: concurrent jobs across multiple machines with job capacity

* chore: fix linter and semgrep issues

* fix: readable subject for production plan schedule entries

* fix: persist computed start for item rows without explicit dates

* fix: block manual creation of production plan schedule entries

* chore: replace em-dashes with hyphens in design doc

* fix: cleared item-wise dates no longer constrain the schedule

* chore: format test file
2026-08-12 12:40:03 +00:00
Mihir Kandoi
43de54b907 fix(work order): exclude corrective transfers from item-level transferred qty (#58091) 2026-08-12 11:11:12 +00:00
Mihir Kandoi
e5a0b5f61e fix(manufacturing): refine corrective job cards (#58079) 2026-08-12 10:13:29 +00:00
Mihir Kandoi
68a30f1568 fix(work order): don't count corrective job card transfers as transferred qty (#58080) 2026-08-12 15:35:55 +05:30
Mihir Kandoi
5ad085887d fix(manufacturing): keep MRP chart dates distinct 2026-08-12 12:28:13 +05:30
Mihir Kandoi
592924cc0d test(manufacturing): cover MRP chart date range 2026-08-12 11:39:53 +05:30
soulxone
3c17a604be fix(Material Requirements Planning Report): detailed-view chart timescale
The detailed-view chart collapsed every row into a single "today" column
and was additionally capped at 10 points, so the chart never matched the
report's date filters or the table data.

Two causes in get_detailed_view_chart_data:

1. `row.deliver_date` was a typo for `row.delivery_date` (the name used
   everywhere else in this report). On a frappe._dict the missing
   attribute resolves to None, so `getdate(None)` returned today and the
   past-date filter silently compared every row against today instead of
   its own delivery date.

2. A hard `if i == 10: break` truncated the chart to 10 date buckets.

Use the correct field name and drop the cap. The null check now runs
before the date comparison, since `getdate(None)` returning today meant
the original ordering could never filter a null delivery_date out.

Fixes #52632
2026-08-11 11:55:49 -05:00
Mihir Kandoi
439eb250f5 fix(manufacturing): preserve BOM Creator item details 2026-08-11 20:40:30 +05:30
Smit Vora
4c5d54096f Merge pull request #57965 from ljain112/set-missing-values
fix: run set_missing_values before creating Purchase Order from MRP report
2026-08-11 15:46:28 +05:30
Mihir Kandoi
575f34e7c6 Merge pull request #58016 from mihir-kandoi/fix-job-card-operation-row-id
fix: preserve original operation idx in manually created Job Cards
2026-08-11 14:19:25 +05:30
Mihir Kandoi
cb7201cc18 fix: preserve original operation idx in manually created Job Cards
The Create Job Card dialog on Work Order lists only pending operations,
so the row idx sent to make_job_card is the dialog's position, not the
Work Order Operation idx. create_job_card stamped that dialog idx into
operation_row_id, and get_required_items then matched raw materials of
whichever operation held that idx originally.

Resolve idx server-side from the Work Order Operation row that
get_operation_details already looks up by name.

Fixes https://github.com/frappe/erpnext/issues/57985
2026-08-11 14:05:21 +05:30
Mihir Kandoi
148d6aad5f Merge pull request #58009 from mihir-kandoi/require-transfer-before-job-card-start
fix: require material transfer before job card start and completion
2026-08-11 13:31:05 +05:30
Mihir Kandoi
fee2672bf9 Merge pull request #58000 from mihir-kandoi/restore-operations-completed-check
fix: reinstate operations completed check for manufacture entries
2026-08-11 13:25:04 +05:30
Mihir Kandoi
e9533495fc fix: keep job card actions visible for corrective job cards
Corrective job cards regenerate required items but are exempt from the
transfer gate on the server; mirror that exemption in materials_ready.
2026-08-11 13:18:55 +05:30
Mihir Kandoi
c95705dc64 test: job card start and completion blocked until material transfer 2026-08-11 13:14:38 +05:30
Mihir Kandoi
808b2e2984 fix: require material transfer before job card start and completion
When the work order transfers material against Job Card, the Start Job
and Complete Job actions (and the whitelisted start_timer and
complete_job_card methods behind them) accepted work before any
Material Transfer for Manufacture existed; the transfer gate only fired
on job card submission.

Run validate_transfer_qty on both actions, and drop the finished_good
escape in materials_ready so the dashboard hides the buttons while
transfer is pending. Job cards that skip material transfer, corrective
job cards, and work orders transferring against Work Order are exempt,
as on submit.
2026-08-11 13:08:33 +05:30
Mihir Kandoi
3704d1513b Merge pull request #57963 from frappe/codex/fix-bom-explorer-quantities
fix(manufacturing): correct nested BOM Explorer quantities
2026-08-11 12:56:08 +05:30
Mihir Kandoi
fe8bedef93 Merge pull request #57997 from kaulith/fix/bom-item-query-barcode-search
fix: keep item code searchable when a barcode matches the same text
2026-08-11 12:12:07 +05:30
Mihir Kandoi
2d022ffb66 test: manufacture entry blocked until operations are completed 2026-08-11 12:11:19 +05:30
Kaushal Shriwas
23024d1ea9 test(manufacturing): cover BOM item search when item code collides with a barcode 2026-08-11 11:58:36 +05:30
Kaushal Shriwas
bf5d506637 fix(manufacturing): keep item code searchable when a barcode matches the same text 2026-08-11 11:58:33 +05:30
Mihir Kandoi
3cffeb68e3 refactor: drop redundant time_in_mins assignment in complete_job 2026-08-11 11:56:13 +05:30
pandiyan
422a9161dd fix: convert hours to minutes in workstation complete_job
`time_diff_in_hours` returns hours, so `time_in_mins` needs `* 60`, not
`/ 60`. Matches `Job Card.validate_time_log_row`.

No behaviour change: the `doc.save()` on the next line runs Job Card's
`validate`, which recomputes `time_in_mins` correctly before the row is
written. This only stops the expression from reading as a bug.
2026-08-10 16:02:39 +05:30
ljain112
94d363851f fix: run set_missing_values before creating Purchase Order from MRP report 2026-08-10 14:11:41 +05:30
Mihir Kandoi
bf9744e145 fix(manufacturing): correct nested BOM quantities 2026-08-10 13:25:38 +05:30
Mihir Kandoi
fe09f45ca7 Merge pull request #57895 from mihir-kandoi/fix-track-sfg-finished-good
fix: track semi finished goods production flow
2026-08-09 20:11:05 +05:30
pandiyan
24de81f9fa test: work order process loss for semi finished goods
Cover both shapes: a single operation that books the loss itself, and a
chain where an earlier operation books it and the final operation loses
nothing, so the sum over the operations is the only correct source.
2026-08-09 09:45:49 +05:30
pandiyan
0eb61c9fac fix: roll up process loss to the work order for semi finished goods
update_work_order_qty() returns early when track_semi_finished_goods is
enabled, so set_process_loss_qty() never ran and Work Order.process_loss_qty
stayed at zero even though the job cards and the work order operations had
booked the loss. The work order also never reached the Completed status,
since that needs produced_qty + process_loss_qty to cover the ordered qty.

Calling set_process_loss_qty() from that early return is not enough: the
final operation has no semi finished good bom, so its manufacture entry is
not from a bom, remove_fg_completed_qty() zeroes fg_completed_qty and
update_work_order_qty() is never reached at all.

The manufacture entries cannot be summed either. Each one is reset to
MAX(Work Order Operation.process_loss_qty), so every entry of a multi
operation chain carries the running maximum instead of the loss of its own
operation. Aggregate the operations instead, and refresh the work order from
the job card, which is where the operation loss is written.
2026-08-09 09:45:49 +05:30
Mihir Kandoi
1478e2a4cb test: transfer qty exemption only applies when material transfer is skipped 2026-08-08 17:37:42 +05:30
Mihir Kandoi
1deae664ce 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.
2026-08-08 17:37:42 +05:30
Mihir Kandoi
8f0617c834 test: partial entries consume exactly the job card's material requirement 2026-08-08 17:37:42 +05:30
Mihir Kandoi
424a1dfa87 test: update-after-submit save keeps the manufacture entry intact 2026-08-08 17:37:42 +05:30
Mihir Kandoi
db99657c47 test: target warehouse stays optional for semi FG work orders 2026-08-08 17:37:42 +05:30
Mihir Kandoi
9df527bf3f 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.
2026-08-08 17:37:42 +05:30
Mihir Kandoi
eb7537c8df test: partial manufacture entry then finishing the job card 2026-08-08 17:37:42 +05:30
Mihir Kandoi
b8dd886cd4 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.
2026-08-08 17:37:03 +05:30
Mihir Kandoi
7157e4357b test: stale manufacture draft cannot over-produce without an operation BOM 2026-08-08 17:37:03 +05:30