diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_categories/ledger/test_accounting.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_categories/ledger/test_accounting.xml new file mode 100644 index 0000000000000000000000000000000000000000..ea488a76359690b8ecc876c0ae939240c8c51b9f --- /dev/null +++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_categories/ledger/test_accounting.xml @@ -0,0 +1,78 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Category" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>ledger/test_accounting</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>test_accounting</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Category</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Test Accounting</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Length" module="BTrees.Length"/> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_categories/ledger/test_accounting/test_ledger_1.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_categories/ledger/test_accounting/test_ledger_1.xml new file mode 100644 index 0000000000000000000000000000000000000000..77bbf52690f1226dfe524519ecc9cd4e6b5dd517 --- /dev/null +++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_categories/ledger/test_accounting/test_ledger_1.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Category" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>ledger/test_accounting/test_ledger_1</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>test_ledger_1</string> </value> + </item> + <item> + <key> <string>int_index</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Category</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Test Ledger 1</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_categories/ledger/test_accounting/test_ledger_2.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_categories/ledger/test_accounting/test_ledger_2.xml new file mode 100644 index 0000000000000000000000000000000000000000..d66093f0376f375bf6f73336061a38d999da1b55 --- /dev/null +++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_categories/ledger/test_accounting/test_ledger_2.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Category" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>ledger/test_accounting/test_ledger_2</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>test_ledger_2</string> </value> + </item> + <item> + <key> <string>int_index</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Category</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Test Ledger 2</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.py b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.py index f950a2df4c4e487fab7648c88f0291af8defca4c..e50e718c67bb96bb7b5c65b0e6527c5be43b2d65 100644 --- a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.py +++ b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.py @@ -14,9 +14,9 @@ business_process = portal.portal_catalog.getResultValue( portal_type='Business Process').getRelativeUrl() # if the previous test didn't change input data, no need to recreate content -current_script_data_id = '%s_month_count_%s_draft_%s_state_%s_payment_%s' % ( +current_script_data_id = '%s_month_count_%s_draft_%s_state_%s_payment_%s_leger_%s' % ( month_count, add_draft_transactions, transaction_state, - add_related_payments, script.getId()) + add_related_payments, set_ledger, script.getId()) if accounting_module.getProperty('current_content_script', '') == current_script_data_id: @@ -34,6 +34,18 @@ if 1: raise ValueError("Do not run this on production !!!") module.manage_delObjects(list(module.objectIds())) +# if `set_ledger`is true, allow all test ledgers in accounting types. +for accounting_type_id in portal.getPortalAccountingTransactionTypeList(): + accounting_type = portal.portal_types[accounting_type_id] + accounting_type.edit( + ledger_value_list=list(portal.portal_categories.ledger.test_accounting.contentValues()) + if set_ledger else ()) + +test_ledger_1 = test_ledger_2 = None +if set_ledger: + test_ledger_1 = portal.portal_categories.ledger.test_accounting.test_ledger_1 + test_ledger_2 = portal.portal_categories.ledger.test_accounting.test_ledger_2 + def getAccountByTitle(title): account_list = [x.getObject().getRelativeUrl() for x in portal.portal_catalog(portal_type='Account', @@ -97,6 +109,7 @@ for month in range(1, month_count + 1): portal_type='Accounting Transaction', source_section=section, created_by_builder=1, + ledger_value=test_ledger_1, start_date=default_date, stop_date=default_date, resource=euro_resource, @@ -122,7 +135,7 @@ for month in range(1, month_count + 1): else: # other cases not supported for now assert transaction_state == 'draft' - + vat_rate = .1 for client_title, amount in (('Client 1', 2000), ('Client 2', 3000)): @@ -135,6 +148,7 @@ for month in range(1, month_count + 1): source=section, destination=getOrganisationByTitle(client_title), created_by_builder=1, + ledger_value=test_ledger_1, start_date=default_date, stop_date=default_date, specialise=business_process, @@ -174,6 +188,7 @@ for month in range(1, month_count + 1): source_section=section, destination_section=getOrganisationByTitle(client_title), created_by_builder=1, + ledger_value=test_ledger_1, start_date=default_date + .1, # make sure this will be after the invoice stop_date=default_date + .1, resource=euro_resource, @@ -213,6 +228,7 @@ for month in range(1, month_count + 1): destination_section=section, source_section=getOrganisationByTitle('Supplier'), created_by_builder=1, + ledger_value=test_ledger_1, start_date=default_date-5, # In purchase invoice transaction, stop_date is accounting operation date. stop_date=default_date, specialise=business_process, @@ -248,6 +264,7 @@ if add_draft_transactions: source_section=section, destination_section=getOrganisationByTitle(client_title), created_by_builder=1, + ledger_value=test_ledger_1, start_date=default_date, stop_date=default_date, resource=euro_resource, diff --git a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml index f7ffd40b53a36fe9cb941894387010faea24013d..d801dedd79b3855f7c3d482841d56e31a86988fe 100644 --- a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml +++ b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml @@ -50,7 +50,7 @@ </item> <item> <key> <string>_params</string> </key> - <value> <string>month_count=1, add_draft_transactions=1, transaction_state=\'validated\', add_related_payments=0, keep_grouping_reference=0</string> </value> + <value> <string>month_count=1, add_draft_transactions=1, transaction_state=\'validated\', add_related_payments=0, keep_grouping_reference=0, set_ledger=0</string> </value> </item> <item> <key> <string>id</string> </key> diff --git a/bt5/erp5_accounting_ui_test/bt/template_path_list b/bt5/erp5_accounting_ui_test/bt/template_path_list index 3bc60b6295dc49b79882f9136d245b4c81c20a50..e22449a732411899913be9d5a6867f9063e0a9a6 100644 --- a/bt5/erp5_accounting_ui_test/bt/template_path_list +++ b/bt5/erp5_accounting_ui_test/bt/template_path_list @@ -33,6 +33,8 @@ portal_categories/group/demo_group portal_categories/group/demo_group/** portal_categories/group/vendor portal_categories/group/vendor/** +portal_categories/ledger/test_accounting +portal_categories/ledger/test_accounting/** portal_categories/payment_mode/cash portal_categories/payment_mode/check portal_categories/role/client