Skip to content

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

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

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

Conversation

@mav-adhoc

@mav-adhoc mav-adhoc commented Jul 20, 2026

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

@roboadhoc

Copy link
Copy Markdown
Collaborator

Pull request status dashboard

@mav-adhoc
mav-adhoc force-pushed the 18.0-t-70863-mav branch 3 times, most recently from 32f2388 to ce1e5f0 Compare July 20, 2026 17:55
@mav-adhoc mav-adhoc changed the title [FIX] stock_voucher_ux: print voucher on validation when book is set [FIX] stock_voucher_ux: print voucher on validation when auto-print is set Jul 20, 2026
@mav-adhoc
mav-adhoc force-pushed the 18.0-t-70863-mav branch 5 times, most recently from d10bf3e to 21ff7be Compare July 22, 2026 16:39
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants