← Back to Pull requests

[19.0] [ADD] account_invoice_report_product_hs_code #434

Open
ivantodorovich opened this pull request with 594 lines diff across 10 files
View on GitHub
ivantodorovich ivantodorovich commented on Oct 06, 2026 12:59 UTC
Author

This module prints the product's HS Code (Harmonized System code) under the line description of the invoice report, for the products where it is set.

This information is typically required on commercial documents for customs purposes.

Diff: 594 lines (+594 / -0) across 10 files Reviewer: yankinmax Review duration: 84356m
All Vouch review confidence checks passed
Residual risk 0.12 = Change Risk (0.61) × (1 − Review Confidence (0.81)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.61 · 594 lines diff across 10 files
0.61
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.76 · 2 substantive comment(s)
0.76
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
80%
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
Diff Size diff_size
0.382
Real PR Conversation Timeline
5 items
yankinmax yankinmax approved these changes on Oct 08, 2026 15:14 UTC
Approved Reviewer

Approved these changes.

rrebollo rrebollo commented on code on Dec 03, 2026 18:18 UTC
Code Review
account_invoice_report_product_hs_code/views/report_invoice.xml:1
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+    Copyright 2026 Camptocamp SA (https://www.camptocamp.com).
+    License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+-->
+<odoo>
+    <template
+        id="report_invoice_document"
+        inherit_id="account.report_invoice_document"
+        priority="20"
+    >
+        <!-- Print the product HS code under the line description -->
+        <xpath expr="//td[@name='account_invoice_line_name']" position="inside">
+            <div t-if="line.product_id.hs_code" name="hs_code" class="text-muted small">
+                HS Code: <span t-field="line.product_id.hs_code" />
+            </div>
+        </xpath>

On a section with Hide Prices, the description prints but the HS code does not: those lines render through the account_invoice_line_name_grouped cells.

Steps to reproduce (19.0):
1. Set an
HS Code on a product (Inventory tab).
2. Create a customer invoice and click
Add a section.
3. On the section row, open the ⋮ menu and choose
Hide Prices*.
4. Add that product under the section, confirm and print.

Without Hide Prices:

<img width="1135" height="939" alt="invoice-without-hide-prices" src="https://github.com/user-attachments/assets/c7109b93-ae3d-4c77-b67d-3084f3643fac" />

With Hide Prices:

<img width="1135" height="939" alt="invoice-with-hide-prices" src="https://github.com/user-attachments/assets/6f24d8cf-a168-4c73-a751-e13b69811b05" />

This covers both grouped cells; with it applied, the code prints on that same invoice:

        </xpath>
        <!-- Same for the lines of a section with "Hide Prices" -->
        <xpath
            expr="//td[@name='account_invoice_line_name_grouped_desktop']"
            position="inside"
        >
            <div
                t-if="grouped_line.get('product') and grouped_line['product'].hs_code"
                name="hs_code"
                class="text-muted small"
            >
                HS Code: <span t-field="grouped_line['product'].hs_code" />
            </div>
        </xpath>
        <xpath expr="//td[@name='account_invoice_line_name_grouped']" position="inside">
            <div
                t-if="grouped_line.get('product') and grouped_line['product'].hs_code"
                name="hs_code"
                class="text-muted small"
            >
                HS Code: <span t-field="grouped_line['product'].hs_code" />
            </div>
        </xpath>

rrebollo rrebollo commented on Dec 03, 2026 18:25 UTC
Reviewer

Installed and rendered the invoice report on 19.0 in a throwaway database. The commit header reads [ADD] module, where the convention asks [ADD] module: summary. Consider my findings.

Assisted-by: opencode:deepseek-v4.1-flash
Assisted-by: opencode:claude-sonnet-5-5

rrebollo rrebollo commented on Dec 03, 2026 18:29 UTC
Contributor

Hi @ivantodorovich, thanks for this module! If you can spare a moment, we would really appreciate your review of #455 (18.0, account_invoice_report_grouped_by_picking): it fixes the quantity printed on a partial refund without return. Thank you very much!

Reviewers
Assignees
ivantodorovich ivantodorovich
Labels
risk: low confidence: 80.9% 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: 61.4% (MEDIUM) · Higher = larger blast radius
61.4%
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: 80.9% · Lower = rushed or shallow review
80.9%
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: 11.7% · Safe to merge
11.7%