This question has been flagged

I need to add an extra condition to the domain of the stage field in project.task

I already added an 'issue_type_id' field to the project.task module and its related views.

Then I replaced th stage_id field with my domain like this.

stage_id = fields.Many2one('project.task.type', string='Stage', compute='_compute_stage_id',
store=True, readonly=False, ondelete='restrict', tracking=True, index=True, group_expand='_read_group_stage_ids',
domain="[('project_ids', '=', project_id),('issue_type_ids', '=', issue_type_id)]", copy=False, task_dependency_tracking=True)


After that, I got the below error when I update the module


odoo.tools.convert.ParseError: while parsing /home/lakshithas/centrics/project/odoo-allion-v15/odoo_15e_20230109/custom_addons/allion_project_modification/views/project_task.xml:4
Error while validating view near:

Field 'issue_type_id' used in domain of field 'stage_id' ([('project_ids', '=', project_id),('issue_type_ids', '=', issue_type_id)]) must be present in view but is missing. View error context: {'file': '/home/lakshithas/personal/project/odoo-v15/odoo_15e_20230109/custom_addons/lk_project_modification/views/project_task.xml', 'line': 1, 'name': 'project.task.form', 'view': ir.ui.view(4170,), 'view.model': 'project.task', 'view.parent': ir.ui.view(2830,), 'xmlid': 'view_task_form2_inherit'}

I couldn't find any solution to that


I am working on odoo15 Enterprise 

Avatar
Discard
Best Answer

Hello, D.M.P. Lakshitha Sandaruwan
Hope you doing well.

Error is saying that 'issue_type_id' is used in the domain of field 'stage_id' it must be present in the view.

In odoo, when you add domain to the field the domain fields have to be present in the current view visible/invisible.

I hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard