Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
maj 24
9290
3
lip 15
33160
1
cze 22
13428
1
cze 22
7417
2
maj 24
7865