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
a4ef2200
Commit
a4ef2200
authored
Apr 26, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: change business_application values
parent
2205ea71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
19 deletions
+58
-19
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_erp5/TemplateTool_checkBusinessApplicationToModuleConsistency.py
...mplateTool_checkBusinessApplicationToModuleConsistency.py
+58
-19
No files found.
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_erp5/TemplateTool_checkBusinessApplicationToModuleConsistency.py
View file @
a4ef2200
...
@@ -3,25 +3,47 @@ error_list = []
...
@@ -3,25 +3,47 @@ error_list = []
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
portal_categories
=
portal
.
portal_categories
portal_categories
=
portal
.
portal_categories
configured_module_name_list
=
[]
# XXX Find a nice way to store the "json", and then create make a generic erp5_upgrader constraint
# 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
# 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
[
for
business_application_id
,
module_name_list
in
[
[
"base"
,
[
# Base Data
[
"base"
,
[
# Base Data
"currency_module"
,
"organisation_module"
,
"organisation_module"
,
"person_module"
,
"person_module"
,
"access_token_module"
,
"invitation_token_module"
,
"credential_request_module"
]],
]],
[
"accounting"
,
[
# Accounting
[
"accounting"
,
[
# Accounting
"accounting_module"
,
"accounting_module"
,
"account_module"
"account_module"
,
]],
"currency_module"
,
]],
[
"login"
,
[
# Login
"access_token_module"
,
"credential_request_module"
,
"credential_recovery_module"
,
"credential_update_module"
,
"system_event_module"
,
]],
[
"slapos"
,
[
# SlapOS
"cloud_contract_module"
,
"compute_node_module"
,
"computer_module"
,
"computer_model_module"
,
"computer_network_module"
,
"consumption_document_module"
,
"data_set_module"
,
"hosting_subscription_module"
,
"instance_tree_module"
,
"invitation_token_module"
,
"project_module"
,
"software_installation_module"
,
"software_instance_module"
,
]],
[
"crm"
,
[
# Customer Relation Management
[
"crm"
,
[
# Customer Relation Management
"campaign_module"
,
"campaign_module"
,
"event_module"
,
"event_module"
,
"system_event_module"
,
"incident_response_module"
,
"notification_message_module"
,
"meeting_module"
,
"meeting_module"
,
"sale_opportunity_module"
,
"sale_opportunity_module"
,
"support_request_module"
,
"support_request_module"
,
...
@@ -29,35 +51,33 @@ for business_application_id, module_name_list in [
...
@@ -29,35 +51,33 @@ for business_application_id, module_name_list in [
"upgrade_decision_module"
"upgrade_decision_module"
]],
]],
[
"dms"
,
[
# Knowledge management
[
"dms"
,
[
# Knowledge management
"document_module"
,
"document_ingestion_module"
,
"document_ingestion_module"
,
"
test_p
age_module"
,
"
im
age_module"
,
"web_page_module"
,
"web_page_module"
,
"web_site_module"
"web_site_module"
]],
]],
[
"pdm"
,
[
# PDM
[
"pdm"
,
[
# PDM
"component_module"
,
"software_release_module"
,
"software_release_module"
,
"software_product_module"
,
"software_product_module"
,
"software_publication_module"
,
"software_publication_module"
,
"software_licence_module"
,
"software_licence_module"
,
"product_module"
,
"product_module"
,
"service_module"
"service_module"
,
"transformation_module"
,
]],
]],
[
"trade"
,
[
# Trade
[
"trade"
,
[
# Trade
"internal_order_module"
,
"subscription_request_module"
,
"internal_packing_list_module"
,
"subscription_condition_module"
,
"internal_supply_module"
,
"business_process_module"
,
"business_configuration_module"
,
"inventory_module"
,
"inventory_module"
,
"purchase_order_module"
,
"purchase_order_module"
,
"purchase_packing_list_module"
,
"purchase_packing_list_module"
,
"purchase_supply_module"
,
"purchase_supply_module"
,
"purchase_trade_condition_module"
,
"purchase_trade_condition_module"
,
"open_purchase_order_module"
,
"open_sale_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_order_module"
,
"sale_packing_list_module"
,
"sale_packing_list_module"
,
"sale_supply_module"
,
"sale_supply_module"
,
...
@@ -65,6 +85,7 @@ for business_application_id, module_name_list in [
...
@@ -65,6 +85,7 @@ for business_application_id, module_name_list in [
]],
]],
]:
]:
for
module_name
in
module_name_list
:
for
module_name
in
module_name_list
:
configured_module_name_list
.
append
(
module_name
)
module
=
getattr
(
portal
,
module_name
,
None
)
module
=
getattr
(
portal
,
module_name
,
None
)
if
module
is
None
:
if
module
is
None
:
if
not
fixit
:
if
not
fixit
:
...
@@ -86,5 +107,23 @@ for business_application_id, module_name_list in [
...
@@ -86,5 +107,23 @@ for business_application_id, module_name_list in [
else
:
else
:
error_list
.
append
(
"no business application assigned to module %s (Expected: %s | Found: %s)"
%
(
module_name
,
business_application_id
,
module
.
getBusinessApplication
(
None
)))
error_list
.
append
(
"no business application assigned to module %s (Expected: %s | Found: %s)"
%
(
module_name
,
business_application_id
,
module
.
getBusinessApplication
(
None
)))
# Remove business application from unused module
for
module_name
in
portal
.
contentIds
():
if
module_name
.
endswith
(
"_module"
)
and
(
module_name
not
in
configured_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
:
module
.
getBusinessApplication
(
None
)
except
AttributeError
:
raise
AttributeError
(
"%s has no business_application category"
%
(
module_name
))
if
module
.
getBusinessApplication
(
None
)
!=
None
:
if
fixit
:
module
.
setBusinessApplicationValue
(
None
)
else
:
error_list
.
append
(
"no business application assigned to module %s (Expected: None | Found: %s)"
%
(
module_name
,
module
.
getBusinessApplication
(
None
)))
#return "\n".join(error_list) or "OK"
#return "\n".join(error_list) or "OK"
return
error_list
return
error_list
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