Skip to content

fix(stock): allow serial no of consumed raw material on repacked item (backport #59729) - #59738

Merged
rohitwaghchaure merged 2 commits into
frappe:version-15-hotfixfrom
barredterra:backport-59729
Oct 2, 2026
Merged

rohitwaghchaure merged 2 commits into
frappe:version-15-hotfixfrom
barredterra:backport-59729

Conversation

@barredterra

@barredterra barredterra commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Backport of #59729 to v15.

In a Repack or Manufacture entry, the finished good can keep the serial no of a consumed raw material. Example: a notebook gets a case. "Notebook" and "Case" are consumed, "Notebook with Case" is produced, and it keeps the serial no of the notebook, because it is the same physical unit.

This worked in v14 (allow_serial_nos_with_different_item()). The exception was lost when the Serial and Batch Bundle was introduced. Now the bundle rejects the serial no with "Serial Nos ... does not belong to Item ...".

Changes

  • Validation: An inward bundle of a Repack or Manufacture entry accepts a serial no of another item if an outward bundle of the same entry consumes it, and no other inward bundle of the entry takes it. All other cases still fail.
  • Serial No: When a serial no lands in a warehouse, it moves to the item of the inward entry. The fields Item Name, Description, Item Group and Brand are updated too. Batch No is cleared if the new item has no batches. Cancelling the entry moves the serial no back, because the stock ledger entries are cancelled in reverse order.

Not backported: the changes to the Serial No and Batch Traceability report. This report does not exist in v15.

Behaviour to know

  1. The setting Allow existing Serial No to be Manufactured/Received again in Stock Settings must stay enabled (default). Otherwise the finished good is rejected, because the serial no was already used in an outward entry (the consumption in the same entry).
  2. A backdated transaction of the raw material, dated before the Repack, fails with "Serial No ... is not present in the warehouse". The future-entry check blocks it anyway.
  3. Cancellation follows the existing future-entry checks. You cannot cancel the Repack while a later transaction uses the serial no under the finished good. You cannot cancel the receipt of the raw material while the Repack exists.
  4. Valuation is not affected. It uses the item and warehouse of each Serial and Batch Entry, so the finished good gets its value from the Repack.
  5. Documents that already link the serial no with the raw material, for example a Maintenance Schedule, keep the old item. If such a document is saved again, it fails with "Serial No ... does not belong to Item ...".
  6. The serial no selector and the barcode scan filter by the current item. Before submit, the serial no still belongs to the raw material, so you enter it in the finished good row by hand or with the serial no text field.
  7. A Manufacture entry against a Work Order that creates serial nos for the finished good fills in new serial nos. Replace them with the consumed serial no if you want to keep it.

Tests

  • Repack the serial no of a raw material into a finished good: the item, item fields, warehouse, status and valuation are correct. Cancel is blocked while a later entry uses the serial no. After the later entry is cancelled, cancelling the Repack restores the raw material.
  • A receipt of the finished good with the serial no of another item still fails.
  • One consumed serial no cannot go to two finished goods in the same entry.

Follow-up with fixes from later review findings: #59741

no-docs

In a Repack or Manufacture entry, the finished good can keep the serial
no of a consumed raw material, because it is the same physical unit.
This worked in v14 and was lost with the Serial and Batch Bundle.

The bundle validation now accepts a serial no of another item if an
outward bundle of the same entry consumes it. When the serial no lands
in a warehouse, it moves to the item of the inward entry, together with
item name, description, item group and brand. Cancelling the entry moves
it back.
@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Changes serial number validation and ownership in stock transactions.

The PR appears safe to merge based on this review.

Reviews (2) · Last reviewed commit: "fix(stock): allow a consumed serial no o..."

A Repack could consume one serial no and give it to two finished goods.
The bundle validation now rejects a consumed serial no if another inward
bundle of the same entry already takes it.
@rohitwaghchaure
rohitwaghchaure merged commit b648332 into frappe:version-15-hotfix Oct 2, 2026
13 checks passed
@rohitwaghchaure

Copy link
Copy Markdown
Collaborator

@Mergifyio backport version-15

@mergify

mergify Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

backport version-15

✅ Backports have been created

Details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants