Commit 1a02ac9c authored by Arnaud Fontaine's avatar Arnaud Fontaine

erp5_accounting_l10n_fr: Make sure that FEC XML output is always the same given the same data.

parent aeafa160
......@@ -6,7 +6,8 @@ portal = context.getPortalObject()
active_process = portal.restrictedTraverse(active_process)
# XXX we need proxy role for this
result_list = active_process.getResultList()
result_list = [ result.detail.decode('zlib') for result in active_process.getResultList() ]
result_list.sort()
  • In erp5_deferred_style we had to switch to bzip2 because of some overflow with zlib

    5a20f582

  • also it would be better to use a generator, but I don't know if we can use a generator and sort

    ( result.detail.decode('zlib') for result in active_process.getResultList() ) only need one result in memory at a time.

Please register or sign in to reply
fec_file = context.AccountingTransactionModule_viewComptabiliteAsFECXML(
at_date=at_date,
......
......@@ -2,6 +2,6 @@
<comptabilite xmlns:tal="http://xml.zope.org/namespaces/tal">
<exercice>
<DateCloture tal:content="python: options['at_date'].strftime('%Y-%m-%d')">20141231</DateCloture>
<tal:block tal:repeat="result options/result_list"><tal:block tal:replace="structure python: result.detail.decode('zlib')"/></tal:block>
<tal:block tal:repeat="result options/result_list"><tal:block tal:replace="structure python: result"/></tal:block>
</exercice>
</comptabilite>
\ No newline at end of file
......@@ -7,7 +7,7 @@
<tal:block tal:replace="nothing"><EcritureLet></EcritureLet>
<DateLet></DateLet></tal:block>
<ValidDate tal:content="python: context.getModificationDate().strftime('%Y-%m-%d')">Modification Date</ValidDate>
<tal:block tal:repeat="line python:context.contentValues(portal_type=context.getPortalAccountingMovementTypeList())"><ligne
<tal:block tal:repeat="line python:sorted(context.contentValues(portal_type=context.getPortalAccountingMovementTypeList()), key=lambda x: (x.getDestination(), x.getQuantity()))"><ligne
tal:define="account python:line.getDestinationValue(portal_type='Account')" tal:condition="python: account is not None">
<CompteNum tal:content="account/Account_getGapId">Reference Compte (Account_getGapId)</CompteNum>
<CompteLib tal:content="line/Movement_getDestinationCompteLib">Translated Title Compte</CompteLib>
......
......@@ -7,7 +7,7 @@
<tal:block tal:replace="nothing"><EcritureLet></EcritureLet>
<DateLet></DateLet></tal:block>
<ValidDate tal:content="python: context.getModificationDate().strftime('%Y-%m-%d')">Modification Date</ValidDate>
<tal:block tal:repeat="line python:context.contentValues(portal_type=context.getPortalAccountingMovementTypeList())"><ligne
<tal:block tal:repeat="line python:sorted(context.contentValues(portal_type=context.getPortalAccountingMovementTypeList()), key=lambda x: (x.getSource(), x.getQuantity()))"><ligne
tal:define="account python:line.getSourceValue(portal_type='Account')" tal:condition="python: account is not None">
<CompteNum tal:content="account/Account_getGapId">Reference Compte (Account_getGapId)</CompteNum>
<CompteLib tal:content="line/Movement_getSourceCompteLib">Translated Title Compte</CompteLib>
......
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