Commit 0a4831ef authored by Arnaud Fontaine's avatar Arnaud Fontaine Committed by Xiaowu Zhang

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

parent 2628c214
......@@ -5,12 +5,14 @@ from io import BytesIO
import zipfile
from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Utils import ensure_ascii
import zlib
portal = context.getPortalObject()
active_process = portal.restrictedTraverse(active_process)
# XXX we need proxy role for this
result_list = active_process.getResultList()
result_list = [zlib.decompress(result.detail) for result in active_process.getResultList() ]
result_list.sort()
fec_file = context.AccountingTransactionModule_viewComptabiliteAsFECXML(
at_date=at_date,
......
......@@ -2,6 +2,6 @@
<comptabilite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="formatA47A-I-VII-1.xsd" 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: modules['zlib'].decompress(result.detail)"/></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
line_list = []
for line in context.contentValues(
portal_type=context.getPortalAccountingMovementTypeList()):
if side == 'source':
sorted_key = lambda x: (x.getSource(), x.getQuantity())
else:
assert side == 'destination'
sorted_key = lambda x: (x.getDestination(), x.getQuantity())
for line in sorted(context.contentValues(
portal_type=context.getPortalAccountingMovementTypeList()), key=sorted_key):
has_amount = True
if side == 'source':
account = line.getSourceValue(portal_type='Account')
......
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