Odoo Help


Is there a smooth way of transitioning the Task Summary to a dropdown list?

Scott Daniel Lentz
on 4/16/13, 12:57 PM 1,156 views

In project_report.py the Task Summary field is defined as:

_columns = {
    'name': fields.char('Task Summary', size=128, readonly=True),

Already, I have entered data into this field. Recently I convert it to a dropdown list, like this:

_columns = {
    'name': fields.selection([('do_this_task_first','Do This Task First'),
    ('do_this_task_next','Do This Task Next'),
    ('do_this_task_last', 'Do This Task Last')],
    'Task Summary', help="What the task is."),

But the previous data now shows as undefined. Is there an elegant way to keep the old data and assign it to one of the dropdown list options, or will all the previous tasks have to be re-entered?

I wonder if there's a way to specify that anything could be typed in, or pick one from the list.

Moore Works, Dale E. Moore
on 4/16/13, 5:54 PM

Do you have to accept from the fields.selection then in your module.py class move that data into the fields.char in the DB?

How would you coordinate reading the fields.char into the fields.selection when you get a different record?

Moore Works, Dale E. Moore
on 4/16/13, 6:40 PM
Scott Daniel Lentz
On 5/8/13, 4:44 PM

I was able to take care of the Task Summary as a dropdown box with two devices. First I created a new class to modify the original:

class task_summary_drop_down(osv.osv):
    _inherit = "project.task"
    _columns = {
        'name': fields.selection([(
        'What The Old Data Was For First','Do This Task First'),
        ('What The Old Data Was For Next','Do This Task Next'),
        ('What The Old Data Was For Last', 'Do This Task Last')],
        'Task Summary', help="Task to be completed."),

Note the second half of the solution, I changed the data (in the first set of single quotes) that is to be saved to the DB. It now exactly matches the characters that were already in the DB from the original data. And now (since the data matches) it displays normally in the view (not "Undefined" as before) as if it were selected from the dropdown.

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.


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)


Asked: 4/16/13, 12:57 PM
Seen: 1156 times
Last updated: 3/16/15, 8:10 AM