0

I have created a new many2many(x_recruiters) field to hr.recruitment.stage via user interface, and I am trying to access it in the tree view of the applicant, like

<?xml version="1.0"?>
<tree string="Applicants" multi_edit="1" sample="1">
  <field name="stage_id.x_recruiters"/>
</tree>

But it showing an error

Error while validating view: Field "stage_id.x_recruiters" does not exist in model "hr.applicant"

Can you please guide me to achieve this in the tree view, it will be very helpful for me. thanks in advance.

Ajay Kumar
  • 1,595
  • 3
  • 20
  • 36

1 Answers1

1

You can find in the documentation of the List view that the field name is the name of the field to display in the current model.

The satge_id field is of type Many2one related to hr.recruitment.stage so you can add a related field to x_recruiters in hr.applicant then add it to the list view.

Kenly
  • 24,317
  • 7
  • 44
  • 60
  • Thank you so much for your reply, can you please let me know ...how to write a related field to x_recruiters in hr.applicant via a user interface on developer mode activated. As I'm new to ODOO its little difficult to find the way. Thanks in advancee. – Ajay Kumar Dec 09 '20 at 05:43
  • Go to ``Technical/Database Structure/Models``, click ``Edit`` then add a new item in the `field` list, set the field name and label, and make sure to use the same type, in the `Advanced Properties` group, in the `Related Field` field specify your relation: `satge_id.x_recruiters` – Kenly Dec 09 '20 at 07:18
  • Thanks for the reply. I will try this and let you know – Ajay Kumar Dec 09 '20 at 07:31
  • Field Name : x_recruiters Field Label : Recruiters Field Type : many2many Related Model: hr.recruitment.stage Related Field: satge_id.x_recruiters I'm getting a validation error Related field 'stage_id.x_recruiters' does not have comodel 'hr.recruitment.stage' Can you please check whether my entries are correct or not – Ajay Kumar Dec 09 '20 at 08:12
  • Do not provide the ``Related Model``, It should be filled when you click on the ``Save`` button. I created a similar related field with no issues. – Kenly Dec 09 '20 at 08:43
  • I did as you told, the new field added but while saving the model it shows the error Unknown field name 'satge_id' in related field 'satge_id.x_recruiters' – Ajay Kumar Dec 09 '20 at 08:57
  • It is `stage_id`, not `satge_id`. – Kenly Dec 09 '20 at 14:07
  • Yes, I corrected the spelling, can you please let me know, what will be the related model and Related field... – Ajay Kumar Dec 10 '20 at 11:20
  • 1
    You have to provide the field name, label, field type (`many2many`) and set the related field to `stage_id.x_recruiters` then uncheck the `Stored` property and finally save. – Kenly Dec 10 '20 at 11:35
  • Thanks kenly...saved without any issues...but in a tree view, it shows only the number of records(i.e 3 records), I'm trying like this , how can I display the names that I selected from m2m field? – Ajay Kumar Dec 10 '20 at 11:42
  • Thank you so much kenly... I achieved by , now its working as i expected..thanks for your support and valuable time.. – Ajay Kumar Dec 10 '20 at 11:57