From 45e45842fbf483d90cb488dd597e8ac386934101 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 11 Jul 2022 14:23:40 +0900
Subject: [PATCH] BusinessTemplate: drop useless fixZSQLMethod in
 SkinTemplateItem.install

In SkinTemplateItem.install, self._objects contains entries for skin
folders and for all skins. objectValues method calls was called for skin
folders (as expected) and also for all skins, which acquire objectValues
from skin folder and do the work again.

This simplifies this by only running this for skin folders.
---
 product/ERP5/Document/BusinessTemplate.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 2b902b27c6..f07748da5f 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -2037,6 +2037,11 @@ class SkinTemplateItem(ObjectTemplateItem):
       # Do not register skin which were explicitely ask not to be installed
       if not force and update_dict.get(relative_url)  == 'nothing':
         continue
+      # self._objects contains the skin folder and all skins, for this
+      # we want to process only the skin folder 
+      relative_url = relative_url.split('/')
+      if len(relative_url) != 2:
+        continue
       folder = self.unrestrictedResolveValue(p, relative_url)
       for obj in folder.objectValues(spec=('Z SQL Method', 'ERP5 SQL Method')):
         fixZSQLMethod(p, obj)
-- 
2.30.9