diff --git a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_aggregateFrenchAccountingTransactionFile.py b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_aggregateFrenchAccountingTransactionFile.py index 76275c2535d75d7fd39907df550ed7b6a4059983..60edba1f6fdd3c1ae69dca0a001c60ae0d56514e 100644 --- a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_aggregateFrenchAccountingTransactionFile.py +++ b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_aggregateFrenchAccountingTransactionFile.py @@ -26,7 +26,16 @@ if test_compta_demat_compatibility: zipbuffer = StringIO() zipfilename = at_date.strftime('FEC-%Y%m%d.zip') 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() attachment_list = ( diff --git a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_aggregateFrenchAccountingTransactionFile.xml b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_aggregateFrenchAccountingTransactionFile.xml index 83e5072630e179cb7fa7321a3733ec657ed325d7..b8c9af765ab8c370564b65ef98dc1d707c615a14 100644 --- a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_aggregateFrenchAccountingTransactionFile.xml +++ b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_aggregateFrenchAccountingTransactionFile.xml @@ -50,7 +50,7 @@ </item> <item> <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> <key> <string>_proxy_roles</string> </key> diff --git a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_viewFrenchAccountingTransactionFileActive.py b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_viewFrenchAccountingTransactionFileActive.py index f7b7e2f72fcfc6ab86e1200593d1537b3b554c03..61196a4a1b4d02cb58958724506263cc35693269 100644 --- a/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_viewFrenchAccountingTransactionFileActive.py +++ b/bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_viewFrenchAccountingTransactionFileActive.py @@ -111,4 +111,5 @@ context.activate(after_tag=(tag, aggregate_tag)).AccountingTransactionModule_agg active_process.getRelativeUrl(), user_name=user_name, test_compta_demat_compatibility=test_compta_demat_compatibility, + section_uid_list=section_uid_list, ) diff --git a/bt5/erp5_accounting_l10n_fr/TestTemplateItem/portal_components/test.erp5.testAccounting_l10n_fr.py b/bt5/erp5_accounting_l10n_fr/TestTemplateItem/portal_components/test.erp5.testAccounting_l10n_fr.py index 7395d3167a8d784c212ce041a5442e170c346ed9..ea42c507db0029a0658aa617b97bab94d40c5058 100644 --- a/bt5/erp5_accounting_l10n_fr/TestTemplateItem/portal_components/test.erp5.testAccounting_l10n_fr.py +++ b/bt5/erp5_accounting_l10n_fr/TestTemplateItem/portal_components/test.erp5.testAccounting_l10n_fr.py @@ -56,6 +56,13 @@ class TestAccounting_l10n_fr(AccountingTestCase): def 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 account_module = self.portal.account_module account_module.payable.setGap('fr/pcg/4/40/401') @@ -122,7 +129,8 @@ class TestAccounting_l10n_fr(AccountingTestCase): self.assertEqual('application/zip', content_type) data = part.get_payload(decode=True) 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") def test_FEC(self):