Commit b3de3db9 authored by Jérome Perrin's avatar Jérome Perrin

accounting_l10n_fr py3

parent 50268c94
......@@ -45,11 +45,8 @@ attachment_list = (
'content': zipbuffer.getvalue(),
'name': zipfilename, }, )
subject = translateString('French Accounting Transaction File')
if six.PY2:
subject = unicode(subject)
else:
subject = str(subject)
subject = six.text_type(
translateString('French Accounting Transaction File'))
portal.ERP5Site_notifyReportComplete(
user_name=user_name,
......
......@@ -29,7 +29,7 @@ if ledger is not None:
if isinstance(ledger, list) or isinstance(ledger, tuple):
ledger_uid = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger]
else:
ledger_uid = portal_categories.ledger.restrictedTraverse(item).getUid()
ledger_uid = portal_categories.ledger.restrictedTraverse(ledger).getUid()
else:
ledger_uid = None
......
......@@ -26,7 +26,7 @@ if ledger is not None:
if isinstance(ledger, list) or isinstance(ledger, tuple):
kw['ledger_uid'] = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger]
else:
kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(item).getUid()
kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(ledger).getUid()
sum_ = 0.0
for accountNumber in accounts:
......
......@@ -25,7 +25,7 @@ if ledger is not None:
if isinstance(ledger, list) or isinstance(ledger, tuple):
kw['ledger_uid'] = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger]
else:
kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(item).getUid()
kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(ledger).getUid()
sum_ = 0.0
for account in accounts:
......
......@@ -30,7 +30,7 @@ if ledger is not None:
if isinstance(ledger, list) or isinstance(ledger, tuple):
kw['ledger_uid'] = [portal_categories.ledger.restrictedTraverse(item).getUid() for item in ledger]
else:
kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(item).getUid()
kw['ledger_uid'] = portal_categories.ledger.restrictedTraverse(ledger).getUid()
# Find accounts that can be expanded according category membership
......@@ -47,7 +47,7 @@ accounts_to_expand_by_tp = rec_cat.getAccountTypeRelatedValueList(**params) + \
total_balance = 0.0
for account_gap_number in accounts:
# We get all acounts strict member of this GAP category
# We get all accounts strict member of this GAP category
gap = context.restrictedTraverse('portal_categories/' + getURL(account_gap_number))
for account in gap.getGapRelatedValueList(portal_type='Account'):
......
......@@ -30,11 +30,11 @@
"""Test suite for erp5_accounting_l10n_fr
"""
import unittest
import zipfile
import email
import io
import os.path
from six.moves import cStringIO as StringIO
import unittest
import zipfile
from DateTime import DateTime
from lxml import etree
......@@ -109,7 +109,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
os.path.dirname(Products.ERP5.tests.__file__),
'test_data',
noNamespaceSchemaLocation,
)) as f:
), 'rb') as f:
xmlschema_doc = etree.parse(f)
xmlschema = etree.XMLSchema(xmlschema_doc)
......@@ -121,14 +121,14 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertNotEqual((), last_message)
_, mto, message_text = last_message
self.assertEqual('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0])
mail_message = email.message_from_string(message_text)
mail_message = email.message_from_string(message_text.decode())
for part in mail_message.walk():
content_type = part.get_content_type()
file_name = part.get_filename()
if file_name == 'FEC-20141231.zip':
self.assertEqual('application/zip', content_type)
data = part.get_payload(decode=True)
zf = zipfile.ZipFile(StringIO(data))
zf = zipfile.ZipFile(io.BytesIO(data))
self.assertIn("12345689FEC20141231.xml", zf.namelist())
return zf.open("12345689FEC20141231.xml").read()
self.fail("Attachment not found")
......@@ -253,7 +253,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list))
journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")])
ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Premiere Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit")
......@@ -269,7 +269,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list))
journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")])
ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Seconde Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit")
......@@ -289,7 +289,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list))
journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")])
ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Premiere Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit")
......@@ -305,7 +305,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list))
journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")])
ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Seconde Ecriture', 'Troisieme Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit")
......@@ -324,7 +324,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list))
journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")])
ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Premiere Ecriture', 'Seconde Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit")
......@@ -340,7 +340,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list))
journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")])
ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Troisieme Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit")
......@@ -359,7 +359,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list))
journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")])
ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Premiere Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit")
......@@ -375,7 +375,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list))
journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")])
ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Seconde Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit")
......@@ -391,7 +391,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list))
journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")])
ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Troisieme Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment