Commit a5fface2 authored by Julien Muchembled's avatar Julien Muchembled

Fix ERP5Legacy.OrderBuilder._findUpdatableObject

- fix getting delivery value from a simulation movement
- revert 38277 partially, since it only worked when working at delivery level

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42339 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d0441ea1
......@@ -29,6 +29,7 @@
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Base import Base
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5.Document.Amount import Amount
......@@ -330,18 +331,19 @@ class OrderBuilder(XMLObject, Amount, Predicate):
# XXX in the case of Order Builder, the movement is not always
# related to simulation, thus it might not have the delivery category.
# Possibly, this code should be overridden by DeliveryBuilder.
if getattr(aq_base(movement), 'getDeliveryValue', None) is not None:
delivery_movement = movement.getDeliveryValue()
try:
delivery = movement.getDeliveryValue()
except AttributeError:
pass
else:
delivery_movement = None
if delivery_movement is not None:
delivery = delivery_movement.getRootDeliveryValue()
while isinstance(delivery, Base):
try:
instance_list.remove(delivery)
except ValueError:
pass
else:
instance_list.insert(0, delivery)
delivery = delivery.getParentValue()
for instance_to_update in instance_list:
result, property_dict = self._test(
instance_to_update, movement_group_node_list, divergence_list)
......
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