fix(express): show Tax on totals + add tooling as real SO line

Three related fixes on the Express Orders totals card:

1. Totals card now breaks out Subtotal / Tax / Tooling Charge /
   Grand Total. Previously the "Subtotal" and "Grand Total" rows
   both read from total_amount (same value rendered twice) and no
   tax was shown at all. Customers on a fiscal position-mapped
   tax rate (Ontario HST, etc.) had their taxes silently dropped
   from the preview.

2. tooling_charge now feeds the Grand Total. The total_amount
   compute previously summed line subtotals only. Added a real
   SO line for the tooling charge in action_create_order so the
   eventual sale.order.amount_total matches the preview AND the
   invoice carries a "Tooling Charge" line item.

3. tax_ids is now visible as an optional column on the lines
   list. Operator can see + override the auto-applied tax per
   line. Default still comes from FP-SERVICE product mapped
   through partner.property_account_position_id (fiscal position).

New compute fields on fp.direct.order.wizard:
  - total_subtotal (sum of line.qty * line.unit_price, pre-tax)
  - total_tax (sum of line + tooling taxes via compute_all)
  - total_amount (subtotal + tax + tooling — was just subtotal)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-27 10:33:31 -04:00
parent 2f74d5ecb9
commit d1fc3d8720
3 changed files with 134 additions and 17 deletions

View File

@@ -63,8 +63,6 @@
<field name="name" readonly="1"/>
<span class="o_fp_xpr_pill">EXPRESS</span>
</h1>
<field name="user_id" readonly="state != 'draft'"
options="{'no_create': True}"/>
<field name="view_source" invisible="1"/>
</div>
@@ -87,16 +85,17 @@
</div>
<!-- ============================================================
PO Block fills LEFT half (cols 1-2) across rows 2-5.
RIGHT half (cols 3-4) flows 4 pairs of fields
PO Block fills LEFT half (cols 1-2) across rows 2-7.
RIGHT half (cols 3-4) flows 6 pairs of fields
alongside it — Customer Job #/Job Sorting, Material
Process/Lead Time, Payment Terms/Delivery Method,
Pricelist/Quote Validity.
Pricelist/Quote Validity, Blanket SO/Invoice Strategy,
Sales Rep/conditional Deposit-or-Progress %.
Net: PO block ~250px height matches 4 × ~60px right
stack — no dead air on either side.
Net: PO block height matches 6 × ~60px right stack —
no dead air on either side.
============================================================ -->
<div class="o_fp_xpr_cell span-2 row-span-4 o_fp_xpr_po_block">
<div class="o_fp_xpr_cell span-2 row-span-6 o_fp_xpr_po_block">
<div class="o_fp_xpr_po_head">
<span>CUSTOMER PO</span>
<field name="po_status" widget="badge"
@@ -185,12 +184,14 @@
<field name="validity_date" nolabel="1"/>
</div>
<!-- Row 6 (after PO block ends) — Blanket + Invoice + conditional % -->
<div class="o_fp_xpr_cell">
<!-- Right side row 6: Blanket Sales Order + Invoice Strategy -->
<div class="o_fp_xpr_cell o_fp_xpr_inline_label">
<label for="is_blanket_order">Blanket Sales Order</label>
<div class="o_fp_xpr_inline_pair">
<field name="is_blanket_order" nolabel="1"/>
<field name="is_blanket_order" nolabel="1"
widget="boolean_toggle"/>
<field name="block_partial_shipments" nolabel="1"
widget="boolean_toggle"
invisible="not is_blanket_order"/>
<span class="o_fp_xpr_inline_help"
invisible="not is_blanket_order">Block partial</span>
@@ -200,6 +201,14 @@
<label for="invoice_strategy">Invoice Strategy</label>
<field name="invoice_strategy" nolabel="1"/>
</div>
<!-- Right side row 7: Sales Rep + conditional Deposit/Progress % -->
<div class="o_fp_xpr_cell">
<label for="user_id">Sales Rep</label>
<field name="user_id" nolabel="1"
readonly="state != 'draft'"
options="{'no_create': True}"/>
</div>
<div class="o_fp_xpr_cell" invisible="invoice_strategy != 'deposit'">
<label for="deposit_percent">Deposit %</label>
<field name="deposit_percent" nolabel="1"/>
@@ -298,6 +307,12 @@
options="{'no_quick_create': True}"
invisible="not part_catalog_id"
optional="hide"/>
<field name="tax_ids"
string="Tax"
widget="many2many_tags"
options="{'no_create': True}"
optional="show"
width="110px"/>
<field name="currency_id" column_invisible="1"/>
</list>
</field>
@@ -328,7 +343,14 @@
<div class="o_fp_xpr_card o_fp_xpr_totals">
<div class="o_fp_xpr_total_row">
<span class="o_fp_xpr_total_label">Subtotal</span>
<field name="total_amount"
<field name="total_subtotal"
widget="monetary"
options="{'currency_field': 'currency_id'}"
readonly="1" nolabel="1"/>
</div>
<div class="o_fp_xpr_total_row">
<span class="o_fp_xpr_total_label">Tax</span>
<field name="total_tax"
widget="monetary"
options="{'currency_field': 'currency_id'}"
readonly="1" nolabel="1"/>