Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
139
Merge Requests
139
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
9671e36a
Commit
9671e36a
authored
Jul 13, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into zope4py2
parents
43060af5
0d8242de
Pipeline
#22678
failed with stage
in 0 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
433 additions
and
166 deletions
+433
-166
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getTransactionLineListForGroupingReference.py
...ctionModule_getTransactionLineListForGroupingReference.py
+15
-7
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getTransactionLineListForGroupingReference.xml
...tionModule_getTransactionLineListForGroupingReference.xml
+1
-1
bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/test_grouping_reference/test_group_multi_pages_section_selection.html.xml
...ference/test_group_multi_pages_section_selection.html.xml
+58
-0
bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/test_grouping_reference/test_group_multi_pages_section_selection.html.zpt
...ference/test_group_multi_pages_section_selection.html.zpt
+197
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingTransactionModule_createAccountingTransactionList.py
...ntingTransactionModule_createAccountingTransactionList.py
+161
-157
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingTransactionModule_createAccountingTransactionList.xml
...tingTransactionModule_createAccountingTransactionList.xml
+1
-1
No files found.
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getTransactionLineListForGroupingReference.py
View file @
9671e36a
...
@@ -4,7 +4,7 @@ request = container.REQUEST
...
@@ -4,7 +4,7 @@ request = container.REQUEST
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
# we use a different selection for dialog params, because we never want this
# we use a different selection for dialog params, because we never want this
# selection to be reset
eted
# selection to be reset
dialog_selection_params
=
portal
.
portal_selections
.
getSelectionParamsFor
(
dialog_selection_params
=
portal
.
portal_selections
.
getSelectionParamsFor
(
'grouping_reference_fast_input_selection'
)
'grouping_reference_fast_input_selection'
)
...
@@ -26,12 +26,20 @@ for column in portal.portal_selections.getSelectionSortOrder(
...
@@ -26,12 +26,20 @@ for column in portal.portal_selections.getSelectionSortOrder(
continue
continue
sort_on
.
append
((
column_id
,
column
[
1
]))
sort_on
.
append
((
column_id
,
column
[
1
]))
section_category
=
request
.
get
(
# XXX ERP5JS does call list method with selection parameters, so we have to read in request.
'section_category'
,
section_category
=
section_category
\
portal
.
portal_preferences
.
getPreferredAccountingTransactionSectionCategory
())
or
request
.
get
(
'section_category'
)
\
section_category_strict
=
request
.
get
(
or
dialog_selection_params
.
get
(
'section_category'
)
\
'section_category_strict'
,
or
portal
.
portal_preferences
.
getPreferredAccountingTransactionSectionCategory
()
portal
.
portal_preferences
.
getPreferredAccountingSectionCategoryStrict
())
for
candidate
in
(
section_category_strict
,
request
.
get
(
'section_category_strict'
),
dialog_selection_params
.
get
(
'section_category_strict'
),
portal
.
portal_preferences
.
getPreferredAccountingSectionCategoryStrict
(),
):
if
candidate
is
not
None
:
section_category_strict
=
candidate
break
section_uid
=
portal
.
Base_getSectionUidListForSectionCategory
(
section_uid
=
portal
.
Base_getSectionUidListForSectionCategory
(
section_category
,
section_category_strict
)
section_category
,
section_category_strict
)
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getTransactionLineListForGroupingReference.xml
View file @
9671e36a
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
selection=None, grouping=\'grouping\', node=\'\', mirror_section=\'\', ledger=\'\', title=None, delivery_reference=None, debit_price=None, credit_price=None, date=None, **kw
</string>
</value>
<value>
<string>
selection=None, grouping=\'grouping\', node=\'\', mirror_section=\'\', ledger=\'\', title=None, delivery_reference=None, debit_price=None, credit_price=None, date=None,
section_category=\'\', section_category_strict=None,
**kw
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/test_grouping_reference/test_group_multi_pages_section_selection.html.xml
0 → 100644
View file @
9671e36a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<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>
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_group_multi_pages_section_selection.html
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/test_grouping_reference/test_group_multi_pages_section_selection.html.zpt
0 → 100644
View file @
9671e36a
<html>
<head><title>
Grouping with multiple pages and section selection
</title></head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"4"
>
Grouping with multiple pages and section selection
</td></tr>
</thead><tbody
tal:define=
"init_method string:AccountingTransactionModule_createAccountingTransactionList?add_draft_transactions:int=0&month_count:int=6&add_related_payments:int=1&both_sections:int=1"
>
<!-- Setup {{{ -->
<tal:block
metal:use-macro=
"here/ERP5Site_viewAccountingZuiteCommonTemplate/macros/init"
/>
<tr>
<td>
selectAndWait
</td>
<td>
select_module
</td>
<td>
Organisations
</td>
</tr>
<tr>
<td>
clickAndWait
</td>
<td>
Folder_show:method
</td>
<td></td>
</tr>
<tr>
<td>
type
</td>
<!-- title -->
<td>
//tr[@class='listbox-search-line']/th[2]/input
</td>
<td>
Client 1
</td>
</tr>
<tr>
<td>
clickAndWait
</td>
<td>
//input[@class="listbox-select-action"]
</td>
<td></td>
</tr>
<!-- }}} -->
<!-- {{{ Select Client 1 Organisation and use grouping fast input -->
<tr>
<td>
clickAndWait
</td>
<td>
link=Client 1
</td>
<td></td>
</tr>
<tr>
<td>
clickAndWait
</td>
<td>
//img[@alt='Grouping Reference Fast Input']
</td>
<td></td>
</tr>
<!-- The mode should be 'grouping' by default -->
<tr>
<td>
verifyValue
</td>
<td>
//input[@name='field_your_grouping' and @value='grouping']
</td>
<td>
on
</td>
</tr>
<tr>
<td>
verifyText
</td>
<td>
//label[contains(text(),"Total Selected Amount")]/../div[1]/
</td>
<td>
0.00
</td>
</tr>
<tr>
<td>
verifySelectedLabel
</td>
<td>
field_your_node
</td>
<td></td>
</tr>
<tr>
<td>
select
</td>
<td>
field_your_node
</td>
<td>
label=41 - Receivable
</td>
</tr>
<tr>
<td>
verifySelectedLabel
</td>
<td>
field_your_section_category
</td>
<td>
Demo Group
</td>
</tr>
<tr>
<td>
clickAndWait
</td>
<td>
//button[@id="dialog_update_button"]
</td>
<td></td>
</tr>
<tr>
<td>
assertPortalStatusMessage
</td>
<td>
Updated
</td>
<td></td>
</tr>
<tr>
<td>
assertText
</td>
<td>
//span[@class="listbox-current-page-total-number"]
</td>
<td>
24 records
</td>
</tr>
<tr>
<td>
select
</td>
<td>
field_your_section_category
</td>
<td>
Demo Group
</td>
</tr>
<tr>
<td>
click
</td>
<td>
field_your_section_category_strict
</td>
<td></td>
</tr>
<tr>
<td>
clickAndWait
</td>
<td>
//button[@id="dialog_update_button"]
</td>
<td></td>
</tr>
<tr>
<td>
assertPortalStatusMessage
</td>
<td>
Updated
</td>
<td></td>
</tr>
<tr>
<td>
assertText
</td>
<td>
//span[@class="listbox-current-page-total-number"]
</td>
<td>
12 records
</td>
</tr>
<tr>
<td>
clickAndWait
</td>
<td>
//button[@class='listbox_next_page']
</td>
<td></td>
</tr>
<tr>
<td>
verifyText
</td>
<td>
//span[@class='listbox-current-page-total-number']
</td>
<td>
12 records
</td>
</tr>
<tr>
<td>
clickAndWait
</td>
<td>
//button[@class='listbox_previous_page']
</td>
<td></td>
</tr>
<tr>
<td>
verifyText
</td>
<td>
//span[@class='listbox-current-page-total-number']
</td>
<td>
12 records
</td>
</tr>
<tr>
<td>
assertChecked
</td>
<td>
field_your_section_category_strict
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
field_your_section_category_strict
</td>
<td></td>
</tr>
<tr>
<td>
clickAndWait
</td>
<td>
//button[@id="dialog_update_button"]
</td>
<td></td>
</tr>
<tr>
<td>
assertPortalStatusMessage
</td>
<td>
Updated
</td>
<td></td>
</tr>
<tr>
<td>
assertText
</td>
<td>
//span[@class="listbox-current-page-total-number"]
</td>
<td>
24 records
</td>
</tr>
<tr>
<td>
select
</td>
<td>
field_your_section_category
</td>
<td>
Demo Group/Subsidiairy #1
</td>
</tr>
<tr>
<td>
clickAndWait
</td>
<td>
//button[@id="dialog_update_button"]
</td>
<td></td>
</tr>
<tr>
<td>
assertPortalStatusMessage
</td>
<td>
Updated
</td>
<td></td>
</tr>
<tr>
<td>
assertText
</td>
<td>
//span[@class="listbox-current-page-total-number"]
</td>
<td>
12 records
</td>
</tr>
<tr>
<td>
clickAndWait
</td>
<td>
//button[@class='listbox_next_page']
</td>
<td></td>
</tr>
<tr>
<td>
verifyText
</td>
<td>
//span[@class='listbox-current-page-total-number']
</td>
<td>
12 records
</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingTransactionModule_createAccountingTransactionList.py
View file @
9671e36a
...
@@ -2,7 +2,6 @@ from DateTime import DateTime
...
@@ -2,7 +2,6 @@ from DateTime import DateTime
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
# params
# params
section_title
=
'My Organisation'
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
accounting_module
=
portal
.
accounting_module
accounting_module
=
portal
.
accounting_module
year
=
2005
year
=
2005
...
@@ -14,9 +13,9 @@ business_process = portal.portal_catalog.getResultValue(
...
@@ -14,9 +13,9 @@ business_process = portal.portal_catalog.getResultValue(
portal_type
=
'Business Process'
).
getRelativeUrl
()
portal_type
=
'Business Process'
).
getRelativeUrl
()
# if the previous test didn't change input data, no need to recreate content
# 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_leger_%s'
%
(
current_script_data_id
=
'%s_month_count_%s_draft_%s_state_%s_payment_%s_leger_%s
_both_sections_%s
'
%
(
month_count
,
add_draft_transactions
,
transaction_state
,
month_count
,
add_draft_transactions
,
transaction_state
,
add_related_payments
,
set_ledger
,
script
.
getId
())
add_related_payments
,
set_ledger
,
both_sections
,
script
.
getId
())
if
accounting_module
.
getProperty
(
'current_content_script'
,
if
accounting_module
.
getProperty
(
'current_content_script'
,
''
)
==
current_script_data_id
:
''
)
==
current_script_data_id
:
...
@@ -60,7 +59,10 @@ def getOrganisationByTitle(title):
...
@@ -60,7 +59,10 @@ def getOrganisationByTitle(title):
assert
len
(
document_list
)
==
1
,
\
assert
len
(
document_list
)
==
1
,
\
'%d organisation with title "%s"'
%
(
len
(
document_list
),
title
)
'%d organisation with title "%s"'
%
(
len
(
document_list
),
title
)
return
document_list
[
0
]
return
document_list
[
0
]
section
=
getOrganisationByTitle
(
section_title
)
section_list
=
[
getOrganisationByTitle
(
'My Organisation'
)]
if
both_sections
:
section_list
.
append
(
getOrganisationByTitle
(
'My Master Organisation'
))
euro_resource
=
'currency_module/euro'
euro_resource
=
'currency_module/euro'
...
@@ -75,93 +77,50 @@ else:
...
@@ -75,93 +77,50 @@ else:
title
=
'Dummy Product for testing'
)
title
=
'Dummy Product for testing'
)
for
_
in
range
(
random
.
randint
(
5
,
10
)):
for
_
in
range
(
random
.
randint
(
5
,
10
)):
pl
=
portal
.
sale_packing_list_module
.
newContent
(
for
section
in
section_list
:
portal_type
=
'Sale Packing List'
,
pl
=
portal
.
sale_packing_list_module
.
newContent
(
title
=
'Dummy Packing List for testing'
,
portal_type
=
'Sale Packing List'
,
source_section
=
section
,
title
=
'Dummy Packing List for testing'
,
source
=
section
,
source_section
=
section
,
destination_section
=
getOrganisationByTitle
(
'Client 1'
),
source
=
section
,
destination
=
getOrganisationByTitle
(
'Client 1'
),
destination_section
=
getOrganisationByTitle
(
'Client 1'
),
specialise
=
business_process
,
destination
=
getOrganisationByTitle
(
'Client 1'
),
start_date
=
default_date
,
)
specialise
=
business_process
,
line
=
pl
.
newContent
(
portal_type
=
'Sale Packing List Line'
,
start_date
=
default_date
,
)
resource_value
=
product
,
line
=
pl
.
newContent
(
portal_type
=
'Sale Packing List Line'
,
quantity
=
random
.
randint
(
300
,
500
),
resource_value
=
product
,
price
=
random
.
randint
(
300
,
500
))
quantity
=
random
.
randint
(
300
,
500
),
price
=
random
.
randint
(
300
,
500
))
# TODO: add an external method to modify workflow state of an object
# TODO: add an external method to modify workflow state of an object
#context.portal_tests.setSimulationStateFor(pl, 'stopped')
#context.portal_tests.setSimulationStateFor(pl, 'stopped')
#assert pl.getSimulationState() == 'stopped'
#assert pl.getSimulationState() == 'stopped'
#pl.recursiveReindexObject()
#pl.recursiveReindexObject()
for
month
in
range
(
1
,
month_count
+
1
):
for
section
in
section_list
:
default_date
=
DateTime
(
year
,
month
,
1
)
for
month
in
range
(
1
,
month_count
+
1
):
tr
=
accounting_module
.
newContent
(
default_date
=
DateTime
(
year
,
month
,
1
)
title
=
'Accounts opening'
,
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
,
)
tr
.
newContent
(
portal_type
=
'Accounting Transaction Line'
,
source
=
getAccountByTitle
(
'Equity'
),
quantity
=
20000
)
tr
.
newContent
(
portal_type
=
'Accounting Transaction Line'
,
source
=
getAccountByTitle
(
'Fixed Assets'
),
quantity
=-
15000
)
tr
.
newContent
(
portal_type
=
'Accounting Transaction Line'
,
source
=
getAccountByTitle
(
'Stocks'
),
quantity
=-
5000
)
# TODO: "validated" should be renamed to "stopped"
if
transaction_state
==
'validated'
:
tr
.
stop
()
assert
tr
.
getSimulationState
()
==
'stopped'
elif
transaction_state
==
'delivered'
:
tr
.
stop
()
tr
.
deliver
()
assert
tr
.
getSimulationState
()
==
'delivered'
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
)):
default_date
+=
1
tr
=
accounting_module
.
newContent
(
tr
=
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction
'
,
title
=
'Accounts opening
'
,
title
=
'%s Sale Invoice'
%
client_title
,
portal_type
=
'Accounting Transaction'
,
source_section
=
section
,
source_section
=
section
,
destination_section
=
getOrganisationByTitle
(
client_title
),
source
=
section
,
destination
=
getOrganisationByTitle
(
client_title
),
created_by_builder
=
1
,
created_by_builder
=
1
,
ledger_value
=
test_ledger_1
,
ledger_value
=
test_ledger_1
,
start_date
=
default_date
,
start_date
=
default_date
,
stop_date
=
default_date
,
stop_date
=
default_date
,
specialise
=
business_process
,
resource
=
euro_resource
,
resource
=
euro_resource
,
)
)
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
source
=
getAccountByTitle
(
'Receivable'
),
tr
.
newContent
(
portal_type
=
'Accounting Transaction Line'
,
quantity
=-
(
amount
*
(
1
+
vat_rate
)))
source
=
getAccountByTitle
(
'Equity'
),
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
quantity
=
20000
)
source
=
getAccountByTitle
(
'Collected VAT 10%'
),
tr
.
newContent
(
portal_type
=
'Accounting Transaction Line'
,
quantity
=
amount
*
vat_rate
)
source
=
getAccountByTitle
(
'Fixed Assets'
),
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
quantity
=-
15000
)
source
=
getAccountByTitle
(
'Goods Sales'
),
tr
.
newContent
(
portal_type
=
'Accounting Transaction Line'
,
quantity
=
amount
)
source
=
getAccountByTitle
(
'Stocks'
),
# add a random invoice line, which should not impact our tests
quantity
=-
5000
)
tr
.
newContent
(
portal_type
=
'Invoice Line'
,
# TODO: "validated" should be renamed to "stopped"
source
=
section
,
destination
=
getOrganisationByTitle
(
client_title
),
resource_value
=
product
,
quantity
=
random
.
randint
(
300
,
400
),
price
=
random
.
randint
(
300
,
400
),
)
if
transaction_state
==
'validated'
:
if
transaction_state
==
'validated'
:
tr
.
stop
()
tr
.
stop
()
assert
tr
.
getSimulationState
()
==
'stopped'
assert
tr
.
getSimulationState
()
==
'stopped'
...
@@ -172,103 +131,148 @@ for month in range(1, month_count + 1):
...
@@ -172,103 +131,148 @@ for month in range(1, month_count + 1):
else
:
else
:
# other cases not supported for now
# other cases not supported for now
assert
transaction_state
==
'draft'
assert
transaction_state
==
'draft'
if
add_related_payments
:
payment
=
accounting_module
.
newContent
(
vat_rate
=
.
1
causality_value
=
tr
,
portal_type
=
'Payment Transaction'
,
for
client_title
,
amount
in
((
'Client 1'
,
2000
),
(
'Client 2'
,
3000
)):
title
=
'%s Payment'
%
client_title
,
default_date
+=
1
tr
=
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
,
title
=
'%s Sale Invoice'
%
client_title
,
source_section
=
section
,
source_section
=
section
,
destination_section
=
getOrganisationByTitle
(
client_title
),
destination_section
=
getOrganisationByTitle
(
client_title
),
source
=
section
,
destination
=
getOrganisationByTitle
(
client_title
),
created_by_builder
=
1
,
created_by_builder
=
1
,
ledger_value
=
test_ledger_1
,
ledger_value
=
test_ledger_1
,
start_date
=
default_date
+
.
1
,
# make sure this will be after the invoice
start_date
=
default_date
,
stop_date
=
default_date
+
.
1
,
stop_date
=
default_date
,
specialise
=
business_process
,
resource
=
euro_resource
,
resource
=
euro_resource
,
)
)
payment
.
newContent
(
portal_type
=
'Accounting Transaction Line'
,
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
source
=
getAccountByTitle
(
'Bank'
),
quantity
=-
(
amount
*
(
1
+
vat_rate
)))
payment
.
newContent
(
portal_type
=
'Accounting Transaction Line'
,
source
=
getAccountByTitle
(
'Receivable'
),
source
=
getAccountByTitle
(
'Receivable'
),
quantity
=
(
amount
*
(
1
+
vat_rate
)))
quantity
=-
(
amount
*
(
1
+
vat_rate
)))
if
transaction_state
in
(
'validated'
,
'delivered'
):
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
payment
.
stop
()
source
=
getAccountByTitle
(
'Collected VAT 10%'
),
assert
payment
.
getSimulationState
()
==
'stopped'
quantity
=
amount
*
vat_rate
)
if
transaction_state
==
'delivered'
:
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
tr
.
deliver
()
source
=
getAccountByTitle
(
'Goods Sales'
),
assert
tr
.
getSimulationState
()
==
'delivered'
quantity
=
amount
)
if
not
keep_grouping_reference
:
# add a random invoice line, which should not impact our tests
tag
=
script
.
id
+
'_payment_indexation_'
+
payment
.
getPath
()
tr
.
newContent
(
portal_type
=
'Invoice Line'
,
payment
.
recursiveReindexObject
(
activate_kw
=
{
'tag'
:
tag
})
source
=
section
,
for
line
in
payment
.
getMovementList
(
destination
=
getOrganisationByTitle
(
client_title
),
portal_type
=
payment
.
getPortalAccountingMovementTypeList
()):
resource_value
=
product
,
if
line
.
getGroupingReference
():
quantity
=
random
.
randint
(
300
,
400
),
line
.
activate
(
after_tag
=
tag
).
AccountingTransactionLine_resetGroupingReference
()
price
=
random
.
randint
(
300
,
400
),
)
if
transaction_state
==
'validated'
:
tr
.
stop
()
assert
tr
.
getSimulationState
()
==
'stopped'
elif
transaction_state
==
'delivered'
:
tr
.
stop
()
tr
.
deliver
()
assert
tr
.
getSimulationState
()
==
'delivered'
else
:
else
:
# other cases not supported for now
# other cases not supported for now
assert
transaction_state
==
'draft'
assert
transaction_state
==
'draft'
if
add_related_payments
:
payment
=
accounting_module
.
newContent
(
causality_value
=
tr
,
portal_type
=
'Payment Transaction'
,
title
=
'%s Payment'
%
client_title
,
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
,
)
payment
.
newContent
(
portal_type
=
'Accounting Transaction Line'
,
source
=
getAccountByTitle
(
'Bank'
),
quantity
=-
(
amount
*
(
1
+
vat_rate
)))
payment
.
newContent
(
portal_type
=
'Accounting Transaction Line'
,
source
=
getAccountByTitle
(
'Receivable'
),
quantity
=
(
amount
*
(
1
+
vat_rate
)))
if
transaction_state
in
(
'validated'
,
'delivered'
):
payment
.
stop
()
assert
payment
.
getSimulationState
()
==
'stopped'
if
transaction_state
==
'delivered'
:
tr
.
deliver
()
assert
tr
.
getSimulationState
()
==
'delivered'
if
not
keep_grouping_reference
:
tag
=
script
.
id
+
'_payment_indexation_'
+
payment
.
getPath
()
payment
.
recursiveReindexObject
(
activate_kw
=
{
'tag'
:
tag
})
for
line
in
payment
.
getMovementList
(
portal_type
=
payment
.
getPortalAccountingMovementTypeList
()):
if
line
.
getGroupingReference
():
line
.
activate
(
after_tag
=
tag
).
AccountingTransactionLine_resetGroupingReference
()
else
:
# other cases not supported for now
assert
transaction_state
==
'draft'
amount
=
7000
default_date
+=
1
amount
=
7000
tr
=
accounting_module
.
newContent
(
default_date
+=
1
portal_type
=
'Purchase Invoice Transaction'
,
title
=
'First Purchase Invoice'
,
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
,
resource
=
euro_resource
,
)
tr
.
newContent
(
portal_type
=
'Purchase Invoice Transaction Line'
,
destination
=
getAccountByTitle
(
'Payable'
),
quantity
=-
(
amount
*
(
1
+
vat_rate
)))
tr
.
newContent
(
portal_type
=
'Purchase Invoice Transaction Line'
,
destination
=
getAccountByTitle
(
'Refundable VAT 10%'
),
quantity
=
amount
*
vat_rate
)
tr
.
newContent
(
portal_type
=
'Purchase Invoice Transaction Line'
,
destination
=
getAccountByTitle
(
'Goods Purchase'
),
quantity
=
amount
)
if
transaction_state
==
'validated'
:
tr
.
stop
()
assert
tr
.
getSimulationState
()
==
'stopped'
elif
transaction_state
==
'delivered'
:
tr
.
stop
()
tr
.
deliver
()
assert
tr
.
getSimulationState
()
==
'delivered'
else
:
# other cases not supported for now
assert
transaction_state
==
'draft'
if
add_draft_transactions
:
# finally, add random accounting transcactions in draft state, which have no
# impact on the test
for
client_title
,
amount
in
((
'Client 1'
,
2000
),
(
'Client 2'
,
3000
)):
tr
=
accounting_module
.
newContent
(
tr
=
accounting_module
.
newContent
(
portal_type
=
'
Sal
e Invoice Transaction'
,
portal_type
=
'
Purchas
e Invoice Transaction'
,
title
=
'
%s Sale Invoice'
%
client_title
,
title
=
'
First Purchase Invoice'
,
source
_section
=
section
,
destination
_section
=
section
,
destination_section
=
getOrganisationByTitle
(
client_title
),
source_section
=
getOrganisationByTitle
(
'Supplier'
),
created_by_builder
=
1
,
created_by_builder
=
1
,
ledger_value
=
test_ledger_1
,
ledger_value
=
test_ledger_1
,
start_date
=
default_date
,
start_date
=
default_date
-
5
,
# In purchase invoice transaction, stop_date is accounting operation date.
stop_date
=
default_date
,
stop_date
=
default_date
,
resource
=
euro_resource
,
specialise
=
business_process
,
specialise
=
business_process
,
resource
=
euro_resource
,
)
)
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
tr
.
newContent
(
portal_type
=
'Purchase Invoice Transaction Line'
,
source
=
getAccountByTitle
(
'Receivable'
),
destination
=
getAccountByTitle
(
'Payable'
),
quantity
=
random
.
randint
(
300
,
400
),)
quantity
=-
(
amount
*
(
1
+
vat_rate
)))
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
tr
.
newContent
(
portal_type
=
'Purchase Invoice Transaction Line'
,
source
=
getAccountByTitle
(
'Collected VAT 10%'
),
destination
=
getAccountByTitle
(
'Refundable VAT 10%'
),
quantity
=
random
.
randint
(
300
,
400
),)
quantity
=
amount
*
vat_rate
)
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
tr
.
newContent
(
portal_type
=
'Purchase Invoice Transaction Line'
,
source
=
getAccountByTitle
(
'Goods Sales'
),
destination
=
getAccountByTitle
(
'Goods Purchase'
),
quantity
=
random
.
randint
(
300
,
400
),)
quantity
=
amount
)
if
transaction_state
==
'validated'
:
tr
.
stop
()
assert
tr
.
getSimulationState
()
==
'stopped'
elif
transaction_state
==
'delivered'
:
tr
.
stop
()
tr
.
deliver
()
assert
tr
.
getSimulationState
()
==
'delivered'
else
:
# other cases not supported for now
assert
transaction_state
==
'draft'
if
add_draft_transactions
:
# finally, add random accounting transcactions in draft state, which have no
# impact on the test
for
client_title
,
amount
in
((
'Client 1'
,
2000
),
(
'Client 2'
,
3000
)):
tr
=
accounting_module
.
newContent
(
portal_type
=
'Sale Invoice Transaction'
,
title
=
'%s Sale Invoice'
%
client_title
,
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
,
specialise
=
business_process
,
)
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
source
=
getAccountByTitle
(
'Receivable'
),
quantity
=
random
.
randint
(
300
,
400
),)
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
source
=
getAccountByTitle
(
'Collected VAT 10%'
),
quantity
=
random
.
randint
(
300
,
400
),)
tr
.
newContent
(
portal_type
=
'Sale Invoice Transaction Line'
,
source
=
getAccountByTitle
(
'Goods Sales'
),
quantity
=
random
.
randint
(
300
,
400
),)
accounting_module
.
setProperty
(
'current_content_script'
,
accounting_module
.
setProperty
(
'current_content_script'
,
current_script_data_id
)
current_script_data_id
)
...
...
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingTransactionModule_createAccountingTransactionList.xml
View file @
9671e36a
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<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, set_ledger=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
, both_sections=0
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment