Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

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])
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
mar 21
4052
0
lut 19
3494
1
lis 24
2095
1
sty 23
2148
1
maj 21
2933