diff --git a/odoo/tools/zeep/client.py b/odoo/tools/zeep/client.py index 900029e0e62..b28ef32a441 100644 --- a/odoo/tools/zeep/client.py +++ b/odoo/tools/zeep/client.py @@ -80,6 +80,15 @@ class Client: for key, operation in service._operations.items() }) + def bind(self, service_name, port_name): + service = self.__obj.bind(service_name, port_name) + operations = { + key: self.__serialize_object_wrapper(operation) + for key, operation in service._operations.items() + } + operations['_binding_options'] = service._binding_options + return ReadOnlyMethodNamespace(**operations) + class ReadOnlyMethodNamespace(SimpleNamespace): """A read-only attribute-based namespace not prefixed by `_` and restricted to functions. @@ -88,7 +97,12 @@ class ReadOnlyMethodNamespace(SimpleNamespace): no need to implement them to ensure the read-only property of this class. """ def __init__(self, **kwargs): - assert all(not key.startswith('_') and isinstance(value, FunctionType) for key, value in kwargs.items()) + assert all( + (not key.startswith('_') and isinstance(value, FunctionType)) + or + (key == '_binding_options' and isinstance(value, dict)) + for key, value in kwargs.items() + ) super().__init__(**kwargs) def __getitem__(self, key):