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

how to display string in the selection field to another text field by clicking the value in the selection field. for example i have selection field with values male and female.i have a empty text field.when i click male ,it should display it in the text field.when i click fe-male ,it should display it in the text field.

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

If you want to get label of selection field then please refer: 

https://www.odoo.com/forum/help-1/question/selection-field-label-42889

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

To obtain the value of a selection, try this model is the name of the model, example: 'account.invoice' field is the name of the field inside the model, example: 'state' field_val is the value of that field, example: 'draft' Code: dict(self.pool.get(model).fields_get(cr, uid, allfields=[field], context=context)[field]['selection'])[field_val] Example: dict(self.pool.get('account.invoice').fields_get(cr, uid, allfields=['state'], context=context)['state']['selection'])['draft']

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

Hey Vasanth

Did you get the answer for this question?

Ảnh đại diện
Huỷ bỏ
Tác giả

yes. By onchange method , we can achieve my requirement

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

yes of course you can with on_change method

but instead of using return domain

u can return value with onchange method

you seach in google with keyword "odoo onchange return value"

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

Hi,

You can use onchange method for that.

Thanks

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