I make a selection field that [('1','a'),('2','b'),('3','c')]
when I reference this field it comes out 1,2,3
how can I make it to show a,b,c instead of 1,2,3?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I make a selection field that [('1','a'),('2','b'),('3','c')]
when I reference this field it comes out 1,2,3
how can I make it to show a,b,c instead of 1,2,3?
You need to access the selection field .selection value and search for the display value. You could define a function in a parser to do that. This should help
<pre>
def __init__(self, cr, uid, name, context):
super(report, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'get_selection_value': self._get_selection_value,
})
def _get_selection_value(self, model, field, value):
selection = self.pool.get(model)._columns.get(field).selection
val = ''
for v in selection:
if v[0] == value:
val = v[1]
break
return val
<pre>
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.