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): ...@@ -57,6 +57,7 @@ class OrderRule(DeliveryRule):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.Task , PropertySheet.Task
, PropertySheet.AppliedRule
) )
# Simulation workflow # Simulation workflow
...@@ -160,18 +161,20 @@ class OrderRule(DeliveryRule): ...@@ -160,18 +161,20 @@ class OrderRule(DeliveryRule):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'_getExpandablePropertyDict') '_getExpandablePropertyDict')
def _getExpandablePropertyDict(self, applied_rule, movement, def _getExpandablePropertyDict(self, applied_rule, movement, **kw):
default_property_list=None, **kw):
""" """
Return a Dictionary with the Properties used to edit Return a Dictionary with the Properties used to edit
the simulation movement the simulation movement
""" """
property_dict = {} property_dict = {}
if default_property_list is None: default_property_list = self.getExpandablePropertyList()
# XXX Hardcoded value # For backward compatibility, we keep for some time the list
# LOG("Order Rule , _getPropertiesTo", WARNING, # of hardcoded properties. Theses properties should now be
# "Hardcoded properties set") # 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 = ( default_property_list = (
'source', 'source',
'source_section', 'source_section',
...@@ -195,8 +198,8 @@ class OrderRule(DeliveryRule): ...@@ -195,8 +198,8 @@ class OrderRule(DeliveryRule):
'quantity_unit', 'quantity_unit',
) )
for prop in default_property_list: for prop in default_property_list:
property_dict[prop] = movement.getProperty(prop) property_dict[prop] = movement.getProperty(prop)
return property_dict return property_dict
...@@ -58,23 +58,26 @@ class ProductionOrderRule(OrderRule): ...@@ -58,23 +58,26 @@ class ProductionOrderRule(OrderRule):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.Task , PropertySheet.Task
, PropertySheet.AppliedRule
) )
# Simulation workflow # Simulation workflow
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'_getExpandablePropertyDict') '_getExpandablePropertyDict')
def _getExpandablePropertyDict(self, applied_rule, movement, def _getExpandablePropertyDict(self, applied_rule, movement, **kw):
default_property_list=None, **kw):
""" """
Return a Dictionary with the Properties used to edit Return a Dictionary with the Properties used to edit
the simulation movement. the simulation movement.
""" """
property_dict = {} property_dict = {}
if default_property_list is None: default_property_list = self.getExpandablePropertyList()
# XXX Hardcoded value # For backward compatibility, we keep for some time the list
# LOG("Order Rule , _getExpandablePropertyDict", WARNING, # of hardcoded properties. Theses properties should now be
# "Hardcoded properties set") # 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 = ( default_property_list = (
'destination', 'destination',
'destination_section', 'destination_section',
......
...@@ -50,6 +50,12 @@ class AppliedRule: ...@@ -50,6 +50,12 @@ class AppliedRule:
'type' : 'string', 'type' : 'string',
'mode' : 'w' }, 'mode' : 'w' },
{ 'id' : 'expandable_property',
'description' : 'List of properties used in expand',
'type' : 'lines',
'default' : [],
'multivalued' : 1,
'mode' : 'w' },
) )
_categories = ('specialise', 'causality', 'order', ) _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