T3389-FIX-INVOICE_BUTTON - #2139
Closed
loris-fab wants to merge 2 commits into
Closed
Conversation
- _compute_fullshot now assigns False when the child has no picture, instead of leaving the field unassigned (ValueError on render). - The report action no longer carries data: the web client drops the record ids from the report URL as soon as the action holds data, which rendered an empty recordset, hence a blank PDF. - The report guards the image with t-if and uses image_data_uri, so the real mimetype is used and a child without picture gets a readable page.
nb_invoices was incremented without the matching records while open_invoices() replaced the domain with every gift, unfiltered. Both are replaced by a single _get_open_invoices() override, so counter and list always show the same set.
Author
|
Remplacée par #2141, qui repart de |
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.
Goal
Complément du correctif T3389 pour les contrats Child Gift (
type == "G").Ces contrats ne portent pas leurs factures : quand un cadeau est facturé,
build_inv_line_datarattache la ligne de facture au parrainage lié, pas au contrat cadeau. Sans traitement particulier, leur bouton afficherait donc toujours 0.Ce module compensait, mais à deux endroits différents et avec deux critères différents — d'où un compteur et une liste qui ne pouvaient pas coïncider.
Technical aspect
Deux rustines supprimées, remplacées par une seule surcharge du point d'extension créé dans
compassion-accounting._compute_invoices:contract.nb_invoices += len(gift_invoices). Ce code incrémentait un entier sans que les factures correspondantes existent dans un recordset — le bouton annonçait donc un nombre que rien ne pouvait afficher. Structurellement incompatible avec l'objectif « compteur = liste ».open_invoices(). Elle faisaitres["domain"] = [...], ce qui remplaçait le domaine du parent : les factures propres au contrat cadeau disparaissaient de la liste. Et son filtre étaitinvoice_category == "gift"seul, sans aucun filtre d'état ni de paiement — la liste contenait donc aussi les cadeaux payés, annulés et brouillons._get_open_invoices(), qui pour les contratsGajoute (union, pas remplacement) les factures de cadeau du parrainage lié, filtrées par le critère commun_filter_open_invoices(). Compteur et liste consommant tous deux cette méthode, ils ne peuvent plus diverger.@api.dependscomplété : le compteur d'un contrat cadeau dépend des lignes de facture d'un autre contrat (le parrainage). Ce chemin n'était déclaré nulle part, donc l'encaissement d'un cadeau ne rafraîchissait pas le compteur.Ce qui change pour l'utilisateur
Sur un contrat Child Gift :
Le seul changement visible côté métier : les cadeaux payés ne sont plus dans « Open invoices ». Ils restent accessibles par le bouton « Gifts » juste à côté, qui n'est pas modifié.
Misc
991953efdu ticket T3399 (« Child picture printing crash »), pas encore mergé dans18.0. Il n'a aucun rapport avec T3389 — à merger dans le bon ordre, ou à rebaser une fois T3399 parti.sponsorship.giftn'est créé qu'au paiement de la facture (invoice_paid→_trigger_gifts). Les deux boutons sont donc complémentaires — facture ouverte avant paiement, cadeau après. Exception : avec l'optionno_birthday_invoice, le cadeau est créé sans facture et n'apparaît que dans « Gifts ».open_invoices_sponsorship_only/open_invoices_exclude_sponsorshipsont inchangés : ils portent suropen_invoice_ids, qui reste réservé au métier (génération de cadeaux, cascade d'écriture).