[FIX] pos_order_to_sale_order: hook _pre_confirm_from_pos previo a ac…#1580
Draft
Pablocce wants to merge 1 commit into
Draft
[FIX] pos_order_to_sale_order: hook _pre_confirm_from_pos previo a ac…#1580Pablocce wants to merge 1 commit into
Pablocce wants to merge 1 commit into
Conversation
…tion_confirm Añade un punto de enganche no-op en create_order_from_pos, justo antes de confirmar el pedido, para que módulos de extensión (p. ej. los omnicanal de TPV) puedan asignar transportista/almacén con el pedido todavía en borrador. Sin este hook, esa asignación solo podía vivir dentro de action_confirm(), donde queda a merced de cualquier _patch_method que intercepte el método antes de la cadena de herencia normal (p. ej. sale_exceptions_priority, que evalúa excepciones con el pedido todavía sin carrier y bloquea la confirmación en silencio en contexto programático). Ref odoo-16/fl-v16#9646 Ref odoo-16/mas-musculo#834
Contributor
|
Hi @legalsylvain, |
IVA-BO
approved these changes
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a no-op extension hook,
_pre_confirm_from_pos(order_data), calledfrom
create_order_from_posright beforeaction_confirm()is invoked(only when the order is actually going to be confirmed).
Motivation
create_order_from_pos creates, confirms, delivers and invoices the sale
order in a single call, with no seam between "create" and "confirm". Any
downstream module that needs to prepare the order (e.g. auto-assign a
delivery carrier or warehouse) before it is confirmed currently has no
way to do so other than embedding that logic inside its own
action_confirm() override.
That is fragile: if any other module patches action_confirm via
_patch_method (a common pattern for global exception/validation checks),
the patch wraps the already-merged MRO chain and runs before any
_inherit-based override gets a chance to run — including the one doing
the carrier/warehouse assignment. The order can then get stuck without a
carrier and, in a programmatic context like POS order creation, fail to
confirm silently.
This hook gives downstream modules a proper place to run that kind of
preparation logic strictly before action_confirm() is ever invoked from
this flow, without having to touch — or race against — whatever patches
action_confirm itself.
Changes
_pre_confirm_from_pos method, called from create_order_from_pos.
No existing behavior changes — the hook is a no-op unless a downstream
module overrides it.
Testing
unmodified against a fresh test database; no regressions introduced by
this change.
by overriding it to assign a delivery carrier before confirmation, with
its own dedicated unit tests.