Skip to Content
Menu
This question has been flagged
2 Replies
8147 Views

Hi there odooers,

I'm trying to setup a status bar such that it is shown at all times, but only clickable when the user is in edit mode.

`<header> <field name="state" widget="statusbar" class="oe_edit_only" options="{'fold_field': 'fold'}" statusbar_visible="available,appointment,locked,annulled" /> </header>`

The class = "oe_edit_only" is not working well in this case, since it hides it completely in view mode. I want it to be shown but in a non clickable way.

Any insight about this?

Thanks a lot,

Andrés.


Avatar
Discard
Best Answer

Since this was never answered, and I kept getting this thread as the first result when googling, I was able to solve this using these pieces of code:

xx_stage_id = fields.Many2one(comodel_name="xx.project.stage",string="Stage",tracking=True,index=True,default=_get_default_stage_id,group_expand="_read_group_stage_ids",    )
xx_stage_id_clickable = fields.Many2one(related="xx_stage_id", tracking=False)

@api.onchange("xx_stage_id_clickable")
def_set_stage_id_to_stage_id_clickable(self):
    for rec in self:
        rec.xx_stage_id = rec.xx_stage_id_clickable




For some reason having the same filed as clickable:1 in read mode and clickable:0 in edit mode did not seem to work, so I made this workaround which achieves the desired resuls.

Avatar
Discard
Author Best Answer

Anyone??

Avatar
Discard
Related Posts Replies Views Activity
4
Jan 22
5701
1
Aug 19
4875
1
Mar 15
3917
1
Mar 15
4271
1
Mar 15
3446