This question has been flagged
1 Reply
6326 Views

hello ,

I will start by thanking anyone who has picked my question . so , here is my issue . I created a module on odoo CE 11. and in my model i used  the field 'Active'. when I installed that module and loaded it on local , i noticed something:

"i couldn't save a new object without checking the 'Active' field.I guess this is because the default value of that field (the "active" field) is true.The most strange for me, i did not  assign the instruction "default=True" to that field in my model.

Seeing that i was  able to save my new object only if the field active is checked , I modified my model again : I  changed his name , and removed the field 'active'. I removed my module and installed it again. Now my module works perfectly. I can create and save object now using my form. My object is visible on the tree view. so here are my questions:

1.Can somebody please understand why i had to check the field 'active' for the object to be saved by my form view in my tree view ? ( based on the fact that i did not made that field required or did not set the instruction "default=True" on that field ? )

2. now i have a my old model that i want to delete but when i am trying to delete it i have the message :" Model 'filter on warehouses' contains module data and cannot be removed". Please can somebody help me , how can i have access to these datas ? so that i can first delete them

once again thank you for your help and your understanding

Avatar
Discard
Best Answer

Hi,

For every model in the odoo, there are some fields which are coming by default, the field named active is one of them, 

Other fields are, id, create_uid, write_date etc.


The field named active is used to check whether the record is active or not. By default, if you untick the active field of a record it will not display in the user interface.


Am not aware of what purpose you have added the field named 'active' in your model, either you can change the name of your field, or go with the default functionality.


For the next point in your question have a look at this answer: https://www.odoo.com/forum/help-1/question/solved-error-model-training-custom-contains-module-data-and-cannot-be-removed-85604


Thanks


Avatar
Discard
Author

hi thank you for your answer sorry i took long to reply.All you said is true the active field is one of the reserved field. And for my issue with my model , i have installed pgAdmin III and created a connexion to my odoo database based on the my user and password specified on my odoo.conf file.Then i had access to all my models and their attached datas.So, it became easier for me to write queries in order to remove the model and their datas.Once again thank you very for your help.