How to add a new field to odoo view through web interface
And avoid it to be removed while updating modules
The following steps describe the basic case about how to add a textual field to an odoo view. In this way you are also sure that you will not loose your changes when in future will update odoo modules.
- Activate developer mode
- Go to Configuration -> technical -> Database structure -> Models
- Open for example account.invoice
- Add a textual field x_test
- Go to invoices list
- From debug menu click on manage views
- Click on edit
- Click on the field where you want to add the new field (e.g. state)
- Click on inherited view
- Select the new node (state) and click on '+'
- Select x_test
Obviously, this method can't cover every possible use case and you often will need to develop a module, but it can help in some simple cases
Alternatively, you could use the Non Updatable on the ir.model.data record of the main view, modifying it directly and avoiding to create an inherited view. But this will prevent future updates (possibly bugfixes) for the main view to be applied. Instead, using inherited view, the main view will be able to receive bugfixes and your view will just extend it.