From c31beb459db9f41832142fc3af7aa01dbbfc1573 Mon Sep 17 00:00:00 2001 From: "Antoine Dupuis (andu)" Date: Fri, 21 Apr 2023 13:14:00 +0000 Subject: [PATCH] [FIX] tools: Improve docstring of load_xsd_files_from_url() This is to clarify that the file_name param is not used if a ZIP is downloaded: in that case, the filenames in the ZIP are used to save the attachment. See discussion in https://github.com/odoo/odoo/pull/115720#pullrequestreview-1392562860 closes odoo/odoo#124946 X-original-commit: ae94f14a844352f66490ec326fe2d1a716023891 Signed-off-by: Josse Colpaert Signed-off-by: Antoine Dupuis (andu) --- odoo/tools/xml_utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/odoo/tools/xml_utils.py b/odoo/tools/xml_utils.py index be0d5878677..1d1713d8125 100644 --- a/odoo/tools/xml_utils.py +++ b/odoo/tools/xml_utils.py @@ -156,8 +156,9 @@ def load_xsd_files_from_url(env, url, file_name=None, force_reload=False, request_max_timeout=10, xsd_name_prefix='', xsd_names_filter=None, modify_xsd_content=None): """Load XSD file or ZIP archive. Save XSD files as ir.attachment. - An XSD attachment from the database is identified by its prefixed `file_name`. A typical prefix is the - calling module name. + An XSD attachment is saved as {xsd_name_prefix}.{filename} where the filename is either the filename obtained + from the URL or from the ZIP archive, or the `file_name` param if it is specified and a single XSD is being downloaded. + A typical prefix is the calling module's name. For ZIP archives, XSD files inside it will be saved as attachments, depending on the provided list of XSD names. ZIP archive themselves are not saved. @@ -168,7 +169,7 @@ def load_xsd_files_from_url(env, url, file_name=None, force_reload=False, :param odoo.api.Environment env: environment of calling module :param str url: URL of XSD file/ZIP archive - :param str file_name: the name given to the XSD attachment + :param str file_name: used as attachment name if the URL leads to a single XSD, otherwise ignored :param bool force_reload: Deprecated. :param int request_max_timeout: maximum time (in seconds) before the request times out :param str xsd_name_prefix: if provided, will be added as a prefix to every XSD file name