Commit 32efad16 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

override getExpandablePropertyList() instead of _getExpandablePropertyDict()...

override getExpandablePropertyList() instead of _getExpandablePropertyDict() to provide the default value.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32452 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6ddbd00e
......@@ -200,63 +200,43 @@ class DeliveryRule(Rule):
return 0
return 1
def _getExpandablePropertyDict(self, applied_rule, movement,
business_path=None, **kw):
security.declareProtected(Permissions.AccessContentsInformation,
'getExpandablePropertyList')
def getExpandablePropertyList(self, default=None):
"""
Return a Dictionary with the Properties used to edit
the simulation movement
Return a list of properties used in expand.
"""
if self._isBPM():
return Rule._getExpandablePropertyDict(self, applied_rule,
movement, business_path, **kw)
property_dict = {}
default_property_list = self.getExpandablePropertyList()
property_list = self._baseGetExpandablePropertyList()
# For backward compatibility, we keep for some time the list
# of hardcoded properties. Theses properties should now be
# defined on the rule itself
if len(default_property_list) == 0:
LOG("Delivery Rule , _getExpandablePropertyDict", WARNING,
if len(property_list) == 0:
LOG("Order Rule , _getExpandablePropertyDict", WARNING,
"Hardcoded properties set, please define your rule correctly")
default_property_list = (
'source',
'source_section',
'source_function',
'source_account',
'source_administration',
'source_decision',
'source_project',
'source_payment',
property_list = (
'aggregate_list',
'base_application_list',
'base_contribution_list',
'description',
'destination',
'destination_section',
'destination_function',
'destination_account',
'destination_administration',
'destination_decision',
'destination_project',
'destination_payment',
'start_date',
'stop_date',
'description',
'resource',
'variation_category_list',
'variation_property_dict',
'base_contribution_list',
'base_application_list',
'aggregate_list',
'destination_function',
'destination_section',
'price',
'price_currency',
'quantity',
'quantity_unit',
'incoterm',
'resource',
'source',
'source_account',
'source_function',
'source_section',
'start_date',
'stop_date',
'variation_category_list',
'variation_property_dict',
)
for prop in default_property_list:
property_dict[prop] = movement.getProperty(prop)
if movement.hasTitle():
property_dict['title'] = movement.getTitle()
return property_dict
return property_list
def _getInputMovementList(self, applied_rule):
"""Return list of movements from delivery"""
......
......@@ -149,52 +149,41 @@ class OrderRule(DeliveryRule):
return Rule.isDivergent(self, movement)
security.declareProtected(Permissions.AccessContentsInformation,
'_getExpandablePropertyDict')
def _getExpandablePropertyDict(self, applied_rule, movement,
business_path=None, **kw):
'getExpandablePropertyList')
def getExpandablePropertyList(self, default=None):
"""
Return a Dictionary with the Properties used to edit
the simulation movement
Return a list of properties used in expand.
"""
if self._isBPM():
return DeliveryRule._getExpandablePropertyDict(self, applied_rule,
movement, business_path, **kw)
property_dict = {}
default_property_list = self.getExpandablePropertyList()
property_list = self._baseGetExpandablePropertyList()
# For backward compatibility, we keep for some time the list
# of hardcoded properties. Theses properties should now be
# defined on the rule itself
if len(default_property_list) == 0:
if len(property_list) == 0:
LOG("Order Rule , _getExpandablePropertyDict", WARNING,
"Hardcoded properties set, please define your rule correctly")
default_property_list = (
'source',
'source_section',
'source_function',
'source_account',
property_list = (
'aggregate_list',
'base_contribution_list',
'description',
'destination',
'destination_section',
'destination_function',
'destination_account',
'start_date',
'stop_date',
'description',
'resource',
'variation_category_list',
'variation_property_dict',
'base_contribution_list',
'aggregate_list',
'destination_function',
'destination_section',
'price',
'price_currency',
'quantity',
'quantity_unit',
'resource',
'source',
'source_account',
'source_function',
'source_section',
'start_date',
'stop_date',
'variation_category_list',
'variation_property_dict',
)
for prop in default_property_list:
property_dict[prop] = movement.getProperty(prop)
return property_dict
return property_list
def _getInputMovementList(self, applied_rule):
"""Input movement list comes from order"""
......
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