[Erp5-report] r37274 yo - /erp5/trunk/products/ERP5/Document/SimulationMovement.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Jul 27 10:36:23 CEST 2010
Author: yo
Date: Tue Jul 27 10:36:21 2010
New Revision: 37274
URL: http://svn.erp5.org?rev=37274&view=rev
Log:
getCorrectedQuantity must not use a mapped quantity, as any mapping must not be enabled in the simulation world. Instead, every caller must specify which is wanted very explicitly. This change also fixes that delivery error and profit quantity were not handled correctly when quantity was inversed.
Modified:
erp5/trunk/products/ERP5/Document/SimulationMovement.py
Modified: erp5/trunk/products/ERP5/Document/SimulationMovement.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/SimulationMovement.py?rev=37274&r1=37273&r2=37274&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/SimulationMovement.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/SimulationMovement.py [utf8] Tue Jul 27 10:36:21 2010
@@ -453,7 +453,7 @@ class SimulationMovement(Movement, Prope
Look are invocations of _isProfitAndLossMovement in
ERP5.mixin.rule to understand how.
"""
- quantity = self.getMappedProperty('quantity')
+ quantity = self.getQuantity()
profit_quantity = self.getProfitQuantity() or 0
delivery_error = self.getDeliveryError() or 0
return quantity - profit_quantity + delivery_error
@@ -608,6 +608,21 @@ class SimulationMovement(Movement, Prope
def getMappedProperty(self, property):
mapping = self.getPropertyMappingValue()
if mapping is not None:
+ # Special case: corrected quantity is difficult to handle,
+ # because, if quantity is negatated in the mapping, other
+ # parameters, profit quantity (deprecated) and delivery error,
+ # must be negatated as well.
+ if property == 'corrected_quantity':
+ mapped_quantity_id = mapping.getMappedPropertyId('quantity')
+ quantity = mapping.getMappedProperty(self, 'quantity')
+ profit_quantity = self.getProfitQuantity() or 0
+ delivery_error = self.getDeliveryError() or 0
+ if mapped_quantity_id[:1] == '-':
+ # XXX what about if "quantity | -something_different" is
+ # specified?
+ return quantity + profit_quantity - delivery_error
+ else:
+ return quantity - profit_quantity + delivery_error
return mapping.getMappedProperty(self, property)
else:
return self.getProperty(property)
More information about the Erp5-report
mailing list