This question has been flagged

I am developing new modules for real estate on my Synology DS412+, when i modify one of my new modules:

- if for example, i add a new field : "basement"  in the .py file and in the .xml file

when i click to update the modified module, OpenERP  check the coherence of the modified module and say that the new fields dont exist in the model: 

Error message: 

except_orm: ('View error', u"Can't find field 'basement' in the following view parts composing the view of object model 'apartment':\n * apartment.formb\n * apartment.form\n\nEither you wrongly customized this view, or some modules bringing those views are not compatible with your current data model")

As if OpenERP did not complile the modified module and dont create the new field....

I have read on this forum that i have to restart the OpenERP Server so that the modified module is recompiled. But it is not enough, the same error occurs.

To resolve the problem i have created a new module who inherit from the object i want to modifiy and inserted the new field in the second module by heritage. It works but it is not very acceptable to do this...

Could you please say me what is wrong in my approach????

Avatar
Discard
Best Answer

You need to restart OpenERP if you make changes in .py files, and you only need to update your module if you make changes in xml. You will need to do both if you add  or remove fields in a model or create a new model.
 

EDIT:
You are still getting the same error because you have already tried to upgrade your module before restarting the server.
To solve that remove your .xml view from the __opernerp__.py file, restart the server, update the module list and the module, add the .xml view again to __openerp__.py and update the module again.
This might help.

Avatar
Discard
Best Answer

Restart openerp with the flags -d <database> -u <moduleName> .

These flags update the xml views and create new fields in the database. It does not delete old fields that are no longer needed from the database.

Avatar
Discard
Author Best Answer

Thank you for your answers, i understand i have to restart when i modify the .py

But i have restarted and i always have the same error!!!

Could you help more precisely? For example do i have to uninstall the modified module before réinstall?

 

Thank you Sajad KK it is clear now i have made many updates in the .xml without restarting and one update in the .py with resart of OpenERP and it is clear for me the good strategy is to write directly the exact needed .py 

I genraly itarated the object structure and with OpenERP it is not a good approach. Thank you.

 

Avatar
Discard
Best Answer

Hi,

When change in .Py file you need to restart server.

Restart server then upgrade your module

Thanks

 

Avatar
Discard