Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
71990822
Commit
71990822
authored
Nov 25, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: Add constraint to configure Business Application on existing modules
parent
934b0fe4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
304 additions
and
1 deletion
+304
-1
master/bt5/slapos_erp5/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
...rtalTypePropertySheetTemplateItem/property_sheet_list.xml
+3
-0
master/bt5/slapos_erp5/PropertySheetTemplateItem/portal_property_sheets/TemplateToolBusinessApplicationModuleCategoryConstraint.xml
...mplateToolBusinessApplicationModuleCategoryConstraint.xml
+66
-0
master/bt5/slapos_erp5/PropertySheetTemplateItem/portal_property_sheets/TemplateToolBusinessApplicationModuleCategoryConstraint/business_application_to_module_constraint.xml
...yConstraint/business_application_to_module_constraint.xml
+80
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_erp5/TemplateTool_checkBusinessApplicationToModuleConsistency.py
...mplateTool_checkBusinessApplicationToModuleConsistency.py
+90
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_erp5/TemplateTool_checkBusinessApplicationToModuleConsistency.xml
...plateTool_checkBusinessApplicationToModuleConsistency.xml
+62
-0
master/bt5/slapos_erp5/bt/template_portal_type_property_sheet_list
...5/slapos_erp5/bt/template_portal_type_property_sheet_list
+1
-0
master/bt5/slapos_erp5/bt/template_property_sheet_id_list
master/bt5/slapos_erp5/bt/template_property_sheet_id_list
+2
-1
No files found.
master/bt5/slapos_erp5/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
View file @
71990822
...
...
@@ -26,6 +26,9 @@
<portal_type
id=
"Organisation"
>
<item>
GeographicOrganisation
</item>
</portal_type>
<portal_type
id=
"Template Tool"
>
<item>
TemplateToolBusinessApplicationModuleCategoryConstraint
</item>
</portal_type>
<portal_type
id=
"Web Site Module"
>
<item>
WebSiteModuleShacacheConstraint
</item>
</portal_type>
...
...
master/bt5/slapos_erp5/PropertySheetTemplateItem/portal_property_sheets/TemplateToolBusinessApplicationModuleCategoryConstraint.xml
0 → 100644
View file @
71990822
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Property Sheet"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_count
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_mt_index
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_tree
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
TemplateToolBusinessApplicationModuleCategoryConstraint
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Property Sheet
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Length"
module=
"BTrees.Length"
/>
</pickle>
<pickle>
<int>
0
</int>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"OOBTree"
module=
"BTrees.OOBTree"
/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/PropertySheetTemplateItem/portal_property_sheets/TemplateToolBusinessApplicationModuleCategoryConstraint/business_application_to_module_constraint.xml
0 → 100644
View file @
71990822
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Script Constraint"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_identity_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
_range_criterion
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
constraint_type/post_upgrade
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
business_application_to_module_constraint
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Script Constraint
</string>
</value>
</item>
<item>
<key>
<string>
script_id
</string>
</key>
<value>
<string>
TemplateTool_checkBusinessApplicationToModuleConsistency
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_erp5/TemplateTool_checkBusinessApplicationToModuleConsistency.py
0 → 100644
View file @
71990822
fixit
=
True
if
fixit
else
False
error_list
=
[]
portal
=
context
.
getPortalObject
()
portal_categories
=
portal
.
portal_categories
# XXX Find a nice way to store the "json", and then create make a generic erp5_upgrader constraint
# Or may be let the configurator set these values, and change this script to check BA against the configurator
for
business_application_id
,
module_name_list
in
[
[
"base"
,
[
# Base Data
"currency_module"
,
"organisation_module"
,
"person_module"
,
"access_token_module"
,
"invitation_token_module"
,
"credential_request_module"
]],
[
"accounting"
,
[
# Accounting
"accounting_module"
,
"account_module"
]],
[
"crm"
,
[
# Customer Relation Management
"campaign_module"
,
"event_module"
,
"system_event_module"
,
"meeting_module"
,
"sale_opportunity_module"
,
"support_request_module"
,
"regularisation_request_module"
,
"upgrade_decision_module"
]],
[
"dms"
,
[
# Knowledge management
"document_ingestion_module"
,
"test_page_module"
,
"web_page_module"
,
"web_site_module"
]],
[
"pdm"
,
[
# PDM
"software_release_module"
,
"software_product_module"
,
"software_publication_module"
,
"software_licence_module"
,
"product_module"
,
"service_module"
]],
[
"trade"
,
[
# Trade
"internal_order_module"
,
"internal_packing_list_module"
,
"internal_supply_module"
,
"inventory_module"
,
"purchase_order_module"
,
"purchase_packing_list_module"
,
"purchase_supply_module"
,
"purchase_trade_condition_module"
,
"open_purchase_order_module"
,
"open_sale_order_module"
,
"open_internal_order_module"
,
"returned_sale_packing_list_module"
,
"returned_sale_order_module"
,
"returned_purchase_packing_list_module"
,
"returned_purchase_order_module"
,
"sale_order_module"
,
"sale_packing_list_module"
,
"sale_supply_module"
,
"sale_trade_condition_module"
,
]],
]:
for
module_name
in
module_name_list
:
module
=
getattr
(
portal
,
module_name
,
None
)
if
module
is
None
:
if
not
fixit
:
error_list
.
append
(
"module %s not found, please update this constraint! (ignored when solving)"
%
module_name
)
continue
try
:
business_application_value
=
portal_categories
.
restrictedTraverse
(
"business_application/"
+
business_application_id
)
except
KeyError
:
if
not
fixit
:
error_list
.
append
(
"business application %s not found, please update this constraint! (ignored when solving)"
%
business_application_id
)
continue
try
:
module
.
getBusinessApplication
(
None
)
except
AttributeError
:
raise
AttributeError
(
"%s has no business_application category"
%
(
module_name
))
if
module
.
getBusinessApplication
(
None
)
!=
business_application_id
:
if
fixit
:
module
.
setBusinessApplicationValue
(
business_application_value
)
else
:
error_list
.
append
(
"no business application assigned to module %s (Expected: %s | Found: %s)"
%
(
module_name
,
business_application_id
,
module
.
getBusinessApplication
(
None
)))
#return "\n".join(error_list) or "OK"
return
error_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_erp5/TemplateTool_checkBusinessApplicationToModuleConsistency.xml
0 → 100644
View file @
71990822
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
fixit=0
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
TemplateTool_checkBusinessApplicationToModuleConsistency
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/bt/template_portal_type_property_sheet_list
View file @
71990822
...
...
@@ -9,4 +9,5 @@ Invitation Token | Url
Memcached Tool | MemcachedToolServerConstraint
OAuth Tool | OAuthToolDefaultSlapOSConnector
Organisation | GeographicOrganisation
Template Tool | TemplateToolBusinessApplicationModuleCategoryConstraint
Web Site Module | WebSiteModuleShacacheConstraint
\ No newline at end of file
master/bt5/slapos_erp5/bt/template_property_sheet_id_list
View file @
71990822
...
...
@@ -7,4 +7,5 @@ GeographicOrganisation
WebSiteModuleShacacheConstraint
ShacacheSystemPreference
OAuthToolDefaultSlapOSConnector
CatalogToolNoneCreationDateConstraint
\ No newline at end of file
CatalogToolNoneCreationDateConstraint
TemplateToolBusinessApplicationModuleCategoryConstraint
\ No newline at end of file
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