feat(reports): sequence-sort the Print dropdown so FP reports are #1
Odoo 19's `ir.actions.actions._get_bindings` returns the print-menu bindings via `ORDER BY a.id` (insertion order) and only sequence-sorts the `action`-type bindings — `report`-type bindings are returned in raw SQL order. Result: FP reports installed after Odoo's stock ones appear at the BOTTOM of the dropdown, even when they're the customer-facing primary report (e.g. Timesheets above Quotation on sale.order). Two changes in fusion_plating_reports/models/ir_actions_report.py: 1. **Add `sequence` (Integer, default 100) to ir.actions.report** — gives every report a sortable knob. 2. **Override `ir.actions.actions._get_bindings`** to also sort the `report` slice by `(sequence, name.lower())`. super() returns the cached frozendict; we rebuild with the sorted reports. Then set sequences in fp_hide_default_reports.xml (lower = top): | Model | seq 10 (#1) | seq 15 (#2) | seq 20+ | |-----------------|--------------------------|--------------------------|-----------------------| | sale.order | FP Quotation Portrait | FP Quotation Landscape | FP Job Traveller (20) | | account.move | FP Invoice Portrait | FP Invoice Landscape | | | stock.picking | FP Packing Slip Portrait | FP Packing Slip Landscape| | | mrp.production | FP Job Traveller Portrait| FP Job Traveller Landscape| FP WO Margin (20) | | account.payment | FP Receipt Portrait | FP Receipt Landscape | | | fp.delivery | FP BoL Portrait | FP BoL Landscape | | | portal.job | FP CoC Portrait | FP CoC Landscape | | | fp.certificate | FP CoC English | FP CoC Français | | Odoo defaults stay at sequence 100 (default) → always at bottom. Verified on entech: sale.order print menu now shows Quotation Portrait → Quotation Landscape → Job Traveller × 2 → PRO-FORMA → Timesheets. Same pattern across all touched models. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -82,4 +82,86 @@
|
||||
<field name="binding_type">action</field>
|
||||
</record>
|
||||
|
||||
<!-- ================================================================
|
||||
Print-menu sequencing — pin FP reports to the TOP of each
|
||||
dropdown so customer-facing reports appear before internal
|
||||
Odoo defaults (timesheets, picking ops, finished-product
|
||||
labels, etc.) which now sit at sequence 100 by default.
|
||||
|
||||
Convention: Portrait = primary (10) → Landscape = secondary (15)
|
||||
================================================================ -->
|
||||
|
||||
<!-- sale.order: Quotation/Sales Order is the primary -->
|
||||
<record id="fusion_plating_reports.action_report_fp_sale_portrait" model="ir.actions.report">
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
<record id="fusion_plating_reports.action_report_fp_sale_landscape" model="ir.actions.report">
|
||||
<field name="sequence" eval="15"/>
|
||||
</record>
|
||||
<record id="fusion_plating_reports.action_report_fp_job_traveller_so_portrait" model="ir.actions.report">
|
||||
<field name="sequence" eval="20"/>
|
||||
</record>
|
||||
<record id="fusion_plating_reports.action_report_fp_job_traveller_so_landscape" model="ir.actions.report">
|
||||
<field name="sequence" eval="25"/>
|
||||
</record>
|
||||
|
||||
<!-- account.move: Invoice — Plating is the primary -->
|
||||
<record id="fusion_plating_reports.action_report_fp_invoice_portrait" model="ir.actions.report">
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
<record id="fusion_plating_reports.action_report_fp_invoice_landscape" model="ir.actions.report">
|
||||
<field name="sequence" eval="15"/>
|
||||
</record>
|
||||
|
||||
<!-- stock.picking: Packing Slip is the primary -->
|
||||
<record id="fusion_plating_reports.action_report_fp_packing_slip_portrait" model="ir.actions.report">
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
<record id="fusion_plating_reports.action_report_fp_packing_slip_landscape" model="ir.actions.report">
|
||||
<field name="sequence" eval="15"/>
|
||||
</record>
|
||||
|
||||
<!-- mrp.production: Job Traveller is the primary -->
|
||||
<record id="fusion_plating_reports.action_report_fp_job_traveller_mo_portrait" model="ir.actions.report">
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
<record id="fusion_plating_reports.action_report_fp_job_traveller_mo_landscape" model="ir.actions.report">
|
||||
<field name="sequence" eval="15"/>
|
||||
</record>
|
||||
<record id="fusion_plating_reports.action_report_wo_margin" model="ir.actions.report">
|
||||
<field name="sequence" eval="20"/>
|
||||
</record>
|
||||
|
||||
<!-- account.payment: Receipt — primary -->
|
||||
<record id="fusion_plating_reports.action_report_fp_receipt_portrait" model="ir.actions.report">
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
<record id="fusion_plating_reports.action_report_fp_receipt_landscape" model="ir.actions.report">
|
||||
<field name="sequence" eval="15"/>
|
||||
</record>
|
||||
|
||||
<!-- fusion.plating.delivery: Bill of Lading -->
|
||||
<record id="fusion_plating_reports.action_report_fp_bol_portrait" model="ir.actions.report">
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
<record id="fusion_plating_reports.action_report_fp_bol_landscape" model="ir.actions.report">
|
||||
<field name="sequence" eval="15"/>
|
||||
</record>
|
||||
|
||||
<!-- fp.certificate: English-first by default -->
|
||||
<record id="fusion_plating_reports.action_report_coc_en" model="ir.actions.report">
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
<record id="fusion_plating_reports.action_report_coc_fr" model="ir.actions.report">
|
||||
<field name="sequence" eval="15"/>
|
||||
</record>
|
||||
|
||||
<!-- portal job CoC -->
|
||||
<record id="fusion_plating_reports.action_report_coc_portrait" model="ir.actions.report">
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
<record id="fusion_plating_reports.action_report_coc" model="ir.actions.report">
|
||||
<field name="sequence" eval="15"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user