Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată

I have a property contract model which has a selection field:

active_or_not = fields.Selection([('normal', 'Pezull'), ('done', 'Aktive'), ('blocked', 'Revokuar')],
string='Status', compute="compute_contract_is_active_or_not")


This field is computed by this function here:

def compute_contract_is_active_or_not(self):
for record in self:
print(f"RECORD2: {record}")
if str(record.start_date) <= str(date.today()) and str(record.end_date) >= str(date.today()):
record.active_or_not = 'done'
print(f"RECORD3: {record.active_or_not}")
elif str(record.end_date) < str(date.today()):
record.active_or_not = 'blocked'
else:
record.active_or_not = 'normal'

I have also a wizard model which at the moment it shows all the contracts for a specific date. Now I want to filtrate all the contracts by status and also by date. What I mean is that if I have many contracts at the same date range with different status I want to see contracts with that specific status, if I select "done" I want to see all "done" contracts.


Now on the wizard I made this:

active_or_not = fields.Selection([('normal', 'Pezull'), ('done', 'Aktive'), ('blocked', 'Revokuar')],
string='Status', domain=[('property.contract', '=', 'active_or_not')])

and xml file is:
field name="active_or_not" domain="[('selection_filter', '!=', 'active_or_not')]"

but it seems to not working. Can someone help?



Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
apr. 22
4082
3
mar. 24
7000
1
mai 22
2945
1
aug. 20
3420
1
iul. 19
6540