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

In Odoo version 17, can I insert views (model="ir.ui.view") inside view depending on a field of the model of the main view? Like this one:

<odoo>
    <data>
        <record model="ir.ui.view" id="shipment_form_view">
            <field name="name">shipment.form.view</field>
            <field name="model">shipment</field>
            <field name="arch" type="xml">
               <form>
                  <field name="transport" />
                  <!--
                  If transport == air, use air.shipment.form.view
                  If transport == ocean, use ocean.shipment.form.view
                  -->
        </record>

        <record model="ir.ui.view" id="air_shipment_form_view">
            <field name="name">air.shipment.form.view</field>
            <field name="model">shipment</field>
                <form>
                    <field name="name"/>
                    <field name="flight_no"/>
               ...
        </record>

        <record model="ir.ui.view" id="ocean_shipment_form_view">
            <field name="name">ocean.shipment.form.view</field>
            <field name="model">shipment</field>
                <form>
                    <field name="name"/>
                    <field name="voyage_no"/>
               ...
        </record>
         ...

I tried using the using the owl directive but it displayed an error, that it is illegal

<t t-if>
아바타
취소
작성자

Thanks, I do not have karma to check or upvote your comments.

베스트 답변

No. 

What you do instead is make View elements invisible.


Take a look at how we do this on the Product Form View, depending on the Product Type:

You can make Notebook Pages invisible (even giving them the same name) to give the appearance that they are changing based on the field, when really one is becoming invisible and the other visible.

아바타
취소
관련 게시물 답글 화면 활동
4
1월 24
23215
Attrs attribute 해결 완료
2
1월 24
2515
0
8월 23
2333
5
9월 21
17574
3
1월 21
16845