I am using Odoo8.
I have two models: x_items
and project.task.work
.
I have a field called name
and a custom field called x_wo_ref
in the project.task.work
.
I have a many2many field x_item_wo
in the model x_items
which is related with the model project.task.work
.
Currently when I fill the field x_item_wo
, the field name
from project.task.work
is showed.
How can I customise it in order to use the field x_wo_ref
instead of the default field name
for this many2many field?
Thank you
You need to define the _rec_name
attribute of the model. _rec_name
takes as default the field name
and if this does not exist it does not take anything unless you specify it. For instance if you need to see the field phone you must write:
_rec_name = 'phone'
In case you want a _rec_name
depending on anything you need to change the function name_get()
. You can see examples in other models.