From 1ca536f1598c77c64e4bf1b33ebf860e4612a442 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Mon, 9 Nov 2009 15:17:28 +0000 Subject: [PATCH] implement FILO delivery solver based on FIFO delivery solver. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30434 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/DeliverySolver/FILO.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/product/ERP5/DeliverySolver/FILO.py b/product/ERP5/DeliverySolver/FILO.py index 50067734a7..c352e68e84 100644 --- a/product/ERP5/DeliverySolver/FILO.py +++ b/product/ERP5/DeliverySolver/FILO.py @@ -27,11 +27,26 @@ # ############################################################################## +import zope.interface +from Products.ERP5Type import interfaces -from DeliverySolver import DeliverySolver +from FIFO import FIFO -class FILO(DeliverySolver): +class FILO(FIFO): """ - The FILO solver reduces deliveted quantity by reducing the quantity of simulation movements from the first order. + The FILO solver reduces deliveted quantity by reducing the quantity of + simulation movements from the first order. """ + # Declarative interfaces + zope.interface.implements(interfaces.IDeliverySolver) + + def _getSimulationMovementList(self): + """ + Returns a list of simulation movement sorted from the first order. + """ + simulation_movement_list = self.simulation_movement_list[:] + if len(simulation_movement_list): + simulation_movement_list.sort( + key=lambda x:x.getExplainationValue().getStartDate()) + return simulation_movement_list -- 2.30.9