How to find a field many2one of a module related to a one2many from another module in odoo?


An example, my module

class catalogoimage (models.Model):     _name = 'tfg.catalogoimage'

client = fields.Many2one('tfg.cliente', ondelete='set null', string="Cliente", index=True, help='Cliente al que se le ha realizado el servicio',required=True)
serv = fields.Many2one('tfg.catalogo1', ondelete='set null', string="Servicio", index=True, help='Servicio que se ha dado al cliente',required=True)
image = fields.Binary(string="Imagen",required=True,help='Inserte la imagen del servicio finalizado')

client is related in the one2many of the following module:

class client (models.Model):     _name = 'tfg.client'

name = fields.Char(compute='_comp_name')
nombC = fields.Char(string="Nombre",required=True,help='Inserte el nombre del cliente')
apeC = fields.Char(string="Apellido 1",help='Inserte el primer apellido del cliente')
tlf = fields.Integer(string="Teléfono",help='Inserte el teléfono del cliente')
date = fields.Date(string="Fecha de ficha",required=True,help='Inserte la fecha de creación/edición del cliente')
ficha = fields.Text()
aler = fields.Text()
pruebaOne2ManyCalendario = fields.One2many('tfg.calendario', 'nombC')
pruebaOne2ManyCliente = fields.One2many('tfg.cajapro', 'nombC')
pruebaOne2ManyImagen = fields.One2many('tfg.catalogoimagen', 'client')

and the catalog image search is as follows:

<record model="ir.ui.view" id="catalogoimagen_action_window_search">
    <field name="name">IR_VIEW catalogoimagen</field>
    <field name="model">tfg.catalogoimagen</field>
    <field name="arch" type="xml">
            <field name="client"/>
            <field name="serv"/>

The problem is that it does not search correctly since client is a relationship between image catalog and client. Any ideas?

asked by Luis Gonzalez 03.01.2019 в 11:21

0 answers