Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Extend an existing model with a new field with required=True will FAIL if Data is already in the Database?
I try to extend an existing model (calendar.event) with an new field "category" with required = True.
The addon can be installed on new databases without any problem and also the SQL constraint (NOT NULL) is successfully set for new Databases.
The Problem is that for databases with existing data the new field would need a default value for all of the existing data records or it could not set the SQL constraint and it will throw an error when installed. I really do not want to use a default value for this new field because the user should correctly enter a value!
Is there a way to set a value for all existing records in the database, so that installation would work, but no default value for added fields with required=True ?
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 8/11/15, 8:34 AM|
|Seen: 385 times|
|Last updated: 8/12/15, 12:09 AM|