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