[16.0][FIX] shopfloor_reception: clearer error message in case of gs1 scan for a product without barcode#1197
Conversation
…for a product without barcode
|
Hi @mmequignon, @JuMiSanAr, |
jbaudoux
left a comment
There was a problem hiding this comment.
My suggestion was to fill-in the screen with the scanned data even if you could not match a product with the barcode. Because the screen to set the product data like the barcode comes after the set lot screen. But we should invert those screens so that you can set the product barcode then you should not face the issue in set lot that the product has no barcode (unless you don't have the module to collect product data).
I think if you cannot confirm it's the wrong product because the scanned product barcode doesn't exist in odoo and the selected line product has no barcode, you should consider the product is right and fill the data.
| message = ( | ||
| self.msg_store.lot_product_mismatch() | ||
| if selected_line.product_id.barcode | ||
| else self.msg_store.lot_has_barcode_but_product_missing() |
There was a problem hiding this comment.
If I have a result of type "product", it means I scanned a barcode that matched an existing product.
If I cannot match a product, I should not enter here, isn't it?
| "The scanned lot contains a barcode but you have no " | ||
| "barcode for this product in Odoo.", |
There was a problem hiding this comment.
Maybe also display the barcode in the message?
| "The scanned lot contains a barcode but you have no " | |
| "barcode for this product in Odoo.", | |
| "The scanned lot contains a product barcode but you have no " | |
| "product with this barcode in Odoo.", |
| self.selected_move_line.product_id.sudo().barcode = False | ||
|
|
||
| expiration_date = date(2022, 7, 2) | ||
| other_product_barcode = "01223334444555" |
There was a problem hiding this comment.
Can you split in 2 test cases:
- assert there is no product with this barcode => lot_has_barcode_but_product_missing
- assert there is a another product with this barcode => lot_product_mismatch
In both cases, self.lot exists
| if search_result.type == "lot": | ||
| existing_lot = search_result.record | ||
| if not existing_lot: | ||
| existing_lot = search.lot_from_scan(lot_name, selected_line.product_id) |
There was a problem hiding this comment.
When an expiration date is matched, what is the search_result?
To be sure it's not rerunning a seach while there is already the lot in the results.
The above lot_name = result.value is the lot or its barcode? I would expect result.raw to be the barcode. Is this redoing a useless second search?
When scanning a GS1, we parse the GS1 data to ensure the product on the GS1 matches the barcode we have in odoo.
However, when we do not have a barcode for the given product in odoo, the error message was confusing -> Created a clearer error message
cc @jbaudoux