跳至內容
選單
此問題已被標幟
3 回覆
13765 瀏覽次數

I'm a beginner, about Odoo 8.

Is there a way to give boolean checkbox in the list view as yes or no.
Boolean To String.

true, yes, false, no = _(u"true"), _(u"yes"), _(u"false"), _(u"no")

This does not work properly. Is there a solution on a py basis?

<field name="Name2" attrs="{'invisible':[('Name1','=',False)]}"/>

'Name1': fields.boolean('Name1', readonly=True, states={'Draft': [('readonly', False)]}),

  <tree string='List'>
                        <field name="Name1"/> Output as Yes or No
                    </tree>


Maybe with: true, yes, false, no = _(u"true"), _(u"yes"), _(u"false"), _(u"no")

頭像
捨棄

Why don't you try selection field instead of boolean.

最佳答案

Hai Aleks..!
you can achieve this by selection field. 

field_name = fields.Selection([('yes', 'Yes'), ('no', 'No')], string='Yes/No')


頭像
捨棄
作者 最佳答案

Thanks, very good answer.   Odoo 8

'field_name' : fields.selection([('yes', 'Yes'), ('no', 'No')], string='Yes/No'),
<field name="field_name" widget="radio"/>

 or

'field_name' : fields.selection([('yes', 'Yes')], string='Yes'),

<field name="field_name" widget="Radio"/>


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
4月 20
5224
0
4月 15
3109
4
8月 23
15175
0
3月 25
2874
2
4月 23
4453