magento / magento/inventory

Extra compensation reservation (inventory_reservation) in any update of credit memo

Open
#3,340 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Progress: ready for grooming
Dominant language
PHP
Stars
357
Forks
262
PR merge metrics
No merged PRs in 30d

Description

### Preconditions (*)

1. Magento 2.4.3-p1 with magento/module-inventory 1.2.1-p1
2. With small data: profiles/ce/small.xml

### Steps to reproduce (*)

1. Create a full Credit Memo with not checked Return to Stock for one of products (for example: sales_creditmemo.entity_id = 1)
2. It creates registers into inventory_reservation. For example #2 lines.
3. Programmatically update some date of Credit Memo (CustomerNote for example). Something like this:
$soyUnMemo = $objectManager->create('Magento\Sales\Model\Order\Creditmemo')->load('1');
$soyUnMemo->setCustomerNote('Hi');
$soyUnMemo->save();

### Expected result (*)

1. The count of registers on inventory_reservation should be 2

### Actual result (*)

1. The count of registers on inventory_reservation is 4
2. And each time that we update Programmatically the credit memo, it adds two additional ones: 2->4->6->8
3. Each time, the salable qty is changing

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Magento\Sales\Model\Order\Creditmemo save flow and the inventory_reservation records created when a full credit memo is saved. Reproduce the update using the provided CustomerNote example and inspect the reservation count after each save. Done means updating the credit memo no longer adds duplicate reservations or changes salable quantity.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.