[17.0][FIX] pos_user_restriction: Fix can't close session with POS Assigned User group
When you try to close POS session with only group POS Assigned User, throws a AccessError.
cc https://github.com/APSL 3175 @miquelalzanillas @javierobcn @mpascuall @BernatObrador @ppyczko @lbarry-apsl please review
Hi @eLBati, some modules you are maintaining are being modified, check this out!
Hi @legalsylvain, it's ready for merge?
Sorry for ping @legalsylvain, it's ready for merge?
Sorry for ping here @ivantodorovich, it's seems is ready for merge?
This PR looks fantastic, let's merge it! Prepared branch 17.0-ocabot-merge-pr-1343-by-ivantodorovich-bump-patch, awaiting test results.
@ivantodorovich your merge command was aborted due to failed check(s), which you can inspect on this commit of 17.0-ocabot-merge-pr-1343-by-ivantodorovich-bump-patch.
After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.
Merge command failed with:
2025-11-11 11:22:07,202 271 INFO odoo odoo.addons.pos_user_restriction.tests.test_hacks: Starting TestHacks.test_validate_session ...
2025-11-11 11:22:07,304 271 INFO odoo odoo.models.unlink: User #18 deleted pos.payment.method records with IDs: [27]
2025-11-11 11:22:07,346 271 ERROR odoo odoo.sql_db: bad query: INSERT INTO "account_journal" ("active", "bank_statements_source", "check_manual_sequencing", "code", "color", "company_id", "create_date", "create_uid", "default_account_id", "invoice_reference_model", "invoice_reference_type", "loss_account_id", "name", "payment_sequence", "profit_account_id", "refund_sequence", "sale_activity_type_id", "sequence", "show_on_dashboard", "type", "write_date", "write_uid") VALUES (true, 'undefined', false, 'CSH 1', 0, 8, '2025-11-11 11:22:01.244164', 18, 375, 'odoo', 'invoice', 344, '{"en_US": "Cash"}', true, 334, false, NULL, 10, true, 'cash', '2025-11-11 11:22:01.244164', 18) RETURNING "id"
ERROR: duplicate key value violates unique constraint "account_journal_code_company_uniq"
DETAIL: Key (company_id, code)=(8, CSH 1) already exists.
2025-11-11 11:22:07,349 271 INFO odoo odoo.addons.pos_user_restriction.tests.test_hacks: ======================================================================
2025-11-11 11:22:07,349 271 ERROR odoo odoo.addons.pos_user_restriction.tests.test_hacks: ERROR: TestHacks.test_validate_session
Traceback (most recent call last):
File "/__w/pos/pos/pos_user_restriction/tests/test_hacks.py", line 49, in test_validate_session
self.config = self._create_basic_config()
File "/opt/odoo/addons/point_of_sale/tests/common.py", line 269, in _create_basic_config
'journal_id': cls.env['account.journal'].create({
File "<decorator-gen-224>", line 2, in create
File "/opt/odoo/odoo/api.py", line 430, in _model_create_multi
return create(self, [arg])
File "/opt/odoo/addons/account_check_printing/models/account_journal.py", line 62, in create
journals = super().create(vals_list)
File "<decorator-gen-209>", line 2, in create
File "/opt/odoo/odoo/api.py", line 431, in _model_create_multi
return create(self, arg)
File "/opt/odoo/addons/account/models/account_journal.py", line 828, in create
journals = super(AccountJournal, self.with_context(mail_create_nolog=True)).create(vals_list)
File "<decorator-gen-140>", line 2, in create
File "/opt/odoo/odoo/api.py", line 431, in _model_create_multi
return create(self, arg)
File "/opt/odoo/addons/mail/models/mail_alias_mixin_optional.py", line 92, in create
records = super().create(valid_vals_list)
File "<decorator-gen-142>", line 2, in create
File "/opt/odoo/odoo/api.py", line 431, in _model_create_multi
return create(self, arg)
File "/opt/odoo/addons/mail/models/mail_thread.py", line 255, in create
threads = super(MailThread, self).create(vals_list)
File "<decorator-gen-12>", line 2, in create
File "/opt/odoo/odoo/api.py", line 431, in _model_create_multi
return create(self, arg)
File "/opt/odoo/odoo/models.py", line 4656, in create
records = self._create(data_list)
File "/opt/odoo/odoo/models.py", line 4844, in _create
cr.execute(SQL(
File "/opt/odoo/odoo/sql_db.py", line 335, in execute
res = self._obj.execute(query, params)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "account_journal_code_company_uniq"
DETAIL: Key (company_id, code)=(8, CSH 1) already exists.
Can you rebase and see if the issue is reproduced here?
Done! Can you try again please @ivantodorovich?
/ocabot merge patch
This PR looks fantastic, let's merge it! Prepared branch 17.0-ocabot-merge-pr-1343-by-ivantodorovich-bump-patch, awaiting test results.
Congratulations, your PR was merged at 36990c60fc003e614ae6ec33f1bd23e42ca8d90a. Thanks a lot for contributing to OCA. ❤️