Commit 1c7e585b authored by Yoshinori Okuji's avatar Yoshinori Okuji

Move the part of the code that modifies simulation movements from OrderBuilder...

Move the part of the code that modifies simulation movements from OrderBuilder to DeliveryBuilder, because OrderBuilder makes no relationship between simulation movements and delivery movements.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33182 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fedacbb4
......@@ -157,6 +157,18 @@ class DeliveryBuilder(OrderBuilder):
update_existing_movement=update_existing_movement,
force_update=force_update,
activate_kw=activate_kw)
if update_existing_movement and not force_update:
# Important.
# Attributes of delivery_movement must not be modified here.
# Because we can not change values modified by the user.
# Delivery will probably diverge now, but this is not the job of
# DeliveryBuilder to resolve such problem.
# Use Solver instead.
simulation_movement.edit(delivery_ratio=0)
else:
simulation_movement.edit(delivery_ratio=1)
simulation_movement.edit(delivery_value=delivery_movement,
activate_kw=activate_kw)
......
......@@ -662,24 +662,14 @@ class OrderBuilder(XMLObject, Amount, Predicate):
force_update=0, activate_kw=None):
"""
Initialize or update delivery movement properties.
Set delivery ratio on simulation movement.
"""
if update_existing_movement == 1 and not force_update:
# Important.
# Attributes of object_to_update must not be modified here.
# Because we can not change values that user modified.
# Delivery will probably diverge now, but this is not the job of
# DeliveryBuilder to resolve such problem.
# Use Solver instead.
simulation_movement.edit(delivery_ratio=0)
else:
if not update_existing_movement or force_update:
# Now, only 1 movement is possible, so copy from this movement
# XXX hardcoded value
property_dict['quantity'] = simulation_movement.getQuantity()
property_dict['price'] = simulation_movement.getPrice()
# Update properties on object (quantity, price...)
delivery_movement._edit(force_update=1, **property_dict)
simulation_movement.edit(delivery_ratio=1)
@UnrestrictedMethod
def callAfterBuildingScript(self, delivery_list, movement_list=None, **kw):
......
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