Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
5325 Zobrazení

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
kvě 24
9250
3
čvc 15
33127
1
čvn 22
13383
1
čvn 22
7365
2
kvě 24
7837