Commit 827410dc authored by Jérome Perrin's avatar Jérome Perrin

accounting_l10n_fr: fix filename of FEC.xml

> IX. – Le fichier des écritures comptables est nommé selon la
> nomenclature suivante :
>
> SirenFECAAAAMMJJ, où " Siren " est le Siren du contribuable mentionné
> à l'article L. 47 A et AAAAMMJJ la date de clôture de l'exercice
> comptable.
parent d74f56b6
Pipeline #27538 failed with stage
in 0 seconds
...@@ -26,7 +26,16 @@ if test_compta_demat_compatibility: ...@@ -26,7 +26,16 @@ if test_compta_demat_compatibility:
zipbuffer = StringIO() zipbuffer = StringIO()
zipfilename = at_date.strftime('FEC-%Y%m%d.zip') zipfilename = at_date.strftime('FEC-%Y%m%d.zip')
zipfileobj = zipfile.ZipFile(zipbuffer, 'w', compression=zipfile.ZIP_DEFLATED) zipfileobj = zipfile.ZipFile(zipbuffer, 'w', compression=zipfile.ZIP_DEFLATED)
zipfileobj.writestr('FEC.xml', fec_file.encode('utf8')) filename = 'FEC.xml'
if test_compta_demat_compatibility:
siren = ''
if section_uid_list:
siret_list = [b.getObject().getCorporateRegistrationCode() for b in portal.portal_catalog(uid=section_uid_list)]
siret_list = [siret for siret in siret_list if siret]
if len(siret_list) == 1:
siren = siret_list[0][:8]
filename = at_date.strftime('{siren}FEC%Y%m%d.xml').format(siren=siren)
zipfileobj.writestr(filename, fec_file.encode('utf8'))
zipfileobj.close() zipfileobj.close()
attachment_list = ( attachment_list = (
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>at_date, active_process, user_name, test_compta_demat_compatibility</string> </value> <value> <string>at_date, active_process, user_name, test_compta_demat_compatibility, section_uid_list</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
......
...@@ -111,4 +111,5 @@ context.activate(after_tag=(tag, aggregate_tag)).AccountingTransactionModule_agg ...@@ -111,4 +111,5 @@ context.activate(after_tag=(tag, aggregate_tag)).AccountingTransactionModule_agg
active_process.getRelativeUrl(), active_process.getRelativeUrl(),
user_name=user_name, user_name=user_name,
test_compta_demat_compatibility=test_compta_demat_compatibility, test_compta_demat_compatibility=test_compta_demat_compatibility,
section_uid_list=section_uid_list,
) )
...@@ -56,6 +56,13 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -56,6 +56,13 @@ class TestAccounting_l10n_fr(AccountingTestCase):
def afterSetUp(self): def afterSetUp(self):
AccountingTestCase.afterSetUp(self) AccountingTestCase.afterSetUp(self)
# set a corporate registration code (siret) on our section organisation
# > Le numéro SIRET (ou système d'identification du répertoire des
# > établissements) identifie chaque établissement de l'entreprise.
# > Il se compose de 14 chiffres : les neuf chiffres du numéro SIREN +
# > les cinq chiffres correspondant à un numéro NIC (numéro interne de
# > classement).
self.section.setCorporateRegistrationCode('12345689 12345')
# set a french gap on test accounts # set a french gap on test accounts
account_module = self.portal.account_module account_module = self.portal.account_module
account_module.payable.setGap('fr/pcg/4/40/401') account_module.payable.setGap('fr/pcg/4/40/401')
...@@ -122,7 +129,8 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -122,7 +129,8 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual('application/zip', content_type) self.assertEqual('application/zip', content_type)
data = part.get_payload(decode=True) data = part.get_payload(decode=True)
zf = zipfile.ZipFile(StringIO(data)) zf = zipfile.ZipFile(StringIO(data))
return zf.open("FEC.xml").read() self.assertIn("12345689FEC20141231.xml", zf.namelist())
return zf.open("12345689FEC20141231.xml").read()
self.fail("Attachment not found") self.fail("Attachment not found")
def test_FEC(self): def test_FEC(self):
......
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