Commit e513fc46 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

directly call getter instead of using Base.getProperty() because getProperty()...

directly call getter instead of using Base.getProperty() because getProperty() does not work well for acquired property (eg. payment_condition_efficiency) to acquire values from parent.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33594 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a0854422
...@@ -45,8 +45,9 @@ class ParentDeliveryCategoryMovementGroup(ParentDeliveryPropertyMovementGroup): ...@@ -45,8 +45,9 @@ class ParentDeliveryCategoryMovementGroup(ParentDeliveryPropertyMovementGroup):
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_list' % prop] = sorted( list_prop = '_%s_list' % prop
movement.getPropertyList(prop)) property_dict[list_prop] = sorted(
self._getProperty(movement, list_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):
...@@ -56,7 +57,8 @@ class ParentDeliveryCategoryMovementGroup(ParentDeliveryPropertyMovementGroup): ...@@ -56,7 +57,8 @@ class ParentDeliveryCategoryMovementGroup(ParentDeliveryPropertyMovementGroup):
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_list' % prop] != \ list_prop = '_%s_list' % prop
sorted(document.getPropertyList(prop, None)): if property_dict[list_prop] != \
sorted(self._getProperty(document, list_prop, [])):
return False, property_dict return False, property_dict
return True, property_dict return True, property_dict
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
############################################################################## ##############################################################################
from Products.ERP5.Document.PropertyMovementGroup import PropertyMovementGroup from Products.ERP5.Document.PropertyMovementGroup import PropertyMovementGroup
from Products.ERP5Type.Utils import UpperCase
_MARKER = []
class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup): class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup):
""" """
...@@ -44,7 +47,7 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup): ...@@ -44,7 +47,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] = parent_delivery.getProperty(prop, None) property_dict['_%s' % prop] = self._getProperty(parent_delivery, prop, None)
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):
...@@ -54,7 +57,7 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup): ...@@ -54,7 +57,7 @@ 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] != document.getProperty(prop, None): if property_dict['_%s' % prop] != self._getProperty(document, prop, None):
return False, property_dict return False, property_dict
return True, property_dict return True, property_dict
...@@ -68,3 +71,10 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup): ...@@ -68,3 +71,10 @@ class ParentDeliveryPropertyMovementGroup(PropertyMovementGroup):
movement = rule.getParentValue() movement = rule.getParentValue()
delivery = movement.getDeliveryValue() delivery = movement.getDeliveryValue()
return delivery return delivery
def _getProperty(self, document, property_id, d=_MARKER):
# XXX here we don't use Base.getProperty() but try to call accessor
# directly to make acquired property
# (eg. payment_condition_efficiency) working.
accessor_name = 'get' + UpperCase(property_id)
return getattr(document, accessor_name)(d)
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