Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
4 Відповіді
22335 Переглядів

In default i have some fields in selection field. if i want to add another field in selection field. then how to add it?
 

Аватар
Відмінити
Найкраща відповідь

Hello Ramanan,

The same Question is asked

Nice answer given by Atul.

Click Here

Click above link for your answer.

Regards,

Anil

Аватар
Відмінити
Найкраща відповідь

Go through this link:

https://www.odoo.com/forum/help-1/question/how-to-change-the-values-for-a-selection-field-72934

If your selection field is static list of tuples defined in field, then there is no way to do. If it is a method or global variable you can change it.

Аватар
Відмінити
Найкраща відповідь

Hi, 

You can follow following link for this:

https://youtu.be/GPhgxxwprA4

Hope it helps,

Thanks

Аватар
Відмінити
Найкраща відповідь

you can use list to add item dynamically in fields.Selection 
cnt=0
list1=[]
for i in range(1900,2017):
         list1.append((str(cnt),str(i)))
         cnt=cnt+1

class Employee(models.Model):
      _name = 'employee.details'
      year=fields.Selection(list1, string='Years', required=True, copy=True)

     #append item

     list1.append(('118','2018'))

    #update item

     list1[0]=('0,'1899')

     #item updated automatically in field.Selection

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
5
лип. 24
15696
1
черв. 22
27218
9
трав. 22
53473
0
лип. 20
3016
0
бер. 20
3832