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

extends AccountingZuite_createAccountingTransactionList to create transction in draft state

tests workflow validation from the module



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11168 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 96a6bb46
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PageTemplates.ZopePageTemplate</string>
<string>ZopePageTemplate</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<html>\n
<head><title>Test for Accounting module main listbox worklow actions</title></head>\n
<body>\n
<table cellpadding="1" cellspacing="1" border="1">\n
<thead>\n
<tr><td rowspan="1" colspan="4">\n
Accounting Transaction Module Workflow Actions\n
</td></tr>\n
</thead><tbody tal:define="init_method string:AccountingZuite_createAccountingTransactionList?add_draft_transactions:int=0&transaction_state=draft">\n
<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>\n
\n
<!-- setup {{{ -->\n
<tr>\n
<td>open</td>\n
<td>${base_url}/AccountingZuite_markChanged</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyTextPresent</td>\n
<td>Done.</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>open</td>\n
<td>${base_url}</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>selectAndWait</td>\n
<td>select_module</td>\n
<td>Accounting</td>\n
</tr>\n
<!-- }}} -->\n
\n
<!-- filter on title {{{ -->\n
<tr>\n
<td>clickAndWait</td>\n
<td>Folder_show:method</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>type</td>\n
<td>//tr[@id=\'listbox_search_line\']/td[2]/span/input</td>\n
<td>Client 1 Sale Invoice</td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>listbox_select</td>\n
<td></td>\n
</tr>\n
<!-- list is filtered with 1 item-->\n
<tr>\n
<td>verifyText</td>\n
<td>listbox_record_number</td>\n
<td>1 record(s)</td>\n
</tr>\n
<!-- }}} -->\n
\n
<!-- pass the \'validate\' transition the selected transaction {{{ -->\n
<tr>\n
<td>selectAndWait</td>\n
<td>select_action</td>\n
<td>label=Validate Transactions</td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>//input[@id=\'dialog_submit_button\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertPortalStatusMessage</td>\n
<td>Workflow modification in progress for 1 out of 1</td>\n
<td></td>\n
</tr>\n
<!-- }}} -->\n
\n
<!-- Display all and check {{{ -->\n
<tr>\n
<td>clickAndWait</td>\n
<td>Folder_show:method</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_0\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<!-- still Draft at this point, because we use activities. -->\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_1\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_2\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_3\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<tr>\n
<td>open</td>\n
<td>${base_url}/Zuite_waitForActivities</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Done.</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>open</td>\n
<td>${base_url}/accounting_module/view</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_0\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<!-- now it\'s Validated -->\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_1\']/td[8]</td>\n
<td>Validated</td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_2\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_3\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<!-- }}} -->\n
\n
<!-- next step, select by uid {{{ -->\n
<tr>\n
<td>clickAndWait</td>\n
<td>Folder_show:method</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//tr[@id=\'listbox_data_line_0\']/td[1]/input</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>click</td>\n
<td>//tr[@id=\'listbox_data_line_1\']/td[1]/input</td>\n
<td></td>\n
</tr>\n
<!-- }}} -->\n
\n
<!-- pass the \'validate\' transition the selected transaction {{{ -->\n
<tr>\n
<td>selectAndWait</td>\n
<td>select_action</td>\n
<td>label=Validate Transactions</td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>//input[@id=\'dialog_submit_button\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertPortalStatusMessage</td>\n
<td>Workflow modification in progress for 1 out of 2</td>\n
<td></td>\n
</tr>\n
<!-- }}} -->\n
\n
<!-- Display all and check {{{ -->\n
<tr>\n
<td>clickAndWait</td>\n
<td>Folder_show:method</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_0\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_1\']/td[8]</td>\n
<td>Validated</td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_2\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_3\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<tr>\n
<td>open</td>\n
<td>${base_url}/Zuite_waitForActivities</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Done.</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>open</td>\n
<td>${base_url}/accounting_module/view</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_0\']/td[8]</td>\n
<td>Validated</td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_1\']/td[8]</td>\n
<td>Validated</td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_2\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<tr>\n
<td>assertText</td>\n
<td>//tr[@id=\'listbox_data_line_3\']/td[8]</td>\n
<td>Draft</td>\n
</tr>\n
<!-- }}} -->\n
\n
</tbody></table>\n
</body>\n
</html> <!-- vim: syntax=html foldmethod=marker\n
-->\n
]]></string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_accounting_transaction_module_workflow_validation.html</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -181,9 +181,13 @@ for month in range(1, month_count + 1):\n ...@@ -181,9 +181,13 @@ for month in range(1, month_count + 1):\n
immediate_reindex=immediate_reindex,\n immediate_reindex=immediate_reindex,\n
source=getAccountByTitle(\'Stocks\'),\n source=getAccountByTitle(\'Stocks\'),\n
quantity=-5000)\n quantity=-5000)\n
if transaction_state == \'validated\':\n
tr.stop()\n tr.stop()\n
assert tr.getSimulationState() == \'stopped\'\n assert tr.getSimulationState() == \'stopped\'\n
\n else:\n
# other cases not supported for now\n
assert transaction_state == \'draft\'\n
\n
vat_rate = .1\n vat_rate = .1\n
\n \n
for client_title, amount in ((\'Client 1\', 2000), (\'Client 2\', 3000)):\n for client_title, amount in ((\'Client 1\', 2000), (\'Client 2\', 3000)):\n
...@@ -219,9 +223,12 @@ for month in range(1, month_count + 1):\n ...@@ -219,9 +223,12 @@ for month in range(1, month_count + 1):\n
resource_value=product,\n resource_value=product,\n
quantity=random.randint(300, 400),\n quantity=random.randint(300, 400),\n
price=random.randint(300, 400), )\n price=random.randint(300, 400), )\n
if transaction_state == \'validated\':\n
tr.stop()\n tr.stop()\n
assert tr.getSimulationState() == \'stopped\'\n assert tr.getSimulationState() == \'stopped\'\n
\n else:\n
# other cases not supported for now\n
assert transaction_state == \'draft\'\n
amount=7000\n amount=7000\n
default_date += 1\n default_date += 1\n
tr = accounting_module.newContent(\n tr = accounting_module.newContent(\n
...@@ -247,8 +254,12 @@ for month in range(1, month_count + 1):\n ...@@ -247,8 +254,12 @@ for month in range(1, month_count + 1):\n
immediate_reindex=immediate_reindex,\n immediate_reindex=immediate_reindex,\n
destination=getAccountByTitle(\'Goods Purchase\'),\n destination=getAccountByTitle(\'Goods Purchase\'),\n
quantity=amount)\n quantity=amount)\n
if transaction_state == \'validated\':\n
tr.stop()\n tr.stop()\n
assert tr.getSimulationState() == \'stopped\'\n assert tr.getSimulationState() == \'stopped\'\n
else:\n
# other cases not supported for now\n
assert transaction_state == \'draft\'\n
\n \n
if add_draft_transactions:\n if add_draft_transactions:\n
# finally, add random accounting transcactions in draft state, which have no\n # finally, add random accounting transcactions in draft state, which have no\n
...@@ -306,7 +317,7 @@ return "Accounting Transactions Created."\n ...@@ -306,7 +317,7 @@ return "Accounting Transactions Created."\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>month_count=1, add_draft_transactions=1</string> </value> <value> <string>month_count=1, add_draft_transactions=1, transaction_state=\'validated\'</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -326,7 +337,7 @@ return "Accounting Transactions Created."\n ...@@ -326,7 +337,7 @@ return "Accounting Transactions Created."\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>2</int> </value> <value> <int>3</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -334,6 +345,7 @@ return "Accounting Transactions Created."\n ...@@ -334,6 +345,7 @@ return "Accounting Transactions Created."\n
<tuple> <tuple>
<string>month_count</string> <string>month_count</string>
<string>add_draft_transactions</string> <string>add_draft_transactions</string>
<string>transaction_state</string>
<string>DateTime</string> <string>DateTime</string>
<string>section_title</string> <string>section_title</string>
<string>_getattr_</string> <string>_getattr_</string>
...@@ -384,6 +396,7 @@ return "Accounting Transactions Created."\n ...@@ -384,6 +396,7 @@ return "Accounting Transactions Created."\n
<tuple> <tuple>
<int>1</int> <int>1</int>
<int>1</int> <int>1</int>
<string>validated</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
29 31
\ No newline at end of file \ No newline at end of file
None
\ 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