Hello,
Using Odoo 9 Community (OpenERP version 9.0c)
Have a view with 4 stages, each stages have 3 phases and each phase has any number of other items that belongs to each phase of the main view.
I want to filter each grid according to the stage in the main view, the many2many field must filter it's content every time the user changes the phase (click on statusbar)
I know that I need to use a domain in the many2many field but I can't make to work, tried using a many2one but doesn't work, tried writing manually the domain string but nothing.
The structure of my classes are:
#main class
class MgmtsystemSistemasEquipos(models.Model):
_name = 'mgmtsystem.sistemas.equipos'
name = fields.Char(string=u'Nombre equipo',)
#this is the filter
status_id = fields.Many2one('mgmtsystem.estatus.equipo', 'Estatus Equipo', default=_default_status, readonly=True)
#this are the field i need to filter
protocolos_ids = fields.Many2many(
comodel_name='mgmtsystem.equipos.protocolos',
relation='mgmtsystem_equipos_protocolos_rel',
column1='equipo_id',
column2='protocolo_id',
)
informes_ids = fields.Many2many(
comodel_name='mgmtsystem.equipos.informes',
relation='mgmtsystem_equipos_informes_rel',
column1='equipo_id',
column2='informe_id')
anexos_ids = fields.Many2many(
comodel_name='mgmtsystem.equipos.anexos',
relation='mgmtsystem_equipos_anexos_rel',
column1='equipo_id',
column2='anexo_id')
#This is one of my test but doesn't work
# stage_id is a field in the child class
<field name="protocolos_ids" domain="[('stage_id', '=', status_id]" context="{'header_info': header_info, 'status_id': status_id, 'equipo': name}" widget="many2many">
<tree version="7.0">
<field name="codigo" string="Codigo"/>
<field name="name" string="Documento"/>
<field name="version" string="Versión"/>
<field name="stage_id" invisible="0" />
</tree>
</field>
Hope it was clear :)
Please Help.
Thank you
domain="[('stage_id', '=', status_id)]" and check whether status_id has a value.
Thank you already tried that but does not work :(