Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
209 Tampilan

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>

Avatar
Buang
Penulis

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

Jawaban Terbai

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.

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
0
Agu 25
116
3
Agu 25
209
0
Agu 25
202
1
Agu 25
425
1
Agu 25
476