How To Create Odoo Clickable Status Bar

Altela Pramardhika Avatar

State in Odoo is one of the vital element or fields that represent the state of the record. This article explain to you how to create clickable status bar.

How To Create Clickable State Bar in Odoo

In order to make a clickable status bar, you can simply define an “options” properties in your Odoo Python and XML files.

Below is the completed code block, which later will be explained one by one.

Python Code

state = fields.Selection([
    ('on_progress', "On Progress"),
    ('done', "Done"),
    ], default='on_progress', string="State", index=True, tracking=True)


state = fields.Selection([]) is a field definition to create a selection. and inside of the bracket is the selection values. ‘on_progress’ is value in the backend and ‘On Progress’ is what showing in the user side.

default = ‘on_progress’ will set the ‘On Progress’ state as default once a record is created.

string = “State” will define a string name (this mostly unnecessary to define it).

index = True is a property that allows database to index to speed up the process of query and search. In excessive indexing for fields can cause database size rapidly, thus use this with caution.

tracking = True will track all changes of the state in the chatter logs message (mostly on the bottom or the right if your screen resolution is big enough.

XML Code

<field name="state" widget="statusbar" options="{'clickable':1}"/>


<header> and <header /> is a place where do you want to pin the State in.

<field name = “state” .. /> is a field invocation that already created in the Odoo Python files earlier.

widget = “statusbar” is a default widget that comes from Odoo which responsible to define a field state that has “staged” visual.

options=”{‘clickable’: 1}” /> is a property that let the widget is clickable.

That’s how you can define a clickable state in Odoo. I hope it’s helpful for you.

Leave a Reply

Your email address will not be published. Required fields are marked *

More Articles & Posts