This question has been flagged
3 Replies
3632 Views

Hi everyone,


I am trying to add a field to the project.task.kanban view but keep getting the error the field does not exist.

The field I want to add stems from a tertiary module and adds the field 'date_finished' to the project.task model. The field does not come from my own module.


I am really not sure what I am doing wrong and would appreciate help.


<odoo>
  <data>
    <record model="ir.ui.view" id="project_set_end_date_tile">
      <field name="name">project.task.kanban</field>
        <field name="model">project.task</field>
        <field name="inherit_id" ref="project.view_task_kanban"/>
        <field name="arch" type="xml">
          <xpath expr="//field[@name='date_deadline']" position='after'>
          <field name="date_finished"/>
          </xpath>
      </field>
    </record>
  </data>
</odoo>


Avatar
Discard
Best Answer

Hi:

Any field you add to the view needs to be defined in the model on which the view is based. In your case, you will need to add a computed or related field to the model to retrieve the value from the tertiary module. Once the field is added to the model, you will be able to add it to the view.

EDIT:

If it is related to the order of the views, you can specify a "priority" attribute on the view definition and set it to something like 100, so your customization loads after the other views.

<field eval="100" name="priority"/>
Avatar
Discard
Author

Hi Paresh:

The tertiary module adds the field date_finished to the project.task model.

It works if a manually add the field to the Kanban view using the Odoo developers interface.

I guess it has to do with the order of the modules being loaded.

Have you declared the tertiary module in the depends list in your manifest file? Any modules your custom module relies on should be listed there.

I have edited and added to my earlier answer based on your clarification.

Author

Dear Paresh,

thank you for your clarification.

I figured out yesterday how to set the priority. But in addition I had to uninstall and reinstall the module for the change in priority to take effect.

Author

Dear Jonah,

do I have to list "modules" or "models"? I thought I have to only list "models".