Ir al contenido
Menú
Se marcó esta pregunta

I need to filter records shown in one2many tree when I click a button or change another field

I have tried tens of times with different techniques but it doesn't work

here is the last try to figure out the problem

first in the main model

current_exercise = 'exercise 1'
generalFitnessDetails = One2many("spogaze.general_fitness_details", "generalFitnessDetails", domain=[('exercise', '=', '%s' % current_exercise)])

the detailed model which represented with O2M field has 'exercise' field which I need to apply the filter depends on it

in the main model I added a function to change the 'current_exercise' value and applying the filter

@api.one    
def next_exercise(self):
self.current_exercise = 'exercise 2'
return {'domain': {'generalFitnessDetails': [('exercise', '=', self.current_exercise)]}}

but what happens is that the first filter applied which is stated in O2M field creation before I click the button, but after clicking the button the field "current_exercise" changes but filter doesn't apply

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
may 24
9216
3
jul 15
33109
1
jun 22
13362
1
jun 22
7335
2
may 24
7796