Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3276 มุมมอง

i am trying to have the selection list generated from a many2many field 

so i created a text field and stored the values of many2many table in the text field with the onchange api but i can't link the text field with the selection field 

 state = fields.Selection(selection="selection_list", string="text", default="0")
saving = fields.Text(compute="doing", store=True)
@api.depends('saving')
def selection_list(self):
states = [("0", "hello")]
if self.saving:
for i, j in zip(range(1, len(self.saving.split()) + 1), self.saving.split()):
states.append(tuple((str(i), j)))
return states

@api.onchange('workers')
@api.depends('workers')
def doing(self):
if self.workers:
self.saving = ' '.join([i.name for i in self.workers])
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
How to show field if selected แก้ไขแล้ว
1
มี.ค. 21
4068
0
ก.พ. 19
3514
1
พ.ย. 24
2146
1
ม.ค. 23
2182
1
พ.ค. 21
2974