[FIX] tools: provide our own zeep Client
The API of zeep changes according to the version of zeep. We want to limit the number of used methods and attributes of the zeep client by our developers. Hence, we provide our own zeep Client limited to the attribute and method we really need. In addition, a timeout for GET/POST requests should be applied by default when creating a new Client, which is not the case by default. We override that behavior to always provide a default timeout, and an easier API for developers wanting to change the default timeout. Before it was needed to import `Transport` from `zeep`, instanciate that `Transport`, with a timeout and optionally a session, and then pass that transport instance to the creation of the Client. We provide a way to directly pass these timeout parameters through the Client constructor. In addition, we serialize the returned values of Zeep service operation calls, to make sure we return simple types in methods of models e.g. bools, integers, string, ...
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import datetime
|
||||
import string
|
||||
import zeep
|
||||
import re
|
||||
import stdnum
|
||||
from stdnum.eu.vat import check_vies
|
||||
@@ -11,6 +10,7 @@ from stdnum import luhn
|
||||
import logging
|
||||
|
||||
from odoo import api, models, fields, tools, _
|
||||
from odoo.tools import zeep
|
||||
from odoo.tools.misc import ustr
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
Reference in New Issue
Block a user