Odoo Help

2

0
1 Answer
0
Avatar

Brett Lehrer United States

--Brett Lehrer--

1382
| 5 5 10
Milwaukee, United States
--Brett Lehrer--
Director of IT and open source enthusiast.
Brett Lehrer United States
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,
    }
}
Ask a Question
Writer
Keep Informed
1 follower(s)
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