Odoo Help

Welcome!

This community 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.

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 363 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

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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