use locale.format to format amount
This commit is contained in:
parent
e6ff21340f
commit
2c7e77ae3c
1 changed files with 6 additions and 1 deletions
|
|
@ -17,6 +17,8 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import re
|
||||
import locale
|
||||
from decimal import Decimal
|
||||
|
||||
from weboob.deprecated.browser import Page
|
||||
|
|
@ -108,7 +110,10 @@ class NewPartHistoryPage(Page):
|
|||
raw = transaction['displayType']
|
||||
t.parse(date=date, raw=raw)
|
||||
try:
|
||||
amount = transaction['netAmount'].replace('.', ',')
|
||||
m = re.search("\D", transaction['netAmount'][::-1])
|
||||
amount = Decimal(transaction['amount'])/Decimal((10 ** m.start()))
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
amount = locale.format('%.2f', amount)
|
||||
except KeyError:
|
||||
return
|
||||
if transaction['isCredit']:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue