[FIX] stock_voucher_ux, stock_voucher_ux_iot: do not count header-only pages - #1024
Open
mav-adhoc wants to merge 1 commit into
Open
[FIX] stock_voucher_ux, stock_voucher_ux_iot: do not count header-only pages#1024mav-adhoc wants to merge 1 commit into
mav-adhoc wants to merge 1 commit into
Conversation
Collaborator
mav-adhoc
force-pushed
the
18.0-h-126294-mav
branch
2 times, most recently
from
September 1, 2026 18:40
3f90ff8 to
307ca90
Compare
…y pages The counter that decides how many voucher numbers a pre-printed remito consumes looks for the product's internal reference or barcode in the text of every rendered page and, when it finds neither, falls back to "any page with a decimal number". A report that repeats the customer header on a trailing page hits that fallback through the header itself: a kilometre mark in an address is enough. A page without a single line then burned a voucher number, and the operator lost the number they needed next. Discard a page only when every line can be recognised: all the transfer's products carry an internal reference or a barcode, and at least one of them shows up in the rendered text, which is how we know the template prints them. A page carrying none of them then carries no lines either. Anything else -- a template that prints only the product name, a transfer with a product that has no reference -- keeps the decimal fallback and counts every page as it does today. The asymmetry is deliberate: over-counting burns a number, under-counting sends out a printed page with no number on it. The counter lived duplicated in the download controller and in the IoT report, with the same defect in both and no test on the controller copy, which is the one every browser print goes through. It moves to stock.picking so both callers share a single implementation, covered by a test that fails with the old fallback. Tickets 126294 and 124890.
mav-adhoc
force-pushed
the
18.0-h-126294-mav
branch
from
September 2, 2026 16:24
307ca90 to
cdd7fca
Compare
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.

Qué pasa
El contador que decide cuántos números de remito consume un preimpreso busca el código interno o el barcode del producto en el texto de cada página renderizada y, si no encuentra ninguno, cae a "cualquier página con un número decimal".
Un reporte que repite el encabezado en una hoja final matchea ese fallback con el encabezado mismo — alcanza un "Km 1,4" en un domicilio. La hoja no tiene una sola línea y sin embargo consume un número, y el operador pierde el remito que necesitaba usar después.
Qué cambia
Cuando el traslado tiene productos con código, manda el código: una página que no trae ninguno tampoco trae líneas. El fallback numérico queda para los traslados cuyos productos no tienen ni código interno ni barcode, donde no hay otra cosa con la que reconocer una línea.
El contador estaba duplicado en el controller de descarga y en el reporte IoT, con el mismo defecto en los dos y sin test sobre la copia del controller — que es por donde pasa toda impresión desde el navegador. Pasa a
stock.picking, lo comparten los dos callers y queda cubierto.Cómo se verifica
test_page_without_products_does_not_consume_a_voucherfalla con la lógica vieja:AssertionError: 2 != 1.stock_voucher,stock_voucher_uxystock_voucher_ux_iot: 13 tests, 0 fallos, 0 errores."12,50 total"y sin productos).Tickets 126294 y 124890.