コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
3777 ビュー

Hi everyone,


I have added a field in the res.partner model which I want to update with a drop-down selection from the front end. below is my code, but it's not updating the field


<select class="form-control oe_edit_only" name="x_salutation_test">

<option value="herr">Herr</option>

<option value="frau">Frau</option>

</select>


Also, after the update, I want that field to be selected. how can I do that?


Thanks

アバター
破棄
最善の回答

I am unsure why you are doing it this way specifically, maybe I am not understanding.

But my solution would be to make the field on the model in python as:

x_saluation_test = fields.Selection([("herr", "Herr"), ("frau", "Frau")], string="my selection", default="herr")

Then on the view you just need to put <field name="x_saluation_test"/> and it will create the selection widget for you. 

Also, use the "default" parameter to select a default value. 

I hope this helps. 

アバター
破棄
関連投稿 返信 ビュー 活動
2
3月 23
2399
2
1月 23
242
0
11月 24
1019
1
9月 21
3039
0
5月 19
3342