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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Alain Takoudjou
erp5
Commits
a0effd84
Commit
a0effd84
authored
Jan 08, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introspect preference properties instead of hardcoding
parent
0473f076
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
68 deletions
+33
-68
product/ERP5Configurator/Document/PreferenceConfiguratorItem.py
...t/ERP5Configurator/Document/PreferenceConfiguratorItem.py
+15
-29
product/ERP5Configurator/Document/SystemPreferenceConfiguratorItem.py
...Configurator/Document/SystemPreferenceConfiguratorItem.py
+18
-39
No files found.
product/ERP5Configurator/Document/PreferenceConfiguratorItem.py
View file @
a0effd84
...
@@ -55,35 +55,21 @@ class PreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
...
@@ -55,35 +55,21 @@ class PreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
,
PropertySheet
.
DublinCore
)
,
PropertySheet
.
DublinCore
)
def
_getPreferenceNameList
(
self
):
def
_getPreferenceNameList
(
self
):
"""Returns all existing preference names.
"""Return names of preference properties.
TODO: this should be done by introspecting property sheet.
"""
"""
return
(
'preferred_category_child_item_list_method_id'
,
property_id_list
=
[]
'preferred_accounting_transaction_from_date'
,
portal
=
self
.
getPortalObject
()
'preferred_accounting_transaction_at_date'
,
for
property_sheet_id
in
portal
.
portal_types
.
Preference
.
getTypePropertySheetList
():
'preferred_section_category'
,
property_sheet
=
portal
.
portal_property_sheets
[
property_sheet_id
]
'preferred_section'
,
for
prop
in
property_sheet
.
contentValues
():
'preferred_accounting_transaction_section_category'
,
if
prop
.
getProperty
(
'preference'
):
'preferred_accounting_transaction_source_section'
,
list_prefix
=
''
'preferred_accounting_transaction_currency'
,
if
prop
.
getProperty
(
'multivalued'
)
or
(
'preferred_accounting_transaction_gap'
,
prop
.
getProperty
(
'elementary_type'
)
in
(
'preferred_accounting_transaction_simulation_state_list'
,
'lines'
,
'multiple_selection'
,
'tokens'
)):
'preferred_text_format'
,
list_prefix
=
'_list'
'preferred_text_editor'
,
property_id_list
.
append
(
'%s%s'
%
(
prop
.
getReference
(),
list_prefix
))
'preferred_date_order'
,
return
property_id_list
'preferred_listbox_view_mode_line_count'
,
'preferred_listbox_list_mode_line_count'
,
'preferred_string_field_width'
,
'preferred_textarea_width'
,
'preferred_textarea_height'
,
'preferred_money_quantity_field_width'
,
'preferred_quantity_field_width'
,
'preferred_report_style'
,
'preferred_report_format'
,
'preferred_html_style_access_tab'
,
)
def
_build
(
self
,
business_configuration
):
def
_build
(
self
,
business_configuration
):
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
...
@@ -103,7 +89,7 @@ class PreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
...
@@ -103,7 +89,7 @@ class PreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
for
preference_name
in
self
.
_getPreferenceNameList
():
for
preference_name
in
self
.
_getPreferenceNameList
():
preference_value
=
getattr
(
self
,
preference_name
,
preference_value
=
getattr
(
self
,
preference_name
,
preference
.
getProperty
(
preference_name
,
marker
))
preference
.
getProperty
(
preference_name
,
marker
))
if
preference_value
is
not
marker
:
if
preference_value
is
not
marker
and
preference_value
is
not
None
:
preference_dict
[
preference_name
]
=
preference_value
preference_dict
[
preference_name
]
=
preference_value
if
self
.
portal_workflow
.
isTransitionPossible
(
preference
,
'enable'
):
if
self
.
portal_workflow
.
isTransitionPossible
(
preference
,
'enable'
):
...
...
product/ERP5Configurator/Document/SystemPreferenceConfiguratorItem.py
View file @
a0effd84
...
@@ -55,43 +55,22 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
...
@@ -55,43 +55,22 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
,
PropertySheet
.
DublinCore
)
,
PropertySheet
.
DublinCore
)
def
_getPreferenceNameList
(
self
):
def
_getPreferenceNameList
(
self
):
"""Returns all existing preference names.
"""Return names of preference properties.
TODO: this should be done by introspecting property sheet.
"""
"""
return
(
# CRM
property_id_list
=
[]
'preferred_campaign_resource_list'
,
portal
=
self
.
getPortalObject
()
'preferred_event_assessment_form_id_list'
,
for
property_sheet_id
in
portal
.
portal_types
[
'preferred_event_resource_list'
,
'System Preference'
].
getTypePropertySheetList
():
'preferred_event_sender_email'
,
property_sheet
=
portal
.
portal_property_sheets
[
property_sheet_id
]
'preferred_meeting_resource_list'
,
for
prop
in
property_sheet
.
contentValues
():
'preferred_sale_opportunity_resource_list'
,
if
prop
.
getProperty
(
'preference'
):
'preferred_support_request_resource_list'
,
list_prefix
=
''
# DMS
if
prop
.
getProperty
(
'multivalued'
)
or
(
'preferred_conversion_cache_factory'
,
prop
.
getProperty
(
'elementary_type'
)
in
(
'preferred_document_email_ingestion_address'
,
'lines'
,
'multiple_selection'
,
'tokens'
)):
'preferred_document_reference_method_id'
,
list_prefix
=
'_list'
'preferred_document_file_name_regular_expression'
,
property_id_list
.
append
(
'%s%s'
%
(
prop
.
getReference
(),
list_prefix
))
'preferred_document_reference_regular_expression'
,
return
property_id_list
'preferred_document_classification'
,
'preferred_synchronous_metadata_discovery'
,
'preferred_redirect_to_document'
,
'preferred_ooodoc_server_address'
,
'preferred_ooodoc_server_port_number'
,
# PDM
'preferred_product_individual_variation_base_category_list'
,
'preferred_component_individual_variation_base_category_list'
,
'preferred_service_individual_variation_base_category_list'
,
# Trade
'preferred_supplier_role_list'
,
'preferred_client_role_list'
,
'preferred_sale_use_list'
,
'preferred_purchase_use_list'
,
'preferred_packing_use_list'
,
'preferred_tax_use_list'
,
# Express
)
def
_build
(
self
,
business_configuration
):
def
_build
(
self
,
business_configuration
):
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
...
@@ -112,9 +91,9 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
...
@@ -112,9 +91,9 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
for
preference_name
in
self
.
_getPreferenceNameList
():
for
preference_name
in
self
.
_getPreferenceNameList
():
preference_value
=
getattr
(
self
,
preference_name
,
preference_value
=
getattr
(
self
,
preference_name
,
preference
.
getProperty
(
preference_name
,
marker
))
preference
.
getProperty
(
preference_name
,
marker
))
if
preference_value
is
None
and
activated_preference
is
not
None
:
if
preference_value
is
marker
and
activated_preference
is
not
None
:
preference_value
=
activated_preference
.
getProperty
(
preference_name
)
preference_value
=
activated_preference
.
getProperty
(
preference_name
,
marker
)
if
preference_value
is
not
marker
:
if
preference_value
is
not
marker
and
preference_value
is
not
None
:
preference_dict
[
preference_name
]
=
preference_value
preference_dict
[
preference_name
]
=
preference_value
if
self
.
portal_workflow
.
isTransitionPossible
(
preference
,
'enable'
):
if
self
.
portal_workflow
.
isTransitionPossible
(
preference
,
'enable'
):
...
...
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