Odoo Help

Welcome!

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.

0

Why my status bar doesn't have any colors and it's not aligned with the buttons?

By
Juan Formoso
on 12/1/14, 9:35 AM 1,129 views

I created a field of type selection, this is my Python code:

'state': fields.selection(
    [('draft', 'Draft'),
    ('cancelled', 'Cancelled'),
    ('invited', 'Invited'),
    ('rejected', 'Rejected'),
    ('awaiting', 'Awaiting'),
    ('not_coming', 'Not coming'),
    ('coming', 'Coming'),
    ('absent', 'Absent'),
    ('attended', 'Attended'),
    ('completed', 'Completed')],
    'State', size=16, readonly=True),

I'm trying to see it as a status bar, and this is my XML code:

<form string="Event Meeting Registration" version="7.0">
    <header>
        <button name="move_to_cancelled" string="Cancel Registration"
         states="draft,invited" type="object"/>
        <field name="state" nolabel="1" widget="statusbar"
         statusbar_visible="draft,invited,rejected,awaiting,not_coming,coming,absent,attended,completed"/>
    </header>
    <sheet>...</sheet>
</form>

The result: I can see the button and the status bar, but the button is a line above the status bar, and the status bar is not highlighting the current state. For example, I open a record with th state draft, and this state is not highlighted, is grey like the other ones, and you can't know which state the object is in.

How can I align the button to the status bar? I tried to put the button and the field state between div tags, and even set their styles with foalt left and right, but when I did that, I wasn't able to see the status bar (I think the button occupies the whole line and the status bar was behind the button).

How can I see the current state highlighted?

Thank you in advance.

1
Juan Formoso
On 12/1/14, 10:38 AM

Ok, I got the solution to both problems.

In addition to having state in the header, I had it in the form sheet too, this way:

<sheet>
    ...
    <field name="state"/>
    ...
</sheet>

I had to remove that line, and when I did, both problems were solved at the moment. Hope it helps to anyone.

NOTE

I was able to solve it that way in OpenERP 7, but now, in Odoo 8, I have just faced the same problem and this time I was able to solve it putting the buttons and the field state inside the same <div>. So I guess if you have this problem, here you can find two possibilities in order to fix it.

You can make it invisible if you don't want it to get displayed.

Ivan
on 12/1/14, 8:13 PM

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

1 follower(s)

Stats

Asked: 12/1/14, 9:35 AM
Seen: 1129 times
Last updated: 8/10/15, 6:09 PM