Odoo Help


How to prevent "Add an item" if parent is not saved?

on 4/26/15, 8:35 AM 420 views


How to prevent the "Add an item" of One2Many widget from showing a popup form if the parent form is not saved?



Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
--Ahmed M.Elmubarak--

Ahmed M.Elmubarak
On 4/27/15, 3:14 AM

Hello Emad,

We can do a simple trick. Every model has ID field, will generated automatically after saving, before saving this field has no value.

So in your form view of the parent add

<field name="id" invisible="1"/>

then in your o2m field add attrs like :

<field name="o2m_ids" attrs="{'readonly': [('id','=',False)]}">
<tree editable="bottom">

I hope it'll help you 

Regards ....

On 4/27/15, 3:53 AM

Thank you Ahmed. It has worked perfectly.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/26/15, 8:35 AM
Seen: 420 times
Last updated: 4/27/15, 3:53 AM