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

accounting_l10n_fr: more fixes for FEC

See merge request nexedi/erp5!1767
parents 5162d9e3 968c3f7b
Pipeline #27498 failed with stage
in 0 seconds
# coding: utf-8
import unicodedata
from cStringIO import StringIO
import zipfile
from Products.ERP5Type.Message import translateString
......@@ -13,15 +14,13 @@ fec_file = context.AccountingTransactionModule_viewComptabiliteAsFECXML(
at_date=at_date,
result_list=result_list)
if test_compta_demat_compatibility:
fec_file = (fec_file
# https://github.com/DGFiP/Test-Compta-Demat/issues/37
.replace(u"’", u"'")
.replace(u"Œ", u"OE")
.replace(u"œ", u"oe")
.replace(u"Ÿ", u"Y")
# https://github.com/DGFiP/Test-Compta-Demat/issues/39
.replace(u"€", u"EUR")
)
# normalize all non ascii characters (é => e), while still keeping
# some "important" characters such as €
# https://github.com/DGFiP/Test-Compta-Demat/issues/37
# https://github.com/DGFiP/Test-Compta-Demat/issues/39
fec_file = unicodedata.normalize(
'NFKD', fec_file.replace(u"€", "EUR")
).encode('ascii', 'ignore')
zipbuffer = StringIO()
zipfilename = at_date.strftime('FEC-%Y%m%d.zip')
......
......@@ -9,7 +9,7 @@
<ValidDate tal:content="python: context.AccountingTransaction_getDeliverDate().strftime('%Y-%m-%d')">Modification Date</ValidDate>
<tal:block tal:repeat="line python:context.contentValues(portal_type=context.getPortalAccountingMovementTypeList())"><ligne
tal:define="account python:line.getDestinationValue(portal_type='Account')"
tal:condition="python: account is not None and (line.getQuantity() or line.getDestinationAssetDebit() or line.getDestinationAssetCredit() or not options['test_compta_demat_compatibility'])">
tal:condition="python: account is not None and ((line.getDestinationTotalAssetPrice() if line.hasDestinationTotalAssetPrice() else line.getQuantity()) or not options['test_compta_demat_compatibility'])">
<CompteNum tal:content="account/Account_getGapId">Reference Compte (Account_getGapId)</CompteNum>
<CompteLib tal:content="line/Movement_getDestinationCompteLib">Translated Title Compte</CompteLib>
<tal:block tal:condition="python: account.getAccountType() in ('asset/receivable', 'liability/payable')"
......@@ -17,7 +17,7 @@
<CompteAuxLib tal:content="third_party/getTitle"></CompteAuxLib></tal:block><tal:block>
<Montantdevise></Montantdevise>
<Idevise></Idevise></tal:block>
<Debit tal:content="python: '%0.2f' % (line.getDestinationAssetDebit() or line.getDestinationDebit())"></Debit>
<Credit tal:content="python: '%0.2f' % (line.getDestinationAssetCredit() or line.getDestinationCredit())"></Credit>
<Debit tal:content="python: '%0.2f' % (line.getDestinationAssetDebit() if line.hasDestinationTotalAssetPrice() else line.getDestinationDebit())"></Debit>
<Credit tal:content="python: '%0.2f' % (line.getDestinationAssetCredit() if line.hasDestinationTotalAssetPrice() else line.getDestinationCredit())"></Credit>
</ligne></tal:block>
</ecriture>
\ No newline at end of file
......@@ -9,7 +9,7 @@
<ValidDate tal:content="python: context.AccountingTransaction_getDeliverDate().strftime('%Y-%m-%d')">Modification Date</ValidDate>
<tal:block tal:repeat="line python:context.contentValues(portal_type=context.getPortalAccountingMovementTypeList())"><ligne
tal:define="account python:line.getSourceValue(portal_type='Account')"
tal:condition="python: account is not None and (line.getQuantity() or line.getSourceAssetDebit() or line.getSourceAssetCredit() or not options['test_compta_demat_compatibility'])">
tal:condition="python: account is not None and ((line.getSourceTotalAssetPrice() if line.hasSourceTotalAssetPrice() else line.getQuantity()) or not options['test_compta_demat_compatibility'])">
<CompteNum tal:content="account/Account_getGapId">Reference Compte (Account_getGapId)</CompteNum>
<CompteLib tal:content="line/Movement_getSourceCompteLib">Translated Title Compte</CompteLib>
<tal:block tal:condition="python: account.getAccountType() in ('asset/receivable', 'liability/payable')"
......@@ -17,7 +17,7 @@
<CompteAuxLib tal:content="third_party/getTitle"></CompteAuxLib></tal:block><tal:block>
<Montantdevise></Montantdevise>
<Idevise></Idevise></tal:block>
<Debit tal:content="python: '%0.2f' % (line.getSourceAssetDebit() or line.getSourceDebit())"></Debit>
<Credit tal:content="python: '%0.2f' % (line.getSourceAssetCredit() or line.getSourceCredit())"></Credit>
<Debit tal:content="python: '%0.2f' % (line.getSourceAssetDebit() if line.hasSourceTotalAssetPrice() else line.getSourceDebit())"></Debit>
<Credit tal:content="python: '%0.2f' % (line.getSourceAssetCredit() if line.hasSourceTotalAssetPrice() else line.getSourceCredit())"></Credit>
</ligne></tal:block>
</ecriture>
\ No newline at end of file
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