Files
odoo_source/addons/stock/static
Hubert Van De Walle f7e6523bd7 [FIX] stock: prevent opening SM when picking is dirty
Steps to reproduce
==================

- Create two new storable products tracked by USN
- Create a new RFQ with one of the created product
- Confirm the order
- Open the receipt
- Add a new line with the other product
- Click on the open move button in the new line
- Add a new SN
- Save & close

=> Cannot read properties of undefined (reading 'resId')

Cause of the issue
==================

When calling openRecord, if the record is dirty, it is saved before
proceeding.

After saving, we call super.openRecord with the old record.
Since that record is no longer linked to the root record (the
stock.picking), when we try to save it, it won't match an existing id.

Solution
========

If the record is new, we don't save as there would be no way of knowing
which of the returned line would come from this one.

If we are opening an existing record, we find the new datapoint by
matching it's ID.

opw-3777615

closes odoo/odoo#162425

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2024-04-19 11:09:27 +00:00
..
…
…