Skip to content

[FIX] stock_voucher_ux: print voucher on validation when auto-print is set - #983

Open
fw-bot-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-18.0-t-70863-mav-7310-fw
Open

[FIX] stock_voucher_ux: print voucher on validation when auto-print is set#983
fw-bot-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-18.0-t-70863-mav-7310-fw

Conversation

@fw-bot-adhoc

Copy link
Copy Markdown
Contributor

What

Print the delivery voucher automatically on validation, gated by the operation type's native auto_print_delivery_slip flag — so it only happens when explicitly enabled, not on every validation.

Why

In Odoo 18 button_validate returns True (not None) when validating without a wizard, so the if res is None branch in stock_voucher.button_validate stopped running after the migration: the voucher number is still assigned but the voucher is no longer printed on validation. Restoring it unconditionally would print on every book picking; instead we tie it to auto_print_delivery_slip so each operation type opts in.

How

Override button_validate in stock_voucher_ux. On a completed validation (state == "done") of a single picking whose operation type has auto_print_delivery_slip and a book:

  • autoprinted book: already numbered in _action_done, only print (do_print_voucher);
  • pre-printed book: numbered on print by real page count (do_print_and_assign, assign=True), same path as the "Print Voucher" button.

Without the flag, or on a wizard (backorder), the super() result is returned untouched — no auto-print, no other behavior changes.

Test plan

Operation type with auto_print_delivery_slip on:

  • pre-printed book: validating returns the voucher print action and numbers by real page count;
  • autoprinted book: validating prints without duplicating the number.

Operation type with the flag off: validating only completes the transfer, no print.

Task: https://www.adhoc.inc/odoo/project.task/70863

Forward-Port-Of: #975

…s set

Print the delivery voucher automatically on validation only when the
operation type has `auto_print_delivery_slip` enabled (the native v18
flag), reusing the existing methods without re-numbering:
- autoprinted books: already numbered in _action_done, only print;
- pre-printed books: numbered on print by real page count (assign=True),
  same path as the "Print Voucher" button.

Operation types without the flag are only validated (no auto-print), so
this does not change the behavior of types that don't opt in.

The backorder confirmation wizard is routed through core process(),
which re-runs button_validate() on the pickings in v18, so it reuses the
same print/number path above. This skips stock_voucher's wizard override,
which reprinted with do_print_voucher() without assign (leaving
pre-printed books unnumbered) and returned a tuple the web client never
executes.

X-original-commit: 57fcd84
@roboadhoc

Copy link
Copy Markdown
Collaborator

Pull request status dashboard

@fw-bot-adhoc

Copy link
Copy Markdown
Contributor Author

@mav-adhoc @les-adhoc cherrypicking of pull request #975 failed.

stdout:

Auto-merging stock_declared_value/models/__init__.py
CONFLICT (content): Merge conflict in stock_declared_value/models/__init__.py
CONFLICT (modify/delete): stock_voucher_ux/models/stock_picking.py deleted in 4c2d8e0553fb75520dc5a125a13f8d661c9521d2 and modified in 6671bcb365b7c136015ab09f79ba08a0f23a8f75.  Version 6671bcb365b7c136015ab09f79ba08a0f23a8f75 of stock_voucher_ux/models/stock_picking.py left in tree.
CONFLICT (modify/delete): stock_voucher_ux/tests/test_remito_preimpreso.py deleted in 4c2d8e0553fb75520dc5a125a13f8d661c9521d2 and modified in 6671bcb365b7c136015ab09f79ba08a0f23a8f75.  Version 6671bcb365b7c136015ab09f79ba08a0f23a8f75 of stock_voucher_ux/tests/test_remito_preimpreso.py left in tree.

Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).

:shipit: you can use git-fw to re-do the forward-port for you locally.

⚠️ after resolving this conflict, you will need to merge it via @roboadhoc.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants