Commit 4d5d236c authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

code cleanup.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21025 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a1121043
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2008 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
......@@ -27,9 +27,7 @@
##############################################################################
#from Products.ERP5.Tool.SimulationTool import registerDeliverySolver
from DeliverySolver import DeliverySolver
from zLOG import LOG
class Distribute(DeliverySolver):
"""
......@@ -51,19 +49,12 @@ class Distribute(DeliverySolver):
for simulation_movement in simulation_movement_list:
quantity = simulation_movement.getCorrectedQuantity()
simulation_quantity += quantity
if simulation_quantity != 0:
for simulation_movement in simulation_movement_list:
#simulation_movement.setDeliveryRatio(simulation_movement.getCorrectedQuantity() / simulation_quantity)
simulation_movement.edit(delivery_ratio = simulation_movement.getCorrectedQuantity() / simulation_quantity)
#simulation_movement.immediateReindexObject()
simulation_movement.edit(delivery_ratio=simulation_movement.getCorrectedQuantity() / simulation_quantity)
else:
if len(simulation_movement_list) > 0:
delivery_ratio = 1./len(simulation_movement_list)
for simulation_movement in simulation_movement_list:
#simulation_movement.setDeliveryRatio(delivery_ratio)
simulation_movement.edit(delivery_ratio = delivery_ratio)
#movement.activate(after_path_and_method_id=([m.getPath() for m in simulation_movement_list], ['immediateReindexObject', 'recursiveImmediateReindexObject'])).edit()
#registerDeliverySolver(Distribute)
simulation_movement.edit(delivery_ratio=delivery_ratio)
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2008 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
......@@ -27,7 +27,6 @@
##############################################################################
# from Products.ERP5.Tool.SimulationTool import registerTargetSolver
from CopyToTarget import CopyToTarget
class ProfitAndLoss(CopyToTarget):
......@@ -49,12 +48,10 @@ class ProfitAndLoss(CopyToTarget):
if delivery_line_quantity is not None:
target_quantity = delivery_line_quantity * movement.getDeliveryRatio()
added_quantity = movement.getQuantity() - target_quantity
movement.edit(profit_quantity = added_quantity)
delivery = movement.getDeliveryValue()
if delivery is not None:
delivery.activate(
after_path_and_method_id = (
movement.getPath(),
['immediateReindexObject', 'recursiveImmediateReindexObject']
)
).edit()
movement.edit(profit_quantity=added_quantity)
delivery_line.activate(
after_path_and_method_id=(
movement.getPath(),
['immediateReindexObject', 'recursiveImmediateReindexObject']
)
).edit()
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