Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
ee6e2e8e
Commit
ee6e2e8e
authored
Feb 13, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
configurator: install business templates in one transaction
It's faster
parent
f286b600
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
32 deletions
+37
-32
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.StandardBT5ConfiguratorItem.py
...l_components/document.erp5.StandardBT5ConfiguratorItem.py
+24
-22
bt5/erp5_configurator_standard/SkinTemplateItem/portal_skins/erp5_configurator_standard/BusinessConfiguration_setupStandardBT5.py
...urator_standard/BusinessConfiguration_setupStandardBT5.py
+7
-8
product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/StandardBT5ConfiguratorItem/bt5_id_property.xml
...ty_sheets/StandardBT5ConfiguratorItem/bt5_id_property.xml
+6
-2
No files found.
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.StandardBT5ConfiguratorItem.py
View file @
ee6e2e8e
...
@@ -32,14 +32,13 @@ from Products.ERP5Type import Permissions, PropertySheet
...
@@ -32,14 +32,13 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5Type.XMLObject
import
XMLObject
from
erp5.component.mixin.ConfiguratorItemMixin
import
ConfiguratorItemMixin
from
erp5.component.mixin.ConfiguratorItemMixin
import
ConfiguratorItemMixin
from
erp5.component.interface.IConfiguratorItem
import
IConfiguratorItem
from
erp5.component.interface.IConfiguratorItem
import
IConfiguratorItem
from
Products.ERP5Type.Cache
import
CachingMethod
from
zLOG
import
LOG
,
INFO
from
zLOG
import
LOG
,
INFO
@
zope
.
interface
.
implementer
(
IConfiguratorItem
)
@
zope
.
interface
.
implementer
(
IConfiguratorItem
)
class
StandardBT5ConfiguratorItem
(
ConfiguratorItemMixin
,
XMLObject
):
class
StandardBT5ConfiguratorItem
(
ConfiguratorItemMixin
,
XMLObject
):
"""
This class will install standard ERP5 template from a repository to
"""
Install standard ERP5 business template from a repository
fake site.
"""
"""
meta_type
=
'ERP5 Standard BT5 Configurator Item'
meta_type
=
'ERP5 Standard BT5 Configurator Item'
portal_type
=
'Standard BT5 Configurator Item'
portal_type
=
'Standard BT5 Configurator Item'
...
@@ -61,29 +60,32 @@ class StandardBT5ConfiguratorItem(ConfiguratorItemMixin, XMLObject):
...
@@ -61,29 +60,32 @@ class StandardBT5ConfiguratorItem(ConfiguratorItemMixin, XMLObject):
def
_checkConsistency
(
self
,
fixit
=
False
,
**
kw
):
def
_checkConsistency
(
self
,
fixit
=
False
,
**
kw
):
template_tool
=
self
.
getPortalObject
().
portal_templates
template_tool
=
self
.
getPortalObject
().
portal_templates
bt5_id
=
self
.
getBt5Id
().
split
(
'.'
)[
0
]
if
bt5_id
in
template_tool
.
getInstalledBusinessTemplateTitleList
():
bt5_id_list
=
self
.
getBt5IdList
()
# BBB this used to be a string property
if
isinstance
(
bt5_id_list
,
str
):
bt5_id_list
=
[
bt5_id_list
]
bt5_id_set
=
{
bt
.
split
(
'.'
)[
0
]
for
bt
in
bt5_id_list
}
if
not
bt5_id_set
.
difference
(
template_tool
.
getInstalledBusinessTemplateTitleList
()):
LOG
(
"StandardBT5ConfiguratorItem"
,
INFO
,
LOG
(
"StandardBT5ConfiguratorItem"
,
INFO
,
"Business Template
already Installed: %s for %s"
%
(
bt5_id
,
self
.
getRelativeUrl
()))
"Business Template
s already Installed: %s for %s"
%
(
bt5_id_set
,
self
.
getRelativeUrl
()))
return
[]
return
[]
def
_getRepositoryBusinessTemplateTitleList
():
repository_bt_title_set
=
{
bt
.
getTitle
()
for
bt
in
\
return
[
bt
.
getTitle
()
for
bt
in
\
template_tool
.
getRepositoryBusinessTemplateList
()}
template_tool
.
getRepositoryBusinessTemplateList
()]
repository_bt_title_list
=
CachingMethod
(
_getRepositoryBusinessTemplateTitleList
,
id
=
'StandardBT5_getRepositoryBusinessTemplateTitleList'
,
cache_factory
=
'erp5_content_long'
)()
if
bt5_id
in
repository_bt_title_list
:
not_found_bt_set
=
bt5_id_set
.
difference
(
repository_bt_title_set
)
if
not_found_bt_set
:
raise
ValueError
(
"Business template %s not found on available
\
sources."
%
not_found_bt_set
)
if
fixit
:
if
fixit
:
template_tool
.
installBusinessTemplateListFromRepository
([
bt5_id
],
template_tool
.
installBusinessTemplateListFromRepository
(
list
(
bt5_id_set
),
update_catalog
=
self
.
getUpdateCatalog
(
0
),
update_catalog
=
self
.
getUpdateCatalog
(
0
),
install_dependency
=
self
.
getInstallDependency
(
1
),
install_dependency
=
self
.
getInstallDependency
(
1
),
activate
=
True
)
activate
=
True
)
return
[
self
.
_createConstraintMessage
(
'%s should be installed'
%
bt5_id
),]
return
[
self
.
_createConstraintMessage
(
'%s should be installed'
%
bt5_id_list
),]
raise
ValueError
(
"The business template %s was not found on available
\
sources."
%
bt5_id
)
bt5/erp5_configurator_standard/SkinTemplateItem/portal_skins/erp5_configurator_standard/BusinessConfiguration_setupStandardBT5.py
View file @
ee6e2e8e
...
@@ -19,11 +19,10 @@ bt5_installation_list = ('erp5_dhtml_style',
...
@@ -19,11 +19,10 @@ bt5_installation_list = ('erp5_dhtml_style',
'erp5_osoe_web_renderjs_ui'
,
'erp5_osoe_web_renderjs_ui'
,
)
)
bt5_update_catalog
=
(
'erp5_ingestion_mysql_innodb_catalog'
,
'erp5_accounting'
,
)
configuration_save
.
addConfigurationItem
(
"Standard BT5 Configurator Item"
,
for
name
in
bt5_installation_list
:
title
=
"Standard business templates"
,
configuration_save
.
addConfigurationItem
(
"Standard BT5 Configurator Item"
,
bt5_id_list
=
bt5_installation_list
,
title
=
name
,
bt5_id
=
name
,
update_catalog
=
True
,
update_catalog
=
(
name
in
bt5_update_catalog
),
install_dependency
=
True
,
install_dependency
=
True
,
)
)
product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/StandardBT5ConfiguratorItem/bt5_id_property.xml
View file @
ee6e2e8e
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
<key>
<string>
categories
</string>
</key>
<key>
<string>
categories
</string>
</key>
<value>
<value>
<tuple>
<tuple>
<string>
elementary_type/
string
</string>
<string>
elementary_type/
lines
</string>
</tuple>
</tuple>
</value>
</value>
</item>
</item>
...
@@ -43,13 +43,17 @@
...
@@ -43,13 +43,17 @@
<key>
<string>
mode
</string>
</key>
<key>
<string>
mode
</string>
</key>
<value>
<string>
w
</string>
</value>
<value>
<string>
w
</string>
</value>
</item>
</item>
<item>
<key>
<string>
multivalued
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<item>
<key>
<string>
portal_type
</string>
</key>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
<value>
<string>
Standard Property
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
property_default
</string>
</key>
<key>
<string>
property_default
</string>
</key>
<value>
<string>
python:
\'erp5_base\'
</string>
</value>
<value>
<string>
python:
(\'erp5_base\', )
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment