odoo/odoo#209420

Created by fw-bot
Merged at 1be8d6febb6dbd8e420c2390486a5cbf1e114a9f

Statuses:

label
odoo-dev:master-saas-18.1-sentry-6276299189-pos-undefined-function-error-adip-434910-fw
head
689c3314f0ca22a44ccd6078b4bb5ad8e3198f1f
merged
5 months ago by Aditi Patel (adip)
odoo/odoo
saas-18.1 #197715
saas-18.2 #209256
saas-18.3 #209278
saas-18.4
19.0
master #209420

[FW][FIX] point_of_sale: prevent error when reopening a POS session

Currently, an error occurs on reopening a POS session if its 'Login Number Sequence' record has been deleted. This results in preventing the user from accessing the session.

Steps to produce:
- Install the point_of_sale module (with demo data).
- Open the register of the Furniture Shop from the POS dashboard.
- Now, without closing the register of shop, Navigate to:
Settings > Technical > Sequences & Identifiers > Sequences (list).
- Delete the Login Number Sequence of Session 3 sequence record.
- Reopen that shop session again.
- Observe the error at the backend.

Error:

UndefinedFunction
operator does not exist: integer = boolean
LINE 1: SELECT number_next FROM ir_sequence WHERE id=false FOR UPDAT...
                                                    ^
HINT:  No operator matches the given name and argument types. You might need
to add explicit type casts.

The error occurs because the system attempts to access the login_number_seq_id of the POS session at [1], but it is unavailable as the user has already deleted it.

This commit adds validation to prevent deletion of the 'Login Number Sequence' if the associated POS session is not closed.

[1] - https://github.com/odoo/odoo/blob/948f6c5afdf76b9a25daa120fec1edd21c5c08d6/addons/point_of_sale/models/pos_session.py#L404-L406

Sentry-6276299189


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #197715