2

I successfully retrieved models from "ir.models" and their fields "ir.model.fields" as documented using a Java XML-RPC client. However, the store field of a model fields confuses me. It is often false, e.g. for fields of model res.users like phone, email, zip etc and only a few like login and create_date have it set to true. Is that intended? I mean - according to documentation - store=false marks computed fields but I can still set email when creating a res.users record via the API.

Also, I wonder why unset field values are represented as false via XML-RPC. I cannot distinguish a boolean ttyped field value of false to its unset value?

Steffen Harbich
  • 2,639
  • 2
  • 37
  • 71

1 Answers1

1

That's because you have a interesting inheritance situation with res.users.

This model has an embedded partner by using _inherits = {'res.partner': 'partner_id'} notation in the model definition. In database you will have two tables: res_users and res_partner. The relation between them is made by foreign key partner_id in table res_users.

But on python side this inheritance will lead to a model res.users which will have all fields of res.partner model, too. And odoo is marking the res.partner fields for model res.users records as not stored, because they are stored in anothers models table.

For your examples, login and create_date are real res.users fields, so they are stored in res_users table. But phone, email and zip and many more are res.partner fields and stored in table res_partner.

CZoellner
  • 13,553
  • 3
  • 25
  • 38
  • Thanks for the clarification, I did not read anything about inheritance in the documentation so far. Do you know a good resource to learn more about the odoo data model and inheritance? Can I get the inheritance info from XML-RPC API? – Steffen Harbich Feb 11 '21 at 09:43
  • I usually use the [official documentation](https://www.odoo.com/documentation/14.0/reference/orm.html#inheritance-and-extension). And i don't know if that is possible by using XMLRPC or JSONRPC. – CZoellner Feb 11 '21 at 09:45
  • To be complete: Found out that inheritance can be retrieved via a "ir.models" field `inherited_model_ids`. – Steffen Harbich Feb 11 '21 at 13:38