[ADD] l10n_latam_check_ux: third party check lifecycle tests - #1171
Open
cav-adhoc wants to merge 10 commits into
Open
[ADD] l10n_latam_check_ux: third party check lifecycle tests#1171cav-adhoc wants to merge 10 commits into
cav-adhoc wants to merge 10 commits into
Conversation
Contributor
cav-adhoc
force-pushed
the
19.0-t-71623-cav
branch
from
August 13, 2026 17:25
1585b5a to
38fe298
Compare
Contributor
Author
|
Actualizado: los dos tests ahora usan la batería de invariantes de |
cav-adhoc
force-pushed
the
19.0-t-71623-cav
branch
3 times, most recently
from
August 18, 2026 18:06
f206e15 to
1035444
Compare
T17: first two tests of the cobros/pagos regression battery: given/when/then in the docstring, a named subTest per step so a failure says which operation broke. Both walk the chain instead of asserting one isolated step, because a check breaks when an operation leaves state that the next one misreads. The observable is current_journal_id: inbound leaves the check in that journal, outbound leaves it empty. The invariants every operation must satisfy come from the account_ux battery, mounted on LatamCheckCommon so every suite in the module gets it without inheriting it per class. Runs after the wallet transfers and after undoing them too, not only after the receipt and the endorsement - a transfer is two payments with their own entries. The mass-transfer wizard runs with check_deposit_transfer=True, which skips the core hook that on a manual internal transfer forces current_journal_id to recompute, so _transfer() forces it explicitly instead of relying on it firing on its own. Endorsing goes through the common factory, now taking the journal the checks are in today instead of hardcoding the original one, so the local helper that existed only for that is gone. Two scenarios declared and not implemented: the three-journal chain with a partial revert (operation ordering ties inside a single transaction) and the two-company one (rejected on OBA databases). T18: two more tests. The transfer currency one shows the mass-transfer wizard forces the check's own currency on both legs, while building the same transfer by hand with a mismatched currency gets blocked by _get_blocking_l10n_latam_warning_msg. The deposit/rejection one walks an invoice paid with a third-party check, deposited, rejected by the bank and replaced with a new check, asserting the partner balance at each step via the account_ux battery. That second test also surfaces (and declares, not implements) a real product bug: _compute_can_reject's guard against rejecting an already-returned check compares payment.state to "posted", a value account.payment.state never has (it's draft/in_process/paid/canceled/rejected), so the guard never fires and a check can be rejected twice. Left undone here rather than asserted around, since writing the passing assertion would freeze the bug as expected behavior.
cav-adhoc
force-pushed
the
19.0-t-71623-cav
branch
from
August 18, 2026 18:17
1035444 to
548705f
Compare
…s before confirming Cubre FCP-R02-E1/E2/E3: dos medios de pago sin duplicar, recálculo del total al quitar una línea de medio de pago, y el importe cargado a mano que sobrevive a quitar una línea de deuda (la diferencia pasa a saldo a favor, no se recalcula a cero).
Cubre FCP-R02-E5: efectivo ARS + banco USD sobre la misma deuda convierten una sola vez, sin dejar una diferencia de cambio espuria. No cubre FCP-R02-E4 (cuatro medios incluyendo los dos tipos de cheque), declarado por su cruce con el ciclo de vida del cheque (T17/T18).
…and on account Cubre FCP-R02-E6/E7/E8: pagar de menos deja la diferencia declarada sin write-off automático; pagar de más no bloquea y el excedente no se autoimputa a otra factura; un pago a cuenta explícito tampoco toca deuda vieja sin relación. Nota de proceso: el primer intento del último caso parecía reproducir el bug que describe el escenario (auto-imputación a deuda vieja), pero investigado a fondo resultó ser un gap del setup del test, no un bug de producto — to_pay_move_line_ids se autocompleta con toda la deuda abierta si no se la vacía a propósito, igual que en el formulario real.
…/vendor Cubre FCP-R03-E1..E5: cobro/pago netea la deuda sin invertir el signo, nota de crédito resta en vez de sumar, saldo a favor previo se aplica sin invertir signos, y un cobro que imputa factura + pago previo a cuenta no arrastra líneas espurias (BUG-004).
… and combos Cubre FCP-R04-E3/E5/E6/E7/E8/E9: write-off real en la cuenta elegida por el usuario y su supervivencia a un ciclo de reset; redondeo sin tolerancia (con y sin write-off cargado); dos facturas exactas sin ajuste; combinación factura+NC sin inflar la diferencia; y write-off + diferencia de cambio como dos asientos separados en moneda extranjera.
…/manual TC Cubre FCP-R07-E1/E2/E3/E4 y FCP-R08-E1 (su espejo en compras): TC mayor (ganancia) y menor (pérdida), TC fijado a mano que manda sobre el automático, y una cotización posterior que no altera la diferencia ya asentada al TC del cobro.
…ncy, NC, 3rd currency) Cubre FCP-R07-E5/R08-E2 (diario en la misma moneda, sin movimiento de TC, sin diferencia de cambio), FCP-R08-E5 (factura + NC cada una con su propio TC, neto sin duplicar la diferencia) y FCP-R08-E6 (tercera moneda: doble conversión hecha una sola vez, sin residuo).
… control, overpay Cubre FCP-R07-E6/E7/E9 y FCP-R08-E7: la diferencia de un cobro parcial es proporcional (no sobre el total), dos cobros parciales a distinto TC generan cada uno la suya propia con signos opuestos, mismo TC y misma moneda no genera ninguna diferencia espuria, y el excedente de un pago de más queda a cuenta en la moneda extranjera, no convertido.
…ates once Cubre FCP-R08-E8 / FCP-R09-E6: un pago en moneda extranjera vuelto a borrador y re-confirmado a otra fecha (otro TC) recalcula la diferencia de cambio al TC nuevo, sin quedar la anterior duplicada. No cubre FCP-R06-E7 (residual de centavos tras conciliar la transitoria): requiere un account.bank.statement.line, y postearlo dispara un render de PDF que en este entorno no tiene wkhtmltopdf disponible — infraestructura no relacionada al mecanismo bajo prueba.
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.

Primeros dos tests de la batería de regresión de cobros/pagos, como muestra de cómo queda el patrón en el código antes de escribir los veinte.
Qué trae
test_third_party_check_travels_and_comes_back: recorre cobro → pase de cartera → reversión del pase → endoso → reversión del endoso, verificando en cada paso que el cheque está en una sola cartera, con su importe intacto, y disponible solo cuando corresponde.test_third_party_checks_of_equal_amount_do_not_cross: tres cheques del mismo importe se pasan juntos de cartera y ninguno se aplica al apunte de otro.El patrón que se está probando acá
subTestnombrado por paso: el rojo dice "endosado a un proveedor deja de estar disponible" en vez de "el test falló". Es la condición que hace legible un test en cadena.Verificación
Verde sobre una base 19.0 con el módulo instalado: 2 tests, 3,85 s.
Demostrado en rojo: quitando la regla de que una operación de salida deja el cheque fuera de cartera, falla exactamente el paso del endoso, con el mensaje del
subTest.Hallazgos del camino, que no se corrigen acá
operation_date, que al confirmar se copia decreate_datey recibe un offset fijo por pase. Dentro de una misma transacción esos valores empatan y la "última operación" queda definida por el orden del recordset. En producción cada operación ocurre en su propia transacción, así que no se nota; en un test hay que declarar el orden a mano, y dos operaciones dentro del mismo minuto quedarían igual de empatadas en producción.