Skip to content

[18.0][FIX] sale_exception: portal signature hangs on exceptions - #4600

Open
gal-adhoc wants to merge 1 commit into
OCA:18.0from
adhoc-dev:18.0-t-75454-gal
Open

gal-adhoc wants to merge 1 commit into
OCA:18.0from
adhoc-dev:18.0-t-75454-gal

Conversation

@gal-adhoc

Copy link
Copy Markdown

Depends on OCA/server-tools#3741. Follow-up of #4255.

Problem

Signing a quotation in the customer portal hangs when an exception rule applies:

  1. portal_quote_accept writes the signature and flushes: the order row is locked by the ongoing transaction.
  2. _validate_order() → action_confirm() → detect_exceptions() writes the exceptions through a second cursor on that same row, and waits forever.

Even without the lock, the BaseExceptionError would roll back the signature, and its client handler only lives in web.assets_backend: the portal would show the raw {"src_model": "sale.order", ...} payload. The free order flow of website_sale goes through _validate_order() too.

Change

_validate_order() detects the exceptions without rollback (base_exception_no_rollback, scoped to these orders):

  • Blocked orders stay unconfirmed, keep the signature and get an internal note listing the exceptions, so the salesperson sees why.
  • The other orders are confirmed as before.

The customer still gets the standard "signed" message: this is the behavior before #4255, when the confirmation silently returned the popup action.

Open question

sale_loyalty also overrides _validate_order() and there is no dependency between both modules. If it ends up above sale_exception, it may try to invoice a zero-amount rewarded order that was not confirmed (with sale.automatic_invoice). Not handled here; feedback welcome.

Tests

tests/test_validate_order.py: blocked order (not confirmed, signature kept, note posted), order without exceptions (confirmed) and a mixed batch. The lock itself cannot be reproduced in a TransactionCase (a separate connection does not see the uncommitted order), so it was checked manually on a real server: the portal request answers in ~2s instead of hanging.

@UsmanGhias UsmanGhias left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean patch for OCA/sale-workflow.

Observations:

  • The targeted patch addresses the issue cleanly without introducing side effects across related models.

Ready for testing on standard environments.

Best,
Usman

_validate_order() is called by frontend flows (portal signature, free
e-commerce orders) after writing on the order in the same transaction,
so the second cursor of detect_exceptions() waits forever on the row
lock. There is also no client handler for BaseExceptionError there.

Detect the exceptions without rollback in _validate_order(): blocked
orders stay unconfirmed, keep what was written (e.g. the signature) and
get an internal note with the exceptions. The other orders are
confirmed as before.
@gal-adhoc gal-adhoc changed the title [WIP] [18.0][FIX] sale_exception: portal signature hangs on exceptions [18.0][FIX] sale_exception: portal signature hangs on exceptions Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants