跳至内容
菜单
此问题已终结
2 回复
10228 查看

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.


形象
丢弃
最佳答案

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.

形象
丢弃
编写者 最佳答案

Anyone??

形象
丢弃
相关帖文 回复 查看 活动
4
1月 22
7697
1
8月 19
6265
1
3月 15
5632
1
3月 15
5541
1
3月 15
4773