[FIX] tools: zeep, oversight in c111d5cd17a00644a99828848c81ecb6c5b06d22

`l10n_es_edi_sii` requires `Client.bind` as well as `_binding_options`
in the service returned by this `bind` call.

```py
serv = client.bind('siiService', service_name)
if company.l10n_es_edi_test_env and connection_vals.get('test_url'):
    serv._binding_options['address'] = connection_vals['test_url']
```

Can be tested with a external l1On unit test,
tested only in nightly builds,
not by regular runbot builds / mergebot.

`--test-tags=external_l10n:TestEdiWebServices`

opw-3888257
opw-3888559
opw-3888155
opw-3890269
opw-3889683

closes odoo/odoo#163123

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
This commit is contained in:
Denis Ledoux
2024-04-24 13:01:41 +00:00
parent ab7643c15c
commit 35c34415a1
+15 -1
View File
@@ -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):