NotImplementedError: On table_query

What does this error mean in Tryton 5.x?
We haven’t seen it in Tryton 4.x.

It means that you are trying to create, write or delete a record of a table_query model, which is an operation that is not implemented.

On which model do you get this error?

This behaviour was the same on older series.

The model was discussed here:

We had no ploblems with this model in Tryton 4.x.

The problem is when the user tries to save some data. As rule of dump you should add read only access to the table_query models, so the buttons are disabled on the client, no operation is performed and the error is not raised.

On the other hand, if you want to save data for the model you should override the create/write and delete methods to save the data somewhere.

Our users can not save data in this model.

This does not work in our case. The error still occurs.

Our model was implemented following the example of babi module that you recommended.

query = {'attr1': value1, 'attr2': value2, 'attr3': value3, ...}
query, = Query.create([query])

The error is caused by the line:

query, = Query.create([query])

Right, because you create a record from a table that does not exist.
Why are you creating this record?

P.S: It is dificult to understand the full picture without the full code.

I tried to do as in your example.
Actually, I do not need this record. Ultimately, records will be generated using table_query.
I just need to dynamically create a new instance of the class Query. How can I do that?

I wonder why this worked in Tryton 4.x?

Why you need to do so? If you have a table query all the instances will be directly returned from an sql query.

OK. In babi module and in our module, a class is dynamically created, not an instance.
This is done using register_class function in validate_model method.
But when a view is displayed in the client, an instance of this class is also created.
What should I do instead of Query.create() calling?

The problem was resolved by replacing the lines:

query = {'attr1': value1, 'attr2': value2, 'attr3': value3, ...}
query, = Query.create([query])

with the line:

query = Query()

But query instance is only needed to call validate_model method that dynamically creates a new class.
Is there a simpler solution?