콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
336 화면

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.

아바타
취소
작성자

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


베스트 답변

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

아바타
취소
관련 게시물 답글 화면 활동
0
10월 25
143
1
8월 25
1439
1
7월 25
1878
0
5월 25
1264
1
4월 25
2689