Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to use a placeholder with a field selection?

Anabela Damas
on 11/6/13, 12:06 PM 1,737 views


I'm trying to remove "state" field in the res_partner address, because in Portugal there is no state in the address. So I'm trying to replace the state field with the "distritos" field.

I created the field like this:

_columns = {
    'distritos': fields.selection([
        ('av', 'Aveiro'),
        ('bj', 'Beja'),
        ('bg', 'Braga'),            
        ('bgc', 'Bragança'),
        ('cb', 'Castelo Branco'),
        ('c', 'Coimbra'),
        ('ev', 'Évora'),
        ('fr', 'Faro'),
        ('g', 'Guarda'),
        ('lr', 'Leiria'),
        ('lx', 'Lisboa'),
        ('ptg', 'Portalegre'),
        ('pt', 'Porto'),
        ('st', 'Santarém'),
        ('sb', 'Setúbal'),
        ('vc', 'Viana do Castelo'),
        ('vr', 'Vila Real'),
        ('v', 'Viseu'),

In the view I tried like this :

        <xpath expr="//field[@name='state_id']" position="replace">       
        <field name="state_id" invisible="True"/> 
        <xpath expr="//field[@name='country_id']" position="before">       
        <field name="distritos" placeholder="Distritos"/>

But "Distritos" is shown in black (image below) , and I wanted that the color was grey like in the other type of fields (like "País" in the image below).

image description

Someone knows if it is possible to use placeholders with a field selection ?


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 11/6/13, 12:06 PM
Seen: 1737 times
Last updated: 3/16/15, 8:10 AM