Search code examples
pythonpython-2.7odooodoo-8odoo-view

Odoo How to remove Create button in a model without effect to One2many?


I have created two models named Enrollment and Student. In Student Model there is an one2many field called enrollment_ids.

I just want to create Enrollment through that one2many field.

I can remove create button from kanban & form views. But If I remove Create button from tree view I cannot either add enrollment from that one2many field...

How should I complete my Requirement....?


Solution

  • You need to have to separate tree view for Enrollment, one for Enrollment's main view the other inside student view :

    <field name="enrollment_ids" editable="bottom">
        <tree string="This Enrollment tree view inside student">
                <field name="state"/>
                <field name="name"/>      
        </tree>   
        <form string="This Enrollment form view inside student" >
                <field name="state"/>
                <field name="name"/>       
        </form>           
    </field>
    

    If you still not sure how to do it, just show me your student view xml code.