Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
2158 Vues
One of our users is encountering an error when trying to fetch the 'state' field from the 'project.task' model. Below are the details of the API call and the error message received.

const params = [
    searchParams,
    ['name', 'project_id', 'stage_id', 'parent_id', 'active', 'description', 'priority', 'state', 'create_date', 'display_in_project', 'color', 'display_name']
];

odoo.execute_kw('project.task', 'search_read', [params]);
ValueError: Invalid field 'state' on model 'project.task'


Avatar
Ignorer
Meilleure réponse

If u using Odoo CE then 'state' is not present on model 'project.task' i have checked on odoo version 16 and 17.

Maybe 'kanban_state' or 'stage_id' ?

NOTE 'stage_id' is a m2o field

Avatar
Ignorer
Meilleure réponse

Verify Field Name in Odoo Interface:

  • Go to the Odoo interface.
  • Navigate to the project.task model and check the available fields.
  • Ensure that state is among the fields listed.

Check Model Definition:

  • If you have access to the Odoo server, check the definition of the project.task model to ensure that the state field is defined.

Check Custom Modules:

  • If this field is part of a custom module, verify that the module is installed and the field is correctly defined and accessible.

Use Alternative Field:

  • If state is not the correct field, identify the appropriate field that matches the intended use and replace state with that field in your API call.

Avatar
Ignorer