Hi All,
I found a weird bug (I think) when submit Stock Entry - Repack via API POST call with Serial Number on its items. When the error occur we can not do another stock entry api call until we done repack to its own item, then we likely manage to successfully submit the first one.
Example Stock Entries:
with target:
- purpose repack, from full unit into parts, which items:
- Item-A, SN-Item-A (from full blown unit)
- Item-b; SN-Item-A (into parts 1, the serial number follows this part)
- Item-c (into parts 2)
- Item-d (into parts 3)
=> result: 417-Expectation Failed; message: SerialNoItemError (Serial No SN-Item-A does not belong to Item Item-b)
when error workaround:
2. do repack again on its own, from full unit into it self, which items:
- Item-A, SN-Item-A (from full blown unit)
- Item-A, SN-Item-A (into it self)
=> result: 200-OK
after do number 2, then return to do number 1 again:
=> result: 200-OK
I’ve checked into the database related tables and the number 2 process just replace the serial number item purchase detail purchase_document_no
(MAT-STE from Purchase Receipt / others) into the new one (MAT-STE from Stock Entry Repack purpose).
Also I’ve checked the related validation code at Github erpnext/erpnext/stock/doctype/serial_no/serial_no.py
, but I don’t understand:
https://github.com/frappe/erpnext/blob/aed45f22f4045a417111ec7a53e2cea675cec96d/erpnext/stock/doctype/serial_no/serial_no.py#L392
https://github.com/frappe/erpnext/blob/aed45f22f4045a417111ec7a53e2cea675cec96d/erpnext/stock/doctype/serial_no/serial_no.py#L253
ERPNext: v13.13.0 (version-13 | docker)
Frappe Framework: v13.13.0 (version-13 | docker)
Thank you, keep up the good work & stay safe…