From b867306d668e3a25ad3a6f4ed90a966c81e3bc38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 3 Oct 2024 23:30:37 +0900
Subject: [PATCH] BusinessTemplate: fix some lxml warnings for findall

FutureWarning: This search incorrectly ignores the root element, and
will be fixed in a future version.
If you rely on the current behaviour, change it to './/role'
---
 product/ERP5/Document/BusinessTemplate.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 03e390837ce..253d7b52535 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -2542,7 +2542,7 @@ class PortalTypeTemplateItem(ObjectTemplateItem):
       # import workflow chain for portal_type
       result_dict = {}
       xml = parse(file)
-      chain_list = xml.findall('//chain')
+      chain_list = xml.findall('.//chain')
       for chain in chain_list:
         portal_type = chain.find('type').text
         workflow = chain.find('workflow').text or ''
@@ -5000,7 +5000,7 @@ class LocalRolesTemplateItem(BaseTemplateItem):
       return
     xml = parse(file)
     # local roles
-    local_roles_list = xml.findall('//role')
+    local_roles_list = xml.findall('.//role')
     local_roles_dict = {}
     for role in local_roles_list:
       id = role.get('id')
@@ -5009,7 +5009,7 @@ class LocalRolesTemplateItem(BaseTemplateItem):
 
     # local roles group id
     local_roles_group_id_dict = {}
-    for local_role_group_id in xml.findall('//local_role_group_id'):
+    for local_role_group_id in xml.findall('.//local_role_group_id'):
       role_set = set()
       for principal in local_role_group_id.findall('./principal'):
         role_set.add((principal.get('id'), principal.text))
-- 
2.30.9