diff --git a/product/ERP5Configurator/Document/PreferenceConfiguratorItem.py b/product/ERP5Configurator/Document/PreferenceConfiguratorItem.py index 4fbe43fbc20e85d593535ba841c2d85537a37a33..6de517cf60ba631ccf0d31173f3b570fae5f624c 100644 --- a/product/ERP5Configurator/Document/PreferenceConfiguratorItem.py +++ b/product/ERP5Configurator/Document/PreferenceConfiguratorItem.py @@ -87,15 +87,11 @@ class PreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject): def _build(self, business_configuration): portal = self.getPortalObject() - organisation_id = business_configuration.\ - getGlobalConfigurationAttr('organisation_id') - organisation_path = 'organisation_module/%s' % organisation_id - preference = portal.portal_preferences._getOb(self.object_id, None) if preference is None: preference = portal.portal_preferences.newContent( - portal_type='Preference', - id=self.object_id, + portal_type = 'Preference', + id = self.object_id, title = self.title, description = self.description, priority = 1) @@ -114,8 +110,10 @@ class PreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject): preference.enable() organisation_id = business_configuration.\ + getGlobalConfigurationAttr('organisation_id') + organisation_path = 'organisation_module/%s' % organisation_id preference_dict['preferred_accounting_transaction_source_section'] = \ - organisation_path + organisation_path preference_dict['preferred_section'] = organisation_path preference.edit(**preference_dict) bt5_obj = business_configuration.getSpecialiseValue() diff --git a/product/ERP5Configurator/Document/SystemPreferenceConfiguratorItem.py b/product/ERP5Configurator/Document/SystemPreferenceConfiguratorItem.py index 0102a717a1af79b8b6380f2d5498a57e3c8bfa53..21cede0782e1475765fd2d38df1dfdbe0c6d272a 100644 --- a/product/ERP5Configurator/Document/SystemPreferenceConfiguratorItem.py +++ b/product/ERP5Configurator/Document/SystemPreferenceConfiguratorItem.py @@ -33,9 +33,7 @@ from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Configurator.mixin.configurator_item import ConfiguratorItemMixin class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject): - """ - Setup system preference. - """ + """ Setup System preference. """ meta_type = 'ERP5 System Preference Configurator Item' portal_type = 'System Preference Configurator Item' @@ -96,16 +94,14 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject): def _build(self, business_configuration): portal = self.getPortalObject() - portal_preferences = portal.portal_preferences - preference = portal_preferences._getOb(self.object_id, None) - activated_preference = portal_preferences.getActiveSystemPreference() + preference = portal.portal_preferences._getOb(self.object_id, None) if preference is None: preference = portal.portal_preferences.newContent( - portal_type = 'System Preference', - id=self.object_id, - title=self.title, - description=self.description, - priority=1) + portal_type = 'System Preference', + id = self.object_id, + title = self.title, + description = self.description, + priority = 1) # XXX this have to be translated in user language. preference_dict = {} @@ -114,10 +110,11 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject): activated_preference = portal.portal_preferences.getActiveSystemPreference() for preference_name in self._getPreferenceNameList(): preference_value = getattr(self, preference_name, - preference.getProperty(preference_name)) + preference.getProperty(preference_name, marker)) if preference_value is None and activated_preference is not None: preference_value = activated_preference.getProperty(preference_name) - preference_dict[preference_name] = preference_value + if preference_value is not marker: + preference_dict[preference_name] = preference_value if self.portal_workflow.isTransitionPossible(preference, 'enable'): preference.enable()