From 5ffa7d19c00e0c2e67f999b8a0215fae6aa16aff Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sat, 25 Jul 2015 22:23:47 +0200 Subject: [PATCH] correctly set amount and currency on bills --- modules/edf/pages.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/modules/edf/pages.py b/modules/edf/pages.py index 17ae73b7..8ab6a059 100644 --- a/modules/edf/pages.py +++ b/modules/edf/pages.py @@ -22,8 +22,10 @@ from datetime import datetime import re import urllib from decimal import Decimal + from weboob.deprecated.browser import Page from weboob.capabilities.bill import Subscription, Detail, Bill +from weboob.tools.capabilities.bank.transactions import FrenchTransaction base_url = "http://particuliers.edf.com/" @@ -109,19 +111,15 @@ class BillsPage(EdfBasePage): if amount is None: continue - # Remove SPACE character - amount = re.sub(u'\xa0', '', amount) - - # Remove euro character - amount = re.sub(u'\u20ac', '', amount) - - bil = Bill() - bil.id = sub._id + "." + date.strftime("%Y%m%d") - bil.date = date - bil.label = u''+amount.strip() - bil.format = u'pdf' - bil._url = url - yield bil + bill = Bill() + bill.id = sub._id + "." + date.strftime("%Y%m%d") + bill.price = Decimal(FrenchTransaction.clean_amount(amount)) + bill.currency = bill.get_currency(amount) + bill.date = date + bill.label = self.parser.tocleanstring(list_tds[0]) + bill.format = u'pdf' + bill._url = url + yield bill def get_bill(self, bill): self.location(bill._url)