Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
10195 Lượt xem

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.


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Anyone??

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 1 22
7692
1
thg 8 19
6255
1
thg 3 15
5630
1
thg 3 15
5533
1
thg 3 15
4769