Commit 9e09a7f3 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

getMappedProperty does not exist on newTempMovement.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33423 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 52e09e77
...@@ -40,7 +40,7 @@ class CategoryMovementGroup(PropertyMovementGroup): ...@@ -40,7 +40,7 @@ class CategoryMovementGroup(PropertyMovementGroup):
def _getPropertyDict(self, movement, **kw): def _getPropertyDict(self, movement, **kw):
property_dict = {} property_dict = {}
getProperty = movement.getMappedProperty getProperty = getattr(movement, 'getMappedProperty', movement.getProperty)
for prop in self.getTestedPropertyList(): for prop in self.getTestedPropertyList():
list_prop = '%s_list' % prop list_prop = '%s_list' % prop
property_dict[list_prop] = sorted(getProperty(list_prop)) property_dict[list_prop] = sorted(getProperty(list_prop))
......
...@@ -690,7 +690,10 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -690,7 +690,10 @@ class OrderBuilder(XMLObject, Amount, Predicate):
if not update_existing_movement or force_update: if not update_existing_movement or force_update:
# Now, only 1 movement is possible, so copy from this movement # Now, only 1 movement is possible, so copy from this movement
# XXX hardcoded value # XXX hardcoded value
property_dict['quantity'] = simulation_movement.getMappedProperty('quantity') if getattr(simulation_movement, 'getMappedProperty', None) is not None:
property_dict['quantity'] = simulation_movement.getMappedProperty('quantity')
else:
property_dict['quantity'] = simulation_movement.getQuantity()
property_dict['price'] = simulation_movement.getPrice() property_dict['price'] = simulation_movement.getPrice()
# Update properties on object (quantity, price...) # Update properties on object (quantity, price...)
delivery_movement._edit(force_update=1, **property_dict) delivery_movement._edit(force_update=1, **property_dict)
......
...@@ -40,7 +40,7 @@ class PropertyMovementGroup(MovementGroup): ...@@ -40,7 +40,7 @@ class PropertyMovementGroup(MovementGroup):
def _getPropertyDict(self, movement, **kw): def _getPropertyDict(self, movement, **kw):
property_dict = {} property_dict = {}
getProperty = movement.getMappedProperty getProperty = getattr(movement, 'getMappedProperty', movement.getProperty)
for prop in self.getTestedPropertyList(): for prop in self.getTestedPropertyList():
property_dict[prop] = getProperty(prop) property_dict[prop] = getProperty(prop)
return property_dict return property_dict
......
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