Commit f743bcbf authored by Rafael Monnerat's avatar Rafael Monnerat

Here and there style change.

Those files should be merged in future.
parent 2689e6b1
......@@ -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()
......
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment