Funny behavior of fields.Char which I dont understand

I have this model with unique_id field as below:

class ProjectTask(ModelSQL, ModelView):
    "Activity"
    __name__ = "afx.project.task"
    _rec_name = 'activity'

    unique_id = fields.Char("Uuid")

I set the value using random string, so the value of unique_id = “709f653bbe36ee26502b1a9f9e08828b54540f75794f91b3b8214ea65aadfdab” successfully during creation.

Then I use it in this code block:

existing_project_task = ProjectTask.search([
      ('unique_id', '=', cls.unique_id),
])

And always throws error:
An error occurred while processing record 5: 'bool' object is not callable

Anybody knows?

Regards
Bromo

I do not know how you defined the method having this code but usually cls is for class so cls.unique_id is the fields.Char instance and not the database value.

I do not see how this can be triggered but it will be easier to understand with the traceback.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.