How to add a new field to odoo view through web interface
And avoid it to be removed while updating modules
01 luglio 2015
Agile Business Group Sagl, Lorenzo Battistini
Sometimes you need to add a simple field to odoo views but you don't want to develop a new module just for that.
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
- Update
- Close
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
Note
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.
Lascia un commento
Devi essere autenticato per inviare un commento.