Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package trytond_currency for 
openSUSE:Factory checked in at 2021-05-18 18:26:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/trytond_currency (Old)
 and      /work/SRC/openSUSE:Factory/.trytond_currency.new.2988 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "trytond_currency"

Tue May 18 18:26:57 2021 rev:11 rq:893825 version:5.0.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/trytond_currency/trytond_currency.changes        
2021-03-02 12:45:03.264334652 +0100
+++ 
/work/SRC/openSUSE:Factory/.trytond_currency.new.2988/trytond_currency.changes  
    2021-05-18 18:27:21.494724258 +0200
@@ -1,0 +2,5 @@
+Mon May 10 18:18:25 UTC 2021 - Axel Braun <axel.br...@gmx.de>
+
+- Version 5.0.5 - Bugfix Release
+
+-------------------------------------------------------------------

Old:
----
  trytond_currency-5.0.4.tar.gz
  trytond_currency-5.0.4.tar.gz.asc

New:
----
  trytond_currency-5.0.5.tar.gz
  trytond_currency-5.0.5.tar.gz.asc

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ trytond_currency.spec ++++++
--- /var/tmp/diff_new_pack.YrDAqn/_old  2021-05-18 18:27:22.006722040 +0200
+++ /var/tmp/diff_new_pack.YrDAqn/_new  2021-05-18 18:27:22.010722022 +0200
@@ -19,7 +19,7 @@
 
 %define majorver 5.0
 Name:           trytond_currency
-Version:        %{majorver}.4
+Version:        %{majorver}.5
 Release:        0
 Summary:        The "currency" module for the Tryton ERP system
 License:        GPL-3.0-only

++++++ trytond_currency-5.0.4.tar.gz -> trytond_currency-5.0.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_currency-5.0.4/.hgtags 
new/trytond_currency-5.0.5/.hgtags
--- old/trytond_currency-5.0.4/.hgtags  2020-04-04 17:52:49.000000000 +0200
+++ new/trytond_currency-5.0.5/.hgtags  2021-05-05 22:52:34.000000000 +0200
@@ -23,3 +23,4 @@
 81fd9eaf72960219583fdd365adbf94b8024690f 5.0.2
 eed702290426df427a07b1275916e51897fe7b83 5.0.3
 0628c698159b652c231e63325b4b48ffb4c465ab 5.0.4
+2052c69657e8076e04ea437eba409471d22342ed 5.0.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_currency-5.0.4/CHANGELOG 
new/trytond_currency-5.0.5/CHANGELOG
--- old/trytond_currency-5.0.4/CHANGELOG        2020-04-04 17:52:48.000000000 
+0200
+++ new/trytond_currency-5.0.5/CHANGELOG        2021-05-05 22:52:33.000000000 
+0200
@@ -1,3 +1,6 @@
+Version 5.0.5 - 2021-05-05
+* Bug fixes (see mercurial logs for details)
+
 Version 5.0.4 - 2020-04-04
 * Bug fixes (see mercurial logs for details)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_currency-5.0.4/COPYRIGHT 
new/trytond_currency-5.0.5/COPYRIGHT
--- old/trytond_currency-5.0.4/COPYRIGHT        2020-04-04 17:52:48.000000000 
+0200
+++ new/trytond_currency-5.0.5/COPYRIGHT        2021-05-05 22:52:33.000000000 
+0200
@@ -1,6 +1,6 @@
-Copyright (C) 2008-2020 C??dric Krier.
+Copyright (C) 2008-2021 C??dric Krier.
 Copyright (C) 2008-2013 Bertrand Chenal.
-Copyright (C) 2008-2020 B2CK SPRL.
+Copyright (C) 2008-2021 B2CK SPRL.
 
 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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_currency-5.0.4/PKG-INFO 
new/trytond_currency-5.0.5/PKG-INFO
--- old/trytond_currency-5.0.4/PKG-INFO 2020-04-04 17:52:50.000000000 +0200
+++ new/trytond_currency-5.0.5/PKG-INFO 2021-05-05 22:52:35.471359700 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: trytond_currency
-Version: 5.0.4
+Version: 5.0.5
 Summary: Tryton module with currencies
 Home-page: http://www.tryton.org/
 Author: Tryton
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_currency-5.0.4/currency.py 
new/trytond_currency-5.0.5/currency.py
--- old/trytond_currency-5.0.4/currency.py      2019-11-15 22:28:07.000000000 
+0100
+++ new/trytond_currency-5.0.5/currency.py      2021-04-19 23:57:44.000000000 
+0200
@@ -136,6 +136,8 @@
 
     def round(self, amount, rounding=ROUND_HALF_EVEN):
         'Round the amount depending of the currency'
+        if not self.rounding:
+            return amount
         with localcontext() as ctx:
             ctx.prec = max(ctx.prec, (amount / self.rounding).adjusted() + 1)
             # Divide and multiple by rounding for case rounding is not 10En
@@ -145,7 +147,9 @@
 
     def is_zero(self, amount):
         'Return True if the amount can be considered as zero for the currency'
-        return abs(self.round(amount)) < self.rounding
+        if not self.rounding:
+            return not amount
+        return abs(self.round(amount)) < abs(self.rounding)
 
     @classmethod
     def compute(cls, from_currency, amount, to_currency, round=True):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_currency-5.0.4/tests/test_currency.py 
