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
from
Products.ERP5Type.XMLObject
import
XMLObject
from
erp5.component.mixin.ConfiguratorItemMixin
import
ConfiguratorItemMixin
from
erp5.component.interface.IConfiguratorItem
import
IConfiguratorItem
from
Products.ERP5Type.Cache
import
CachingMethod
from
zLOG
import
LOG
,
INFO
@
zope
.
interface
.
implementer
(
IConfiguratorItem
)
class
StandardBT5ConfiguratorItem
(
ConfiguratorItemMixin
,
XMLObject
):
"""
This class will install standard ERP5 template from a repository to
fake site.
"""
"""
Install standard ERP5 business template from a repository
"""
meta_type
=
'ERP5 Standard BT5 Configurator Item'
portal_type
=
'Standard BT5 Configurator Item'
...
...
@@ -61,29 +60,32 @@ class StandardBT5ConfiguratorItem(ConfiguratorItemMixin, XMLObject):
def
_checkConsistency
(
self
,
fixit
=
False
,
**
kw
):
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
,
"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
[]
def
_getRepositoryBusinessTemplateTitleList
():
return
[
bt
.
getTitle
()
for
bt
in
\
template_tool
.
getRepositoryBusinessTemplateList
()]
repository_bt_title_list
=
CachingMethod
(
_getRepositoryBusinessTemplateTitleList
,
id
=
'StandardBT5_getRepositoryBusinessTemplateTitleList'
,
cache_factory
=
'erp5_content_long'
)()
repository_bt_title_set
=
{
bt
.
getTitle
()
for
bt
in
\
template_tool
.
getRepositoryBusinessTemplateList
()}
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
:
template_tool
.
installBusinessTemplateListFromRepository
([
bt5_id
],
template_tool
.
installBusinessTemplateListFromRepository
(
list
(
bt5_id_set
),
update_catalog
=
self
.
getUpdateCatalog
(
0
),
install_dependency
=
self
.
getInstallDependency
(
1
),
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',
'erp5_osoe_web_renderjs_ui'
,
)
bt5_update_catalog
=
(
'erp5_ingestion_mysql_innodb_catalog'
,
'erp5_accounting'
,
)
for
name
in
bt5_installation_list
:
configuration_save
.
addConfigurationItem
(
"Standard BT5 Configurator Item"
,
title
=
name
,
bt5_id
=
name
,
update_catalog
=
(
name
in
bt5_update_catalog
),
configuration_save
.
addConfigurationItem
(
"Standard BT5 Configurator Item"
,
title
=
"Standard business templates"
,
bt5_id_list
=
bt5_installation_list
,
update_catalog
=
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 @@
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/
string
</string>
<string>
elementary_type/
lines
</string>
</tuple>
</value>
</item>
...
...
@@ -43,13 +43,17 @@
<key>
<string>
mode
</string>
</key>
<value>
<string>
w
</string>
</value>
</item>
<item>
<key>
<string>
multivalued
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
<item>
<key>
<string>
property_default
</string>
</key>
<value>
<string>
python:
\'erp5_base\'
</string>
</value>
<value>
<string>
python:
(\'erp5_base\', )
</string>
</value>
</item>
</dictionary>
</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