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

WIP

parent 069abc69
...@@ -13,14 +13,11 @@ active_process = portal.portal_activities.newActiveProcess() ...@@ -13,14 +13,11 @@ active_process = portal.portal_activities.newActiveProcess()
priority = 4 priority = 4
#### AccountingTransactionModule_viewFrenchAccountingTransactionFileForPortalType #### AccountingTransactionModule_viewFrenchAccountingTransactionFileForPortalType
kind = 'portal_type' #kind = 'portal_type'
#kind = 'ledger' #kind = 'ledger'
#kind = 'portal_type_ledger' kind = 'portal_type_ledger'
# XXX we need proxy role for that
this_journal_active_process = portal.portal_activities.newActiveProcess().getRelativeUrl()
method_kw = { method_kw = {
'active_process': this_journal_active_process,
'section_uid_list': section_uid_list, 'section_uid_list': section_uid_list,
} }
...@@ -56,7 +53,7 @@ if kind == 'ledger': ...@@ -56,7 +53,7 @@ if kind == 'ledger':
for ledger_obj in ledger_obj_list: for ledger_obj in ledger_obj_list:
ledger_search_kw = search_kw.copy() ledger_search_kw = search_kw.copy()
ledger_search_kw['default_ledger_uid'] = ledger_obj.getUid() ledger_search_kw['default_ledger_uid'] = ledger_obj.getUid()
journal_search_kw_list.append((ledger_obj.getReference(), ledger_obj.getReference(), ledger_search_kw)) journal_search_kw_list.append((ledger_obj.getReference() or ledger_obj.getId(), ledger_obj.getReference() or ledger_obj.getId(), ledger_search_kw))
elif kind == 'portal_type_ledger': elif kind == 'portal_type_ledger':
if not ledger_obj_list: if not ledger_obj_list:
...@@ -64,19 +61,21 @@ elif kind == 'portal_type_ledger': ...@@ -64,19 +61,21 @@ elif kind == 'portal_type_ledger':
ledger_obj_list.append(category_tool.ledger.restrictedTraverse(ledger_relative_url)) ledger_obj_list.append(category_tool.ledger.restrictedTraverse(ledger_relative_url))
for ledger_obj in ledger_obj_list: for ledger_obj in ledger_obj_list:
for portal_type in portal.getPortalAccountingTransactionTypeList():
portal_type_ledger_search_kw = search_kw.copy() portal_type_ledger_search_kw = search_kw.copy()
portal_type_ledger_search_kw['default_ledger_uid'] = ledger_obj.getUid() portal_type_ledger_search_kw['default_ledger_uid'] = ledger_obj.getUid()
for portal_type in portal.getPortalAccountingTransactionTypeList():
portal_type_ledger_search_kw['portal_type'] = portal_type portal_type_ledger_search_kw['portal_type'] = portal_type
portal_type_obj = portal.portal_types[portal_type] portal_type_obj = portal.portal_types[portal_type]
journal_search_kw_list.append(("%s: %s" % (portal_type.getCompactTranslatedTitle(), ledger_obj.getReference()), journal_search_kw_list.append(("%s: %s" % (portal_type_obj.getCompactTranslatedTitle(), ledger_obj.getReference() or ledger_obj.getId()),
"%s: %s" % (portal_type.getTranslatedTitle(), ledger_obj.getReference()), "%s: %s" % (portal_type_obj.getTranslatedTitle(), ledger_obj.getReference() or ledger_obj.getId()),
portal_type_ledger_search_kw)) portal_type_ledger_search_kw))
# kind == 'portal_type' # kind == 'portal_type'
else: else:
if ledger_obj_list: if ledger_obj_list:
search_kw['default_ledger_uid'] = [ ledger_obj.getUid() for ledger_obj in ledger_obj_list ] search_kw['default_ledger_uid'] = [ ledger_obj.getUid() for ledger_obj in ledger_obj_list ]
for portal_type in portal.getPortalAccountingTransactionTypeList(): for portal_type in portal.getPortalAccountingTransactionTypeList():
portal_type_obj = portal.portal_types[portal_type] portal_type_obj = portal.portal_types[portal_type]
portal_type_search_kw = search_kw.copy() portal_type_search_kw = search_kw.copy()
...@@ -86,6 +85,10 @@ else: ...@@ -86,6 +85,10 @@ else:
## search_kw ## search_kw
for journal_code, journal_lib, search_kw in journal_search_kw_list: for journal_code, journal_lib, search_kw in journal_search_kw_list:
# XXX we need proxy role for that
this_journal_active_process = portal.portal_activities.newActiveProcess()
method_kw['active_process'] = this_journal_active_process.getRelativeUrl()
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
method_id='AccountingTransaction_postFECExtendedResult', method_id='AccountingTransaction_postFECExtendedResult',
method_kw=method_kw, method_kw=method_kw,
...@@ -99,7 +102,7 @@ for journal_code, journal_lib, search_kw in journal_search_kw_list: ...@@ -99,7 +102,7 @@ for journal_code, journal_lib, search_kw in journal_search_kw_list:
journal_code, journal_code,
journal_lib, journal_lib,
active_process=active_process.getRelativeUrl(), active_process=active_process.getRelativeUrl(),
this_journal_active_process=this_journal_active_process) this_journal_active_process=this_journal_active_process.getRelativeUrl())
#### AccountingTransactionModule_viewFrenchAccountingTransactionFileExtendedForPortalType #### AccountingTransactionModule_viewFrenchAccountingTransactionFileExtendedForPortalType
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<Montantdevise tal:content="python: '%0.2f' % (line.getDestinationDebit() if line.getQuantity() >= 0 else line.getDestinationCredit())"></Montantdevise> <Montantdevise tal:content="python: '%0.2f' % (line.getDestinationDebit() if line.getQuantity() >= 0 else line.getDestinationCredit())"></Montantdevise>
<Idevise tal:content="line/getResourceReference">Currency</Idevise> <Idevise tal:content="line/getResourceReference">Currency</Idevise>
<Montant tal:content="python: '%0.2f' % (line.getDestinationAssetDebit() if line.getQuantity() >= 0 else line.getDestinationAssetCredit())"></Montant> <Montant tal:content="python: '%0.2f' % (line.getDestinationAssetDebit() if line.getQuantity() >= 0 else line.getDestinationAssetCredit())"></Montant>
<Sens tal:content="python: '-1' if line.getQuantity() else '+1'"></Sens> <Sens tal:content="python: '-1' if line.getQuantity() >= 0 else '+1'"></Sens>
<tal:block tal:replace="structure line/getDescription"/> <tal:block tal:replace="structure line/getDescription"/>
</ligne></tal:block> </ligne></tal:block>
</ecriture> </ecriture>
\ No newline at end of file
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
<CompteAuxNum tal:content="python: third_party.getDestinationReference() or third_party.getSourceReference() or third_party.getReference() or third_party.getId()"></CompteAuxNum> <CompteAuxNum tal:content="python: third_party.getDestinationReference() or third_party.getSourceReference() or third_party.getReference() or third_party.getId()"></CompteAuxNum>
<CompteAuxLib tal:content="third_party/getTitle"></CompteAuxLib> <CompteAuxLib tal:content="third_party/getTitle"></CompteAuxLib>
</tal:block> </tal:block>
<Montantdevise tal:content="python: '%0.2f' % (line.getDestinationDebit() if line.getQuantity() >= 0 else line.getDestinationCredit())"></Montantdevise> <Montantdevise tal:content="python: '%0.2f' % (line.getSourceDebit() if line.getQuantity() >= 0 else line.getSourceCredit())"></Montantdevise>
<Idevise tal:content="line/getResourceReference">Currency</Idevise> <Idevise tal:content="line/getResourceReference">Currency</Idevise>
<Montant tal:content="python: '%0.2f' % (line.getDestinationAssetDebit() if line.getQuantity() >= 0 else line.getDestinationAssetCredit())"></Montant> <Montant tal:content="python: '%0.2f' % (line.getSourceAssetDebit() if line.getQuantity() >= 0 else line.getSourceAssetCredit())"></Montant>
<Sens tal:content="python: '-1' if line.getQuantity() else '+1'"></Sens> <Sens tal:content="python: '-1' if line.getQuantity() >= 0 else '+1'"></Sens>
<tal:block tal:replace="structure line/getDescription"/> <tal:block tal:replace="structure line/getDescription"/>
</ligne></tal:block> </ligne></tal:block>
</ecriture> </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