Is your feature request related to a problem?
Actually, when you create a custom attribute, an alter of the table is performed to add a new column to store the attribute. The main issue is that while an alter on a table is performed, the table is lock by PostgreSQL. This mean that if you have a user that add a new attribute and one that is doing a search on the same table, the search will be blocked until the alter is finished.
This problem is solved if you use serialized attributes. It uses the base_sparse_field addon to store the attributes in a serialized column, this mean that the table is not altered. But you can't perform search on these attributes.
We want to avoid the alter of the table and still be able to perform search on attributes.
Another improvement is to allow the user to define fields that would be displayed on a search panel for a given model(product.template) to perform a search without having to create a new filter in the search.
Describe the solution you'd like
We can use the jsonb field of PostgreSQL to store the attributes. PostgreSQL provide a very good support for jsonb field to perform search and index on it.
For the search panel, we could reuse the widget search panel of Odoo and add a new field to define the field that would be display on the search panel. This widget only support field if type selection or many2one. We could extend it to support boolean to.
Describe alternatives you've considered
We have considered to use Elasticsearch to store the attributes. But this implied to have a new dependency and to have a new service to maintain.
Additional context
If we want to use other type of storage, we could extend our implementation with a new type of field and have a nice base to start with the implementation done for the jsonb field.
How to use :
In the attribute creation menu you now have a new type of attribute named 'Json_postgresql' with the same option as custom field except this field can't be serialized.
![image](https://private-user-images.githubusercontent.com/67290591/238562135-cf34ef40-c56d-4472-80bd-871ceaee5cec.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQ5MTkzMDMsIm5iZiI6MTcwNDkxOTAwMywicGF0aCI6Ii82NzI5MDU5MS8yMzg1NjIxMzUtY2YzNGVmNDAtYzU2ZC00NDcyLTgwYmQtODcxY2VhZWU1Y2VjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTEwVDIwMzY0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY2NzkwNjc5NDA2ZDdmYzkzY2E3YzVmMTI0NTVlY2ZhZDkwNjBiOTZlNmVkMmQyYjk3OWYwODRkYTQwY2RhMzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.MCMozCaZe-nftzIGmBoLDxfFhETrrXWbcZlO8tnBpVY)
Some type of field are not supported, Select and Multiselect because json_field does not support relation in PostgreSQL. But the Select type can be replaced by the Selection type that use selection field of Odoo.
For the search panel once the module is installed, you can go to Settings > Search panel fields and then select the field that should appear on the search panel. But be sure that the model you want to have the search panel inherit search.panel.mixin or nothing will show.
![image](https://private-user-images.githubusercontent.com/67290591/238570319-b2d247ed-c2c7-49bb-9031-570a4d8a328a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQ5MTkzMDMsIm5iZiI6MTcwNDkxOTAwMywicGF0aCI6Ii82NzI5MDU5MS8yMzg1NzAzMTktYjJkMjQ3ZWQtYzJjNy00OWJiLTkwMzEtNTcwYTRkOGEzMjhhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTEwVDIwMzY0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYyY2E1ZGIxNzllYWMxZDI5NDcxY2E5MGEyOTY3NDc3MzNiYmQ3MzYxMTg1YWEwYWVjZjRhZjE4NDk4YjQzNDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ctZhQIIu-cwOyP5ksXngR3bEugrdT-5WGyNzVY8jGbw)
Once a field is selected, it appears on the search panel, it will only display the value present in the database, if you have a selection field with the values wood, plastic, iron and iron isn't selected on any model than it won't be displayed.
![image](https://private-user-images.githubusercontent.com/67290591/238570536-146876ea-d7c2-4f81-913b-e2401939e32f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQ5MTkzMDMsIm5iZiI6MTcwNDkxOTAwMywicGF0aCI6Ii82NzI5MDU5MS8yMzg1NzA1MzYtMTQ2ODc2ZWEtZDdjMi00ZjgxLTkxM2ItZTI0MDE5MzllMzJmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTEwVDIwMzY0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJmMzgwNDU2YTUyOWZmOTRhNGQzNjFmZDQzNGE3OTM1YmVmMTQ3ZDA2YTg2NjUyNmZkNmI5Mzc1NmVlOTYxNjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.LF7JwaHli67ha6Uq9LVWywDLfwCzd9WOfCf09sfFb5g)
Todo :
Pull request :
Attribute json 16
#145
#146
#147
Search panel 16
#148
#149
#150
Attribute json 14
#154
#155
#156
#157
Search panel 14
#158
#159
#160