diff --git a/product/ERP5/DeliverySolver/Distribute.py b/product/ERP5/DeliverySolver/Distribute.py index 196e3e349047df4e00252eaae00223ac1b219c8e..95c9b7c55535914755e950bc5e802630389cac48 100644 --- a/product/ERP5/DeliverySolver/Distribute.py +++ b/product/ERP5/DeliverySolver/Distribute.py @@ -1,13 +1,13 @@ ############################################################################## # -# 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) diff --git a/product/ERP5/TargetSolver/ProfitAndLoss.py b/product/ERP5/TargetSolver/ProfitAndLoss.py index c6a6b52a47c813802cd3eb80f7a86473c47cb967..613979a90d0de4cc3f0c4b57f6c52e45376dae27 100644 --- a/product/ERP5/TargetSolver/ProfitAndLoss.py +++ b/product/ERP5/TargetSolver/ProfitAndLoss.py @@ -1,13 +1,13 @@ ############################################################################## # -# 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()