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