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

support printing a journal from the selection of accounting transaction module



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10605 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c8f33ad7
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.CMFCore.ActionInformation</string>
<string>ActionInformation</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_print</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>journal_from_selection</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.5</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Journal from Selection</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.CMFCore.Expression</string>
<string>Expression</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/AccountingTransactionModule_viewJournalAsPdf</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
"""\n """\n
Journal entries, for use with AccountingTransactionModule_viewJournal\n Returns journal entries, for use with AccountingTransactionModule_viewJournal\n
\n \n
return a list of dictionnaries like that :\n return a list of dictionnaries like that :\n
\n \n
...@@ -87,45 +87,59 @@ ...@@ -87,45 +87,59 @@
"""\n """\n
\n \n
request = context.REQUEST\n request = context.REQUEST\n
at_date = request[\'at_date\']\n selection_name = "accounting_selection"\n
transaction_section_category = request[\'transaction_section_category\']\n
transaction_simulation_state = request[\'transaction_simulation_state\']\n
transaction_portal_type = request[\'transaction_portal_type\']\n
from_date = request.get(\'from_date\', None)\n
\n
N_ = context.Base_translateString\n N_ = context.Base_translateString\n
\n
params = { \'sort_on\' : \'delivery.start_date\'\n
, \'at_date\' : at_date\n
, \'simulation_state\': transaction_simulation_state\n
, \'section_category\': transaction_section_category\n
, \'portal_type\' : transaction_portal_type\n
}\n
\n
if from_date:\n
params[\'from_date\'] = from_date\n
\n
result = []\n result = []\n
journal_total_debit = 0\n journal_total_debit = 0\n
journal_total_credit = 0\n journal_total_credit = 0\n
\n \n
zGetList = context.AccountingTransactionModule_zGetAccountingTransactionList\n # this report can be used in two ways:\n
transaction_list = zGetList( selection_params = params\n # * with a report dialog to specify parameters\n
, selection = None\n if request.has_key(\'at_date\'):\n
, **params\n at_date = request[\'at_date\']\n
)\n section_category = request[\'transaction_section_category\']\n
transaction_simulation_state = request[\'transaction_simulation_state\']\n
transaction_portal_type = request[\'transaction_portal_type\']\n
from_date = request.get(\'from_date\', None)\n
params = { \'sort_on\' : \'delivery.start_date\',\n
\'at_date\' : at_date,\n
\'simulation_state\': transaction_simulation_state,\n
\'section_category\': section_category,\n
\'portal_type\' : transaction_portal_type, }\n
\n
if from_date:\n
params[\'from_date\'] = from_date\n
\n
zGetList = context.AccountingTransactionModule_zGetAccountingTransactionList\n
transaction_list = zGetList( selection_params = params\n
, selection = None\n
, **params\n
)\n
else:\n
stool = context.getPortalObject().portal_selections\n
transaction_list = [x.getObject() for x in \n
stool.callSelectionFor(selection_name)]\n
section_category = stool.getSelectionParamsFor(selection_name\n
).get(\'section_category\', \'unset\')\n
\n \n
for transaction in transaction_list:\n for transaction in transaction_list:\n
transaction = transaction.getObject()\n transaction = transaction.getObject()\n
destination_section = transaction.getDestinationSectionValue()\n destination_section = transaction.getDestinationSectionValue()\n
source_section = transaction.getSourceSectionValue()\n source_section = transaction.getSourceSectionValue()\n
\n \n
# add a test on portal type to bypass bad acquisition of group category from person to Orignisation\n # add a test on portal type to bypass bad acquisition of group category from\n
# This help us filter employee of the source_section: because of acquisition via subordination they are seen as part of the group but in this accounting context group define a business unit composed of organisation\n # person to Orignisation This help us filter employee of the source_section:\n
we_are_destination = (destination_section is not None) and (\'group/%s\' %\n # because of acquisition via subordination they are seen as part of the group\n
destination_section.getGroup(\'\')).startswith(transaction_section_category) and destination_section.getPortalType() == "Organisation"\n # but in this accounting context group define a business unit composed of\n
we_are_source = (source_section is not None) and (\'group/%s\' %\n # organisation\n
source_section.getGroup(\'\')).startswith(transaction_section_category) and source_section.getPortalType() == "Organisation"\n we_are_destination = (destination_section is not None) and \\\n
(\'group/%s\' % destination_section.getGroup(\'\')\n
).startswith(section_category) and \\\n
destination_section.getPortalType() == "Organisation"\n
we_are_source = (source_section is not None) and \\\n
(\'group/%s\' % source_section.getGroup(\'\')\n
).startswith(section_category) and \\\n
source_section.getPortalType() == "Organisation"\n
\n \n
if we_are_source:\n if we_are_source:\n
specific_reference = transaction.getSourceReference()\n specific_reference = transaction.getSourceReference()\n
...@@ -136,18 +150,17 @@ for transaction in transaction_list:\n ...@@ -136,18 +150,17 @@ for transaction in transaction_list:\n
\n \n
lines = []\n lines = []\n
transaction_dict = { \\\n transaction_dict = { \\\n
\'date\' : context.Base_FormatDate( date )\n \'date\' : context.Base_FormatDate( date ),\n
, \'lines\' : lines\n \'lines\' : lines,\n
, \'description\': N_( "${transaction_title} (Transaction Reference " +\n \'description\': N_( "${transaction_title} (Transaction Reference " +\n
"= ${transaction_reference},\\n Creation Date = " +\n "= ${transaction_reference},\\n Creation Date = " +\n
"${creation_date} \\n Currency = ${currency_title})"\n "${creation_date} \\n Currency = ${currency_title})"\n
, mapping = { "transaction_title": unicode(transaction.getTitle() or \'\', \'utf8\')\n , mapping = {\n
, "transaction_reference": unicode(specific_reference or \'\', \'utf8\')\n "transaction_title": unicode(transaction.getTitle() or \'\', \'utf8\'),\n
, "creation_date": context.Base_FormatDate(transaction.getCreationDate())\n "transaction_reference": unicode(specific_reference or \'\', \'utf8\'),\n
, "currency_title": transaction.getResourceTitle() or \'\'\n "creation_date": context.Base_FormatDate(\n
}\n transaction.getCreationDate()),\n
)\n "currency_title": transaction.getResourceTitle() or \'\' })}\n
}\n
\n \n
result.append(transaction_dict)\n result.append(transaction_dict)\n
transaction_lines = transaction.contentValues(\n transaction_lines = transaction.contentValues(\n
...@@ -175,7 +188,8 @@ for transaction in transaction_list:\n ...@@ -175,7 +188,8 @@ for transaction in transaction_list:\n
account_description = "%s (%s)" % ( line.getSourceTitle()\n account_description = "%s (%s)" % ( line.getSourceTitle()\n
, line.getSourcePaymentTitle()\n , line.getSourcePaymentTitle()\n
)\n )\n
elif account.getAccountType() in (\'asset/receivable\', \'liability/payable\'):\n elif account.getAccountType() in (\'asset/receivable\',\n
\'liability/payable\'):\n
account_description = "%s (%s)" % ( line.getSourceTitle()\n account_description = "%s (%s)" % ( line.getSourceTitle()\n
, line.getDestinationSectionTitle()\n , line.getDestinationSectionTitle()\n
)\n )\n
...@@ -201,7 +215,8 @@ for transaction in transaction_list:\n ...@@ -201,7 +215,8 @@ for transaction in transaction_list:\n
account_description = "%s (%s)" % ( line.getDestinationTitle()\n account_description = "%s (%s)" % ( line.getDestinationTitle()\n
, line.getDestinationPaymentTitle()\n , line.getDestinationPaymentTitle()\n
)\n )\n
elif account.getAccountType() in (\'asset/receivable\' ,\'liability/payable\'):\n elif account.getAccountType() in (\'asset/receivable\',\n
\'liability/payable\'):\n
account_description = "%s (%s)" % ( line.getDestinationTitle()\n account_description = "%s (%s)" % ( line.getDestinationTitle()\n
, line.getSourceSectionTitle()\n , line.getSourceSectionTitle()\n
)\n )\n
...@@ -274,23 +289,28 @@ return result + [{ "journal_total_debit" : journal_total_debit\n ...@@ -274,23 +289,28 @@ return result + [{ "journal_total_debit" : journal_total_debit\n
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>request</string>
<string>selection_name</string>
<string>N_</string>
<string>result</string>
<string>journal_total_debit</string>
<string>journal_total_credit</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>at_date</string> <string>at_date</string>
<string>transaction_section_category</string> <string>section_category</string>
<string>transaction_simulation_state</string> <string>transaction_simulation_state</string>
<string>transaction_portal_type</string> <string>transaction_portal_type</string>
<string>None</string> <string>None</string>
<string>from_date</string> <string>from_date</string>
<string>N_</string>
<string>params</string> <string>params</string>
<string>_write_</string> <string>_write_</string>
<string>result</string>
<string>journal_total_debit</string>
<string>journal_total_credit</string>
<string>zGetList</string> <string>zGetList</string>
<string>_apply_</string> <string>_apply_</string>
<string>transaction_list</string> <string>transaction_list</string>
<string>stool</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>x</string>
<string>transaction</string> <string>transaction</string>
<string>destination_section</string> <string>destination_section</string>
<string>source_section</string> <string>source_section</string>
......
...@@ -70,7 +70,9 @@ ...@@ -70,7 +70,9 @@
</action>\n </action>\n
<spacer height="50"/>\n <spacer height="50"/>\n
\n \n
<table splitbyrow="1" repeatrows="0" repeatcols="0" style="AttributesTable" >\n <table splitbyrow="1" repeatrows="0"\n
repeatcols="0" style="AttributesTable"\n
tal:condition="request/from_date | nothing">\n
<tr tal:condition="python: request.get(\'from_date\', 0)">\n <tr tal:condition="python: request.get(\'from_date\', 0)">\n
<td colwidth="5cm"> <para style="TableHeader" tal:content="python: here.Base_translateString(\'From Date\')"/> </td>\n <td colwidth="5cm"> <para style="TableHeader" tal:content="python: here.Base_translateString(\'From Date\')"/> </td>\n
<td colwidth="15cm"> <para style="TableStandardRightAligned" tal:content="python: here.Base_FormatDate(request.get(\'from_date\'))"/></td> </tr>\n <td colwidth="15cm"> <para style="TableStandardRightAligned" tal:content="python: here.Base_FormatDate(request.get(\'from_date\'))"/></td> </tr>\n
......
71 72
\ No newline at end of file \ No newline at end of file
...@@ -37,15 +37,14 @@ Accounting Transaction Module | create_closing_transaction ...@@ -37,15 +37,14 @@ Accounting Transaction Module | create_closing_transaction
Accounting Transaction Module | create_related_payments Accounting Transaction Module | create_related_payments
Accounting Transaction Module | csv_export Accounting Transaction Module | csv_export
Accounting Transaction Module | general_ledger_report Accounting Transaction Module | general_ledger_report
Accounting Transaction Module | journal_from_selection
Accounting Transaction Module | journal_report Accounting Transaction Module | journal_report
Accounting Transaction Module | jump_active_accounting_pref Accounting Transaction Module | jump_active_accounting_pref
Accounting Transaction Module | jump_bank_accounts Accounting Transaction Module | jump_bank_accounts
Accounting Transaction Module | list_ui Accounting Transaction Module | list_ui
Accounting Transaction Module | plan_transactions Accounting Transaction Module | plan_transactions
Accounting Transaction Module | print Accounting Transaction Module | print
Accounting Transaction Module | report
Accounting Transaction Module | search Accounting Transaction Module | search
Accounting Transaction Module | social_report
Accounting Transaction Module | sort_on Accounting Transaction Module | sort_on
Accounting Transaction Module | third_parties_report Accounting Transaction Module | third_parties_report
Accounting Transaction Module | trial_balance_report Accounting Transaction Module | trial_balance_report
......
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