1
votes

In Odoo, I inherited the "project" model and made some small changes.

Project model in my module:

class project(models.Model): 
    _inherit = "project.project"
    _columns = {
    'is_project' : fields.boolean("Is project", default=True)
 }
class project_task_type(models.Model):
    _inherit = "project.task.type"
    _columns = {
    'task_type_is_project' : fields.boolean("Is project", default=True)
}

Relation beetwen project_project and project_task_type in original project module:

project_project:

'type_ids': fields.many2many(
    'project.task.type', 'project_task_type_rel', 'project_id',
    'type_id', 'Tasks Stages',
     states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),

project_task_type:

'project_ids': fields.many2many(
    'project.project', 'project_task_type_rel',
    'type_id', 'project_id', 'Projects'),

In original form view :

<record id="edit_project" model="ir.ui.view">
   <field name="name">project.project.form</field>
   <field name="model">project.project</field>
   <field eval="2" name="priority"/> 
   <field name="arch" type="xml">
      [...]
      <page string="Project Stages" attrs="{'invisible': [('use_tasks', '=', False)]}" name="project_stages">
         <field name="type_ids"/>
      </page>
      [...]

So my question is how to filter type_ids records to get values from project_task_type where task_type_is_project = False.

I added domain attribute to field with name "type_ids"

<field name="type_ids domain="[('type_id.task_type_is_poject','=',False)]"/>
<field name="type_ids domain="[('task_type_is_poject','=',False)]"/>

but without success.

I will be very grateful for any help.

1
The solution is to add a domain to the type_ids field in the view. Add what you've tried.Daniel Reis

1 Answers

0
votes

I added domain attribute to field with name "type_ids"

<field name="type_ids domain="[('type_id.task_type_is_poject','=',False)]"/>
<field name="type_ids domain="[('task_type_is_poject','=',False)]"/>

but without success.

The second way is the correct one, the domain operates on the model of the field, so project.task.type, which means you should directly filter on its fields, in this case task_type_is_project. There is no type_id field.

The only problem I see is a typo: you forgot a r in project.