Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
1300 Weergaven

Hi,


I have a custom computed field that I use in v17. This is calculating the latest date among a list of dates


When I upgraded to v18 on a test database, I get the following error

ValueError: Cannot convert mycustommodel.mycustomfield to SQL because it is not stored

If I change the parameter of my field  to "stored", then I no longer have the error but the field isn't computed anymore. Empty.


Here is the Python code for the computation :

for record in self:

    dates = []

    for line in record.custommodelwheremydatesare:

        if line.fieldwithdate:

            dates.append(line.fieldwithdate)

    if dates:

        record['mycustomcomputedfield'] = max(dates)

    else:

        record['mycustomcomputedfield'] = False


Any idea ?

Avatar
Annuleer
Auteur Beste antwoord

OK I understood. The problem was because my list view was sorted according this computed field.

It didn't work but I left it that way.

When you migrate to v18, what was a mere useless option ended up crashing the interface.

Takeaway : do not sort your list using a computed field

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
apr. 24
2500
4
jan. 24
1815
1
mei 21
4452
1
jul. 25
639
1
dec. 24
1960