Billal BEGUERADJ
Billal BEGUERADJ

Reputation: 22784

Odoo: display model's fields names

How to programmatically display a model's fields names? (let us say the model res.partner)

I know I can check them manually by activating the developer mode, but I need to list them programmatically.

Upvotes: 1

Views: 731

Answers (2)

Yajo
Yajo

Reputation: 6428

You can use this:

env["res.partner"].fields_get()

It returns a dict() with all details in a very usable format. It includes things such as the field name in the user's language, or possible selections for Selection fields.

Depending on your use, it can be more handy than just ._fields.

Upvotes: 2

Quentin THEURET
Quentin THEURET

Reputation: 1232

self.env['res.partner']._fields

Upvotes: 3

Related Questions