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

I would like to mark the opportunity stages readonly. I've tried the following ways

Method 1

'stage_id': fields.many2one('crm.case.stage', 'Stage', track_visibility='onchange',
                    domain="['&', '&', ('fold', '=', False), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]",readonly=True),

Method 2

<field name="stage_id" widget="statusbar" clickable="False"
                        domain="['&amp;', '|', ('case_default', '=', True), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"
                        on_change="onchange_stage_id(stage_id)"/>

Both the methods didn't work out. Kindly help me to do this.

Ảnh đại diện
Huỷ bỏ

Its working, I checked in crm opportunity.

Tác giả

which method working zahin, it's not working for me.

clickable="False", please check that which file you editing, is exactly updating in openerp IR:view or not. Use debug mode to trace the things.

Hy zahin, I use the same syntax with clickable="False" and check that the view is properly displayed. Yet the status bar still clickable.

Câu trả lời hay nhất

I found the answer

In order to set the status_bar unclickable use attrs :

attrs="{'readonly':True}"

Delete readonly tag and clickable one. It worked for me

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

Hi guys,

Best way is tu use options="{'clickable':True}" if you want to be able to click the statusbar states or options="{'clickable':False}" if you don't want to do that. You can also make statusbar clickable based on some condition, for example options="{'clickable':['statusbar_clickable','=',True]}"

Cheers!

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

you can use clickable="True" or clickable="False" in xml.

<field name="state" widget="statusbar" clickable="True"/>

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 9 23
1901
4
thg 1 22
7394
5
thg 12 23
22613
0
thg 8 16
4111
1
thg 3 15
5330