Community: CMS / eCommerce Experts mailing list archives


Re: How do I dump the data from a model?

Pedro M. Baeza
- 06/12/2014 12:04:29
Although this is not the best list to make this kind of questions (I think the forum fits better), I'll tell you that you can use ._columns variable, that list all the fields that the model has.


2014-12-05 23:39 GMT+01:00 Darrel Grant <>:
If I use self.pool.get('model').browse(ID)

I get a model object which also seems to automatically load the relationships.

How do I dump all of the key/value pairs of just the data from the
database from that returned model object?

If I use vars() on the object, it returns literally hundreds of
things, because it dumps all of the models various helper functions. I
also found get_fields(), which dumps a lot of schema information, but
none of the data (and it's not very readable for something with a lot
of relationships like product_product).

What I want is to see the fields and data so I can better understand
the actual data in the business objects. Is there a helper method
somewhere in osv.Model which does this?


Post to: