Error Upgrading After Adding New Field to res.users and res.company
Updated: Oct 7, 2021
If you come to this blog looking to solve the error when upgrading your custom module, you've came to the right place.
res.users and res.company are loaded whenever you accessing the Odoo, and Odoo system detecting new field in the model prior to your upgrade (creating in the database table) will throw the error instantly.
This Odoo technical development blog is my way to contribute back to the Odoo Community, for all the selfless and great sharing by the community members.
1) Error upgrading custom module when adding new field to res.company
Solution: commented out the new field in the model and go to the App module. Then, uncommented out the new field and restart the Odoo. Since you are in the App module, just upgrade it.
Note: If you have multiple Odoo databases in the same instance, which happened to use the same module, will have the same issue to other databases.
2) Error upgrading custom module when adding new field to res.users
Solution: upgrading your custom module instantly when starting the Odoo.
odoo-bin -c odoo.conf -d database_name -u module_name
Example to upgrade the module when starting Odoo in the Linux.
./odoo-bin --addons-path=../custom/addons,addons --db-filter=db_name -u my_module_name --xmlrpc-port=8069
In the pycharm.