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

In odoo 18 we can create custom form so in header side are by default show Save and Cancel button so how to hide for particular form ya module not global?  
this is my code and i do not want to non editable form edit="false" 

so what i do?

<odoo>

    <!-- Main form view -->

    <record id="view_theappsherpa_registration_form" model="ir.ui.view">

        <field name="name">theappsherpa.registration.form</field>

        <field name="model">theappsherpa.registration</field>

        <field name="arch" type="xml">

            <form string="Registration" create="false" edit="true" readonly="0">

                <sheet>

                    <notebook>

                        <page string="Existing Registration">

                            <group>

                                <field name="secret_key"/>

                                <field name="project_version"/>

                                <button name="save_registration"

                                        string="Save"

                                        type="object"

                                        class="btn btn-primary"/>

                                <button name="reset_registration"

                                        string="Reset"

                                        type="object"

                                        class="btn btn-secondary"/>

                            </group>

                        </page>

                        <page string="New Registration">

                            <group>

                                <field name="company_name"/>

                                <field name="username"/>

                                <field name="email"/>

                                <field name="password" password="True"/>

                                <field name="confirm_password" password="True"/>

                                <field name="phone"/>

                                <!-- Button dikhaye jab user REGISTER NAHI hua ho -->

                                <button name="submit_new_user_registration"

                                        string="Register"

                                        type="object"

                                        class="btn btn-success"

                                        invisible="is_registered"/>


                                <!-- Button dikhaye jab user REGISTER HO CHUKA ho (readonly) -->

                                <button name="dummy_registered_button"

                                        string="Registered"

                                        type="object"

                                        class="btn btn-secondary"

                                        disabled="1"

                                        invisible="not is_registered"/>

                            </group>

                        </page>

                    </notebook>

                </sheet>

            </form>

        </field>

    </record>


    <!-- Save and Discard button are hide -->


    <!-- Inherited view to remove Save/Discard -->

    <record id="view_theappsherpa_registration_form_inherit" model="ir.ui.view">

        <field name="name">theappsherpa.registration.form.inherit</field>

        <field name="model">theappsherpa.registration</field>

        <field name="inherit_id" ref="theappsherpa.view_theappsherpa_registration_form"/>

        <field name="arch" type="xml">

            <form position="attributes">

                <attribute name="save_on_edit">false</attribute>

                <!-- <attribute name="edit">false</attribute> -->

            </form>

        </field>

    </record>



    <!-- Action -->

    <record id="action_theappsherpa_registration_server" model="ir.actions.server">

        <field name="name">Open Registration</field>

        <field name="model_id" ref="model_theappsherpa_registration"/>

        <field name="binding_model_id" ref="model_theappsherpa_registration"/>

        <field name="state">code</field>

        <field name="code">action = env['theappsherpa.registration'].get_registration_action()</field>

    </record>


    <!-- Menu -->

    <menuitem id="menu_theappsherpa_registration"

              name="Registration"

              parent="menu_theappsherpa_root"

              action="action_theappsherpa_registration_server"

              sequence="110"/>

</odoo>

아바타
취소
작성자

but i want to use form so any other solution are available?

베스트 답변

Hiding wouldn't do anything for you due to the auto-save feature.

Consider creating a wizard (transient model with action window). This is closer to the UI you're looking for. In there you could define your own <footer/> overriding the default Sale/Cancel buttons.

As a reference, see for example the process of creating an Invoice from a Sales Order. There you have a action window allowing for user input and button interactions.

아바타
취소
관련 게시물 답글 화면 활동
2
8월 25
339
1
9월 25
385
1
9월 25
308
0
8월 25
309
3
8월 25
452