Gnomeshade
Gnomeshade copied to clipboard
Adding purchases from receipt fails when a product with the same name is deleted
Describe the bug
Importing purchases from a receipt fails with internal server error due to duplicate key value violates unique constraint "products_normalized_name"
when no matching product is found, but a product with the same name was created before and deleted.
To Reproduce Steps to reproduce the behavior:
- Import purchases from a receipt
- Replace one of the products with a different one, delete the original
- Try to import the same receipt again in a different transaction
- See error
Expected behavior The easy solution would be to restore the deleted product. However, I guess the expected behavior would be that product is replaced with the same on as before. That would require adding additional data to products, something like alternative names. That would allow to link names provided by the store in the receipts to be linked to the ones used in the app by the user.