How i can set by default the number of lines of a one2many table that i want them to be displayed on the form

Hi ;
I want to inquire :
1/How i can set by default the number of lines of a one2many relation table that i want them to be displayed on the form.(if it possible do it of course)

2/Also can i specify the number of line where i want to display the content of another field exist in another class.

the story that i have a one2many field, that i want just to display his content on the line 2 and 4.
can i do that automatically!

the following code is about a field exist on the one2many table ,
this code i did, is valid to display the content of another field from another class to all lines but me i just want to display the content in line 2 and 4 not all lines of the table one2many, can i do that , if yes how i must do it!

    field_e = fields.Function(fields.Char( 'Seam'), 'get_last_seam') 

    @classmethod
    def get_last_seam(cls,institutions, Name):
        pool = Pool()
        parametr_up = pool.get('process.operation')
        res={}
        operation1 = Transaction().context.get('operation1')
        for institution in institutions:
            institutions = parametr_up.search([
                    ('institution', '=', institution.id),
                    ], limit=1)
            if institutions and parametr_up.operation1 :
                res[institution.id] = institutions[0].operation1.convention
            else:
                res[institution.id] = None
                
        return res   

You can not. The client always display all of them.

No. You must create a Function field that compute the proper data that you want to display.

1 Like

here i didn’t get you clearly,you talking here about a function to compute data i should use! , so what type of function i must work with it to achieve the goal of pass the data just on a specific line not all lines !

You will have to define a Function field of type Many2Many that computes the ids of the lines you want to show.

1 Like