Tuesday, December 31, 2024
1 change · saas-17.4
Resolved issues and error corrections
Fixed an issue where scanning an employee badge in the shop floor could cause an error instead of adding the employee. The scan now correctly sets the employee as the session owner and closes the add-operator dialog when needed, helping operators continue work without interruption.
Original PR description
### Steps to reproduce the issue: - Employee > open your favorite employee > HR Settings tab - Add a Badge Id say: 111 - Go to the shopfloor > extends the employee panel on the left - Scan the badge…
### Steps to reproduce the issue: - Employee > open your favorite employee > HR Settings tab - Add a Badge Id say: 111 - Go to the shopfloor > extends the employee panel on the left - Scan the badge of your employee #### Expected behavior: The corresponding employee is added to the employee panel on the left and is set as the session owner. If you had clicked on the `+ Add operator` button before the scan, the dialog should be closed. #### Current behavior: TypeError: Cannot read properties of undefined (reading 'isShown') at `MrpDisplay._onBarcodeScanned` ### Cause of the issue: Once the scanned barcode is parsed and match a given employee in the `_onBarcodeScanned`, this call checks that a `SelectionPopup` is shown (representing the search dialog) and if so close it: https://github.com/odoo/enterprise/blob/e6bb5d2dcd1042ae6269487056babceca34b8655/mrp_workorder/static/src/mrp_display/mrp_display.js#L170-L177 Then, the session owner is set to the scanned employee. However, the `SelectionPopup` has been removed in saas-17.3 by Commit 209b0840df4d3de184dcba6cbc09539ec191a43a: https://github.com/odoo/enterprise/pull/56927/commits/209b0840df4d3de184dcba6cbc09539ec191a43a#diff-119404910b34efb326dbe84735b8ca63c16391841da9a7a85e5f61f790b25bd6L26-L31 and has been replaced by a regular dialog of the dialogService. It should therefore be closed in a similar way to how its done in the `selectEmployee` of the `useConnectedEmployee`: https://github.com/odoo/enterprise/blob/e6bb5d2dcd1042ae6269487056babceca34b8655/mrp_workorder/static/src/mrp_display/hooks/employee_hooks.js#L76 opw-4405585 ---