Odoo Help

0

how to add values dynamically in selection fields?

By
Demirel yakito
on 1/13/15, 1:45 AM 2,676 views

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

4

Anil R. Kesariya

--Anil R. Kesariya--
4541
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
-
Technical & Functional Expert
Anil R. Kesariya
On 1/13/15, 2:36 AM

Hello Ramanan,

The same Question is asked

Nice answer given by Atul.

Click Here

Click above link for your answer.

Regards,

Anil

3

Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
3617
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 1/13/15, 2:14 AM

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.

0

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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 1/13/15, 1:45 AM
Seen: 2676 times
Last updated: 1/24/17, 9:46 AM