Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
162 Vistas

Hi all,

I’m trying to make a QWeb report (“Cheque / Receipt”) available only for vendor payments in Odoo 17. Here’s my setup:

  • Report action XML has binding_model_id="account.payment" so it appears in the Print menu.

Problem:

  • The report still shows in the Print menu for all payments, including customer/internal payments.
  • I want the menu item to completely disappear for non-vendor payments, without creating a separate button.

Avatar
Descartar
Autor

ValueError: Invalid field 'domain' on model 'ir.actions.report'


Mejor respuesta

Hi,

To restrict a QWeb report to only vendor payments in Odoo 17, add a domain to your report action XML. Locate the XML ID of your report action and insert a <field name="domain"> tag with the value [('payment_type', '=', 'outbound')]. This ensures the report is only visible for payments where the payment_type is "outbound," which typically represents vendor payments.


After modifying the XML, upgrade your module. The "Cheque / Receipt" report option should now only appear in the Print menu for vendor payments, disappearing for other payment types. Ensure your account.payment records have the correct payment_type values and clear your cache if needed.


Try the following.


<record id="your_module.action_report_cheque_receipt" model="ir.actions.report">

    <field name="name">Cheque / Receipt</field>

    <field name="model">account.payment</field>

    <field name="report_type">qweb_pdf</field>

    <field name="report_name">your_module.report_cheque_receipt_template</field>

    <field name="report_file">your_module.report_cheque_receipt_template</field>

    <field name="binding_model_id" ref="account.model_account_payment"/>

    <field name="binding_type">report</field>

    <field name="domain">[('payment_type', '=', 'outbound')]</field>  <!-- Add this line -->

</record>



Hope it helps

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
ago 25
1302
1
jul 25
1673
0
may 25
1220
1
abr 25
2571
1
sept 25
1795