← Back to Pull requests

[19.0][FIX] sale_order_report_product_image: cap the printed picture size #410

Open
unknown opened this pull request with 242 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 07, 2026 20:08 UTC
Author

Problem

The picture is printed with the raw content of image_128 and no size constraint:

<span t-esc="line.product_id.image_128" t-options="{'widget': 'image', 'max_width': '64', ...}"/>

The image widget serialises the field to a base64 data URI and emits a bare <img> tag; max_width is not an option it supports, so it is silently ignored and the browser draws the picture at its natural size.

This is harmless as long as image_128 really holds a 128px thumbnail. It is not for catalogues imported in a way that bypasses the ORM resize: we hit production orders where image_128 stored 1920x1440 pictures, printed at 27cm wide. Every other column was pushed off the page, and the quotation came out with no description, no price and no total — one picture per page.

Two smaller issues in the same template:

  • The picture is an extra column, but the computed colspan of the standard template is not widened, so section and combo totals are printed one column to the left.

  • The column has no width, so it takes whatever the picture needs.
  • Fix

  • Render the picture as an <img> built with image_data_uri(), capped with max-width/max-height: 64px, which is what max_width: '64' was meant to do.

  • Give the column a fixed 70px width and top-align it.

  • Widen section_name_colspan and the combo colspan by one.
  • The generic icon shown when a product has no picture is unchanged: it goes through the image widget on an empty field, which already returns a 64px placeholder URL.

    How to test

    1. Put a product with a picture and a product without one on a quotation, with a section line.
    2. Print the quotation: the picture is a small thumbnail, every column is readable, and the section total is aligned with the Amount column.
    3. For the original bug, store a picture larger than 128px in image_128 directly (bypassing the ORM resize) and print again: the layout no longer breaks.

    Diff: 242 lines (+181 / -61) across 3 files Reviewer: alan196 Review duration: 78274m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.46) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 242 lines diff across 3 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.329
    Real PR Conversation Timeline
    1 comments
    "Review active on #410"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.8% (MEDIUM) · Higher = larger blast radius
    45.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.3% · Safe to merge
    25.3%