Is "resources" as field definition forbidden?

I have again something weird going on with a One2Many field. This time I get

Traceback (most recent call last):
  File "/trytond/", line 108, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/", line 48, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/", line 76, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/", line 186, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
TypeError: 'One2Many' object is not callable

This error pops up about 1 second after you have opened a list / form view. After you have clicked the error away, you can proceed with everything without loosing data.
It’s a very simple scheme:

class ReviewActivityResources(ModelSQL, ModelView):
    __name__ = 'review.activity.resources'

    review = fields.Many2One('review.activity', 'Review')

class ReviewActivity(Workflow, ModelSQL, ModelView):
    __name__ = "review.activity"

    resources = fields.One2Many('review.activity.resources', 
        'review', 'Resources')

When I rename resources to for example activity_resources the error is gone. I have multiple models with a resources field and they all have the same behavior.

I think it is because your resources field is overriding the resources function in Thats why it works when called activity_resources.

And together with Tryton being much stricter what to do with fields and their data, this makes sense. I also have a wizard with a resources field which doesn’t have any problem. This is because I’m not inheriting the ModelStorage class.

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