Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet

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?



Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Apr. 22
4082
3
März 24
6998
1
Mai 22
2945
1
Aug. 20
3420
1
Juli 19
6539