Repository navigation
[API] Return stock item list when creating multiple items - #9857
Conversation
✅ Deploy Preview for inventree-web-pui-preview canceled.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #9857 +/- ##
==========================================
- Coverage 86.61% 86.60% -0.01%
==========================================
Files 1243 1243
Lines 54816 54850 +34
Branches 2230 2230
==========================================
+ Hits 47478 47504 +26
- Misses 6772 6780 +8
Partials 566 566
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| # Exclude 'serial' from submitted data | ||
| # We use 'serial_numbers' for item creation | ||
| data.pop('serial', None) | ||
|
|
There was a problem hiding this comment.
Just a heads up, I got burned by this change because my clients used the serial keyword when using this API to create a single stock item.
I have no problem updating my clients to use serial_numbers instead. However, serial still appears in the API documentation. I saw the release blog post mention the return type being a list, so I probably should have seen this coming, but I overlooked it. I may not be the only one hitting this, took me a second to find this change and determine that's why it stopped working.
Would the correct thing be to remove serial from the StockItemSerializer? Or would this have other unintended consequences?
There was a problem hiding this comment.
@jacobfelknor good question, and a fair point that we should address.
The behavior here is not well documented, as the serial field applies to the serial number for a single stock item, but the serial_numbers is a write-only (and only on initial item creation) that allows you to specify multiple serial numbers for creating multiple stock items.
/api/build/$buildId/complete/endpoint? #8539