Commit 32005505 authored by Sebastien Robin's avatar Sebastien Robin

- do no set hardcoded values for the list of properties to

  copy on simulation movements, allow to set them inside portal_rules
- keep compatibility with existing not defined rules
- remove the default_property_list parameter to _getExpandablePropertyDict,
  it looks like to not be used, and it is better to define it
  on the rule itself


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26461 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ba722226
......@@ -57,6 +57,7 @@ class OrderRule(DeliveryRule):
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AppliedRule
)
# Simulation workflow
......@@ -160,18 +161,20 @@ class OrderRule(DeliveryRule):
security.declareProtected(Permissions.AccessContentsInformation,
'_getExpandablePropertyDict')
def _getExpandablePropertyDict(self, applied_rule, movement,
default_property_list=None, **kw):
def _getExpandablePropertyDict(self, applied_rule, movement, **kw):
"""
Return a Dictionary with the Properties used to edit
the simulation movement
"""
property_dict = {}
if default_property_list is None:
# XXX Hardcoded value
# LOG("Order Rule , _getPropertiesTo", WARNING,
# "Hardcoded properties set")
default_property_list = self.getExpandablePropertyList()
# 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("Order Rule , _getExpandablePropertyDict", WARNING,
"Hardcoded properties set, please define your rule correctly")
default_property_list = (
'source',
'source_section',
......@@ -195,8 +198,8 @@ class OrderRule(DeliveryRule):
'quantity_unit',
)
for prop in default_property_list:
property_dict[prop] = movement.getProperty(prop)
for prop in default_property_list:
property_dict[prop] = movement.getProperty(prop)
return property_dict
......@@ -58,23 +58,26 @@ class ProductionOrderRule(OrderRule):
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AppliedRule
)
# Simulation workflow
security.declareProtected(Permissions.AccessContentsInformation,
'_getExpandablePropertyDict')
def _getExpandablePropertyDict(self, applied_rule, movement,
default_property_list=None, **kw):
def _getExpandablePropertyDict(self, applied_rule, movement, **kw):
"""
Return a Dictionary with the Properties used to edit
the simulation movement.
"""
property_dict = {}
if default_property_list is None:
# XXX Hardcoded value
# LOG("Order Rule , _getExpandablePropertyDict", WARNING,
# "Hardcoded properties set")
default_property_list = self.getExpandablePropertyList()
# 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("Order Rule , _getExpandablePropertyDict", WARNING,
"Hardcoded properties set, please define your rule correctly")
default_property_list = (
'destination',
'destination_section',
......
......@@ -50,6 +50,12 @@ class AppliedRule:
'type' : 'string',
'mode' : 'w' },
{ 'id' : 'expandable_property',
'description' : 'List of properties used in expand',
'type' : 'lines',
'default' : [],
'multivalued' : 1,
'mode' : 'w' },
)
_categories = ('specialise', 'causality', '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