pos icon indicating copy to clipboard operation
pos copied to clipboard

[17.0][FIX] pos_user_restriction: Fix can't close session with POS Assigned User group

Open peluko00 opened this issue 9 months ago • 2 comments

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

peluko00 avatar Mar 24 '25 11:03 peluko00

Hi @eLBati, some modules you are maintaining are being modified, check this out!

OCA-git-bot avatar Mar 24 '25 11:03 OCA-git-bot

Hi @legalsylvain, it's ready for merge?

peluko00 avatar May 19 '25 14:05 peluko00

Sorry for ping @legalsylvain, it's ready for merge?

peluko00 avatar Jul 25 '25 14:07 peluko00

Sorry for ping here @ivantodorovich, it's seems is ready for merge?

peluko00 avatar Nov 11 '25 06:11 peluko00

This PR looks fantastic, let's merge it! Prepared branch 17.0-ocabot-merge-pr-1343-by-ivantodorovich-bump-patch, awaiting test results.

OCA-git-bot avatar Nov 11 '25 11:11 OCA-git-bot

@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.

OCA-git-bot avatar Nov 11 '25 11:11 OCA-git-bot

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?

ivantodorovich avatar Nov 11 '25 11:11 ivantodorovich

Done! Can you try again please @ivantodorovich?

peluko00 avatar Nov 11 '25 12:11 peluko00

/ocabot merge patch

ivantodorovich avatar Nov 11 '25 12:11 ivantodorovich

This PR looks fantastic, let's merge it! Prepared branch 17.0-ocabot-merge-pr-1343-by-ivantodorovich-bump-patch, awaiting test results.

OCA-git-bot avatar Nov 11 '25 12:11 OCA-git-bot

Congratulations, your PR was merged at 36990c60fc003e614ae6ec33f1bd23e42ca8d90a. Thanks a lot for contributing to OCA. ❤️

OCA-git-bot avatar Nov 11 '25 12:11 OCA-git-bot