Odoo Help


Odoo8. Get data from all fields from a form

on 2/26/15, 1:34 PM 882 views

Hi everyone.

I have the form where there are a lot of fields. And there is the only button to operate with the fields.

So, my problem is: I need to get data from all fields (all of them - boolean) and correct it with my program. How can I do that?

P.S. the form is located on popup window, if it's important



Brett Lehrer

--Brett Lehrer--

| 5 5 8
Milwaukee, United States
--Brett Lehrer--
Director of IT and open source enthusiast.
Brett Lehrer
On 4/16/15, 11:44 PM

In some function in your model's class, cycle through all of self._columns and store the output of each.

class my_model(osv.osv):
    _name = 'my.model'

    # ...

    def some_action(self, cr, uid, ids, context=None):
        if context is None: context = {}
        output = {}
        for my_model_rec in self.browse(cr, uid, ids, context=context):
            output[my_model_rec.id] = {}
            for col in self._columns:
                output[my_model_rec.id][col['name']] = my_model_rec[col['name']]
        return output

The output should look something like this:

    1: {
        'field_one': True,
        'field_two': False,

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: 2/26/15, 1:34 PM
Seen: 882 times
Last updated: 4/16/15, 11:44 PM