Odoo Help

0

Extend an existing model with a new field with required=True will FAIL if Data is already in the Database?

By
Michael Karrer
on 8/11/15, 8:34 AM 536 views

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 ?

Already answered here: https://www.odoo.com/forum/help-1/question/is-there-a-way-to-set-a-value-for-a-field-for-all-existing-records-in-the-database-at-addon-installation-only-89400

Marvin Taboada
on 8/12/15, 12:09 AM

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

Question tools

1 follower(s)

Stats

Asked: 8/11/15, 8:34 AM
Seen: 536 times
Last updated: 8/12/15, 12:09 AM