Search on resource model with empty resource field
If the resource field is not linked to a record (id: -1), the search added by b2bccf9f45a3 crashes with:
Traceback (most recent call last):
File "trytond/protocols/wrappers.py", line 197, in wrapper
return func(request, pool, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "trytond/protocols/dispatcher.py", line 196, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^
File "trytond/ir/resource.py", line 83, in search
if record.resource and record.resource.id >= 0:
^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'id'