Background:
At loading data by installing resources (models, fields, model-records, views, record rules, actions, menu entries, etc.), Odoo registers mapping records for all resources in the 'ir_model_data' table ('ir.model.data' object), so we can reference those records later, even from other modules.
Mapping records in 'ir_model_data' have the following remarkable columns:
- module: module name, string literal (not its id)
- model: fully-qualified dot-separated object name (also known as the object's technical name)
- res_id: The resource id/Database ID (the PK of the record in the table where the resource is stored)
- name: record name, a string literal that in conjunction with the module name uniquely identify the record/resource
The record name in conjunction with the module name form what we know as the resource External ID which has the following fully-qualified form: 'module_name.resource_name'.
Records defined in XML data define their External IDs by means of the 'id' attribute of the 'record' tag.
The 'id' attribute can explicitly include 'module_name.' (fully-qualified form) or not. In the later case (relative form) the module that declares the resource is assumed:
The above long story was required to have enough background for the answer that follows.
Answer:
At processing child 'field' tags of any 'record' tag, the 'ref' attribute is expected to have the External ID of a referenced existing record (fully-qualified or relative form):
Mapping records that reference models are created at initializing modules/models/fields. As they lack a corresponding XML record and cannot declare its corresponding External ID by this means, the ORM creates its External ID based in the 'model_' prefix and the object's technical name (dots replaced by underscores):
This is why records that reference models ('ir.model' records) have the following form: model_XXXXX
Records for some other resources also have known prefixes for their External IDs:
Modules: https://github.com/odoo/odoo/blob/8.0/openerp/modules/db.py#L90
Models: https://github.com/odoo/odoo/blob/8.0/openerp/models.py#L382
Fields: https://github.com/odoo/odoo/blob/8.0/openerp/models.py#L444
SELECT * FROM "ir_model_data" WHERE name LIKE 'module_%';
SELECT * FROM "ir_model_data" WHERE name LIKE 'model_%' ORDER by module, name;
SELECT * FROM "ir_model_data" WHERE name LIKE 'field_%' ORDER BY module, name;
Records for other resources may follow some convention or simply not:
SELECT * FROM "ir_model_data" WHERE name LIKE 'view_%' ORDER by module, name;
SELECT * FROM "ir_model_data" WHERE model LIKE 'ir.ui.view' AND name NOT LIKE 'view_%' ORDER by module, name;
So in your case, the line you're looking for is:
<field name="model_id" eval="ref('your_module.model_my_new_model')"/>