Commit 874be360 authored by Tatuya Kamada's avatar Tatuya Kamada

- Prevent to update properties because the movement group is not an assignment movement group.

- Prevent an argument error when getting a property of an object.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34542 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c6d898b2
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
from Products.ERP5.Document.PropertyMovementGroup import PropertyMovementGroup from Products.ERP5.Document.PropertyMovementGroup import PropertyMovementGroup
from Products.ERP5Type.Utils import UpperCase from Products.ERP5Type.Utils import UpperCase
_MARKER = []
class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup): class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup):
""" """
Parent Delivery Property Movement Group is similar to Property Parent Delivery Property Movement Group is similar to Property
...@@ -47,7 +45,7 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup): ...@@ -47,7 +45,7 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup):
parent_delivery = self._getParentDelivery(movement) parent_delivery = self._getParentDelivery(movement)
if parent_delivery is not None: if parent_delivery is not None:
for prop in self.getTestedPropertyList(): for prop in self.getTestedPropertyList():
property_dict['_%s' % prop] = self._getProperty(parent_delivery, prop, None) property_dict['_%s' % prop] = self._getProperty(parent_delivery, prop)
return property_dict return property_dict
def test(self, document, property_dict, property_list=None, **kw): def test(self, document, property_dict, property_list=None, **kw):
...@@ -57,9 +55,9 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup): ...@@ -57,9 +55,9 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup):
else: else:
target_property_list = self.getTestedPropertyList() target_property_list = self.getTestedPropertyList()
for prop in target_property_list: for prop in target_property_list:
if property_dict['_%s' % prop] != self._getProperty(document, prop, None): if property_dict['_%s' % prop] != self._getProperty(document, prop):
return False, property_dict return False, {}
return True, property_dict return True, {}
def _getParentDelivery(self, movement): def _getParentDelivery(self, movement):
# try to find local payment conditions from the upper level delivery # try to find local payment conditions from the upper level delivery
...@@ -72,9 +70,9 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup): ...@@ -72,9 +70,9 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup):
delivery = movement.getDeliveryValue() delivery = movement.getDeliveryValue()
return delivery return delivery
def _getProperty(self, document, property_id, d=_MARKER): def _getProperty(self, document, property_id):
# XXX here we don't use Base.getProperty() but try to call accessor # XXX here we don't use Base.getProperty() but try to call accessor
# directly to make acquired property # directly to make acquired property
# (eg. payment_condition_efficiency) working. # (eg. payment_condition_efficiency) working.
accessor_name = 'get' + UpperCase(property_id) accessor_name = 'get' + UpperCase(property_id)
return getattr(document, accessor_name)(d) return getattr(document, accessor_name)()
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