[Erp5-report] r36790 nicolas.dumazet - /erp5/trunk/products/ERP5/Document/Movement.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 2 04:36:09 CEST 2010


Author: nicolas.dumazet
Date: Fri Jul  2 04:36:08 2010
New Revision: 36790

URL: http://svn.erp5.org?rev=36790&view=rev
Log:
use xors

Modified:
    erp5/trunk/products/ERP5/Document/Movement.py

Modified: erp5/trunk/products/ERP5/Document/Movement.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Movement.py?rev=36790&r1=36789&r2=36790&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Movement.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Movement.py [utf8] Fri Jul  2 04:36:08 2010
@@ -785,9 +785,7 @@ class Movement(XMLObject, Amount, Compos
       quantity = float(quantity)
     except TypeError:
       quantity = 0.0
-    if (quantity < 0 and not self.isCancellationAmount()):
-      return - quantity
-    elif quantity > 0 and self.isCancellationAmount():
+    if (quantity < 0) ^ bool(self.isCancellationAmount()):
       return - quantity
     return 0.0
 
@@ -802,8 +800,7 @@ class Movement(XMLObject, Amount, Compos
       quantity = float(quantity)
     except TypeError:
       quantity = 0.0
-    if quantity < 0 and not self.isCancellationAmount() \
-      or quantity > 0 and self.isCancellationAmount():
+    if (quantity < 0) ^ bool(self.isCancellationAmount()):
       return 0.0
     return quantity
 
@@ -885,8 +882,7 @@ class Movement(XMLObject, Amount, Compos
       quantity = float(quantity)
     except TypeError:
       quantity = 0.0
-    if quantity < 0 and not self.isCancellationAmount() \
-      or quantity > 0 and self.isCancellationAmount():
+    if (quantity < 0) ^ bool(self.isCancellationAmount()):
       return 0.0
     return quantity
 
@@ -905,9 +901,7 @@ class Movement(XMLObject, Amount, Compos
       quantity = float(quantity)
     except TypeError:
       quantity = 0.0
-    if (quantity < 0 and not self.isCancellationAmount()):
-      return - quantity
-    elif quantity > 0 and self.isCancellationAmount():
+    if (quantity < 0) ^ bool(self.isCancellationAmount()):
       return - quantity
     return 0.0
   
@@ -926,8 +920,7 @@ class Movement(XMLObject, Amount, Compos
       quantity = float(quantity)
     except TypeError:
       quantity = 0.0
-    if quantity < 0 and not self.isCancellationAmount() \
-      or quantity > 0 and self.isCancellationAmount():
+    if (quantity < 0) ^ bool(self.isCancellationAmount()):
       return 0.0
     return quantity
 
@@ -946,9 +939,7 @@ class Movement(XMLObject, Amount, Compos
       quantity = float(quantity)
     except TypeError:
       quantity = 0.0
-    if (quantity < 0 and not self.isCancellationAmount()):
-      return - quantity
-    elif quantity > 0 and self.isCancellationAmount():
+    if (quantity < 0) ^ bool(self.isCancellationAmount()):
       return - quantity
     return 0.0
   




More information about the Erp5-report mailing list