simulation_movement.py 3.43 KB
Newer Older
1
# -*- coding: utf-8 -*-
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
##############################################################################
#
# Copyright (c) 2009 Nexedi SARL 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
# 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
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
##############################################################################
29 30 31
"""
Products.ERP5.interfaces.simulation_movement
"""
32

33 34 35 36
from Products.ERP5.interfaces.property_recordable import IPropertyRecordable
from Products.ERP5.interfaces.movement import IMovement
from Products.ERP5.interfaces.divergence_controller import IDivergenceController
from Products.ERP5.interfaces.business_completable import IBusinessCompletable
37

38
class ISimulationMovement(IMovement, IPropertyRecordable, IDivergenceController, IBusinessCompletable):
39 40
  """Simulation Movement interface specification

41 42 43 44
  The ISimulationMovement interface introduces in addition
  to IMovement the possibility to record properties by
  inheriting IPropertyRecordable, and to track rounding
  or non linearities of quantity at build time.
45

46
  The main equation to consider is:
47 48
      quantity(SM) + delivery_error (SM) =
        quantity(DL) * delivery_ratio(SM)
49
  where SM is a simulation movement and DL a delivery line.
50

51 52 53
  During the expand process, parent applied rules 
  may define the quantity of the simulation movement,
  but not the delivery_error. 
54

55 56 57
  During the build process, delivery_error can be used
  to store on the simulation movement amounts related
  to rounding or to floating point precision errors.
58

59 60
  During the expand process, child applied rules
  use getDeliveryQuantity rather than getQuantity.
61

62 63 64 65 66
  Solving quantity divergences can thus be obtained either
  by changing quantity (which then needs to backtracking)
  or by changing delivert_error (no backtracking needed)
  """
  def getDeliveryRatio():
67
    """
68 69 70
    Returns ratio to apply on the quantity
    property of the corresponding delivery
    to obtain the current quantity
71

72
    NOTE: redundant with Simulation Property Sheet
73 74
    """

75
  def getDeliveryError():
76
    """
77 78 79
    Returns correction to make the match
    between delivery quantity and simulation
    quantity consistent
80

81
    NOTE: redundant with Simulation Property Sheet
82 83
    """

84
  def getDeliveryQuantity():
85
    """
86 87 88 89 90
    Returns quantity which was actually shipped, taking
    into account the errors of the simulation fixed by
    the delivery:
      quantity + delivery_error
    """