I added a field x_part_number through the web interface. This is before I realized it needed to be added by a custom module. However we have over 6000 products and the x_part_number field is populated in every product.
I want to create a custom module addon to add the part x_part_number instead and remove it from the way I added it in the web interface.
Can I do this without it affecting the database? If it will affect the database how can I fix it?
Now that you've created it, it's probably easier to leave it alone.
It doesn't need to be in a custom module. Fields are prefixed with x_ specifically so they will not be removed during upgrades. It is certainly more convenient for it to be in a custom module, but technically it isn't necessary.
To remove it you need to reverse the SQL changes made to the database when it was created, which includes updating Odoo metadata tables.
This is what happens when you add a simple field to an Odoo model:
A row is inserted in ir_model_fields
The table in PostgreSQL is altered to have the new column added
Reverse these and the field is gone.
Warning: You will lose all the data in this field, so make sure you have a copy if you need it.
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
|Asked: 9/11/15, 11:05 AM|
|Seen: 565 times|
|Last updated: 5/19/16, 9:29 AM|