new/trytond_currency-5.0.5/tests/test_currency.py
--- old/trytond_currency-5.0.4/tests/test_currency.py   2018-11-03 
01:21:58.000000000 +0100
+++ new/trytond_currency-5.0.5/tests/test_currency.py   2021-04-19 
23:57:44.000000000 +0200
@@ -87,6 +87,118 @@
                 })
 
     @with_transaction()
+    def test_round(self):
+        "Test simple round"
+        cu = create_currency('cu')
+        cu.rounding = Decimal('0.001')
+        cu.digits = 3
+        cu.save()
+
+        rounded = cu.round(Decimal('1.2345678'))
+
+        self.assertEqual(rounded, Decimal('1.235'))
+
+    @with_transaction()
+    def test_round_non_unity(self):
+        "Test round with non unity"
+        cu = create_currency('cu')
+        cu.rounding = Decimal('0.02')
+        cu.digits = 2
+        cu.save()
+
+        rounded = cu.round(Decimal('1.2345'))
+
+        self.assertEqual(rounded, Decimal('1.24'))
+
+    @with_transaction()
+    def test_round_big_number(self):
+        "Test rounding big number"
+        cu = create_currency('cu')
+
+        rounded = cu.round(Decimal('1E50'))
+
+        self.assertEqual(rounded, Decimal('1E50'))
+
+    @with_transaction()
+    def test_round_negative(self):
+        "Test rounding with negative rounding"
+        cu = create_currency('cu')
+        cu.rounding = -Decimal('0.1')
+        cu.digits = 1
+        cu.save()
+
+        rounded = cu.round(Decimal('1.23'))
+
+        self.assertEqual(rounded, Decimal('1.2'))
+
+    @with_transaction()
+    def test_round_zero(self):
+        "Test rounding with 0 as rounding"
+        cu = create_currency('cu')
+        cu.rounding = Decimal('0')
+        cu.save()
+
+        rounded = cu.round(Decimal('1.2345'))
+
+        self.assertEqual(rounded, Decimal('1.2345'))
+
+    @with_transaction()
+    def test_is_zero(self):
+        "Test is zero"
+        cu = create_currency('cu')
+        cu.rounding = Decimal('0.001')
+        cu.digits = 3
+        cu.save()
+
+        for value, result in [
+                (Decimal('0'), True),
+                (Decimal('0.0002'), True),
+                (Decimal('0.0009'), False),
+                (Decimal('0.002'), False),
+                ]:
+            with self.subTest(value=value):
+                self.assertEqual(cu.is_zero(value), result)
+            with self.subTest(value=-value):
+                self.assertEqual(cu.is_zero(-value), result)
+
+    @with_transaction()
+    def test_is_zero_negative(self):
+        "Test is zero with negative rounding"
+        cu = create_currency('cu')
+        cu.rounding = Decimal('-0.001')
+        cu.digits = 3
+        cu.save()
+
+        for value, result in [
+                (Decimal('0'), True),
+                (Decimal('0.0002'), True),
+                (Decimal('0.0009'), False),
+                (Decimal('0.002'), False),
+                ]:
+            with self.subTest(value=value):
+                self.assertEqual(cu.is_zero(value), result)
+            with self.subTest(value=-value):
+                self.assertEqual(cu.is_zero(-value), result)
+
+    @with_transaction()
+    def test_is_zero_zero(self):
+        "Test is zero with 0 as rounding"
+        cu = create_currency('cu')
+        cu.rounding = Decimal('0')
+        cu.save()
+
+        for value, result in [
+                (Decimal('0'), True),
+                (Decimal('0.0002'), False),
+                (Decimal('0.0009'), False),
+                (Decimal('0.002'), False),
+                ]:
+            with self.subTest(value=value):
+                self.assertEqual(cu.is_zero(value), result)
+            with self.subTest(value=-value):
+                self.assertEqual(cu.is_zero(-value), result)
+
+    @with_transaction()
     def test_compute_simple(self):
         'Simple conversion'
         pool = Pool()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_currency-5.0.4/tryton.cfg 
new/trytond_currency-5.0.5/tryton.cfg
--- old/trytond_currency-5.0.4/tryton.cfg       2019-11-15 22:28:07.000000000 
+0100
+++ new/trytond_currency-5.0.5/tryton.cfg       2020-04-04 17:52:57.000000000 
+0200
@@ -1,5 +1,5 @@
 [tryton]
-version=5.0.4
+version=5.0.5
 depends:
     ir
     res
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/trytond_currency-5.0.4/trytond_currency.egg-info/PKG-INFO 
new/trytond_currency-5.0.5/trytond_currency.egg-info/PKG-INFO
--- old/trytond_currency-5.0.4/trytond_currency.egg-info/PKG-INFO       
2020-04-04 17:52:49.000000000 +0200
+++ new/trytond_currency-5.0.5/trytond_currency.egg-info/PKG-INFO       
2021-05-05 22:52:34.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: trytond-currency
-Version: 5.0.4
+Version: 5.0.5
 Summary: Tryton module with currencies
 Home-page: http://www.tryton.org/
 Author: Tryton

Reply via email to