Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
28c4777c
Commit
28c4777c
authored
Oct 31, 2017
by
Tomáš Peterka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[accounting_ui_test] Add necessary scripts for Report UI Testing
parent
cc0d8c88
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1247 additions
and
2 deletions
+1247
-2
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createDocument.py
...erp5_accounting_ui_test/AccountingZuite_createDocument.py
+25
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createDocument.xml
...rp5_accounting_ui_test/AccountingZuite_createDocument.xml
+66
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportAgedBalanceDataset.py
...ui_test/AccountingZuite_createReportAgedBalanceDataset.py
+120
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportAgedBalanceDataset.xml
...i_test/AccountingZuite_createReportAgedBalanceDataset.xml
+72
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportDataset.py
...accounting_ui_test/AccountingZuite_createReportDataset.py
+180
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportDataset.xml
...ccounting_ui_test/AccountingZuite_createReportDataset.xml
+62
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportJournalDataset.py
...ing_ui_test/AccountingZuite_createReportJournalDataset.py
+115
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportJournalDataset.xml
...ng_ui_test/AccountingZuite_createReportJournalDataset.xml
+62
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportOtherPartiesDataset.py
...i_test/AccountingZuite_createReportOtherPartiesDataset.py
+89
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportOtherPartiesDataset.xml
..._test/AccountingZuite_createReportOtherPartiesDataset.xml
+66
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_initializeAccountingTransactionReportTest.py
...ountingZuite_initializeAccountingTransactionReportTest.py
+33
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_initializeAccountingTransactionReportTest.xml
...untingZuite_initializeAccountingTransactionReportTest.xml
+66
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reportMacros.xml
.../erp5_accounting_ui_test/AccountingZuite_reportMacros.xml
+58
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reportMacros.zpt
.../erp5_accounting_ui_test/AccountingZuite_reportMacros.zpt
+229
-0
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_setAccountReferencePreference.py
..._ui_test/AccountingZuite_setAccountReferencePreference.py
+3
-1
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_setAccountReferencePreference.xml
...ui_test/AccountingZuite_setAccountReferencePreference.xml
+1
-1
No files found.
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createDocument.py
0 → 100644
View file @
28c4777c
"""Create document of `portal_type` inside `parent` or Accounting Module.
`embedded` is a list of documents to create inside the top-level document
`simulation_state` is known to be a workflow transition variable thus we correctly
use workflows to change the state
"""
portal
=
context
.
getPortalObject
()
parent
=
parent
or
portal
.
accounting_module
document
=
parent
.
newContent
(
portal_type
=
portal_type
,
**
kwargs
)
for
embed
in
embedded
:
script
(
parent
=
document
,
**
embed
)
if
simulation_state
==
'planned'
:
document
.
plan
()
elif
simulation_state
==
'validated'
:
document
.
validate
()
elif
simulation_state
==
'confirmed'
:
document
.
confirm
()
elif
simulation_state
in
(
'stopped'
,
'delivered'
):
document
.
stop
()
if
simulation_state
==
'delivered'
:
document
.
deliver
()
return
document
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createDocument.xml
0 → 100644
View file @
28c4777c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_params
</string>
</key>
<value>
<string>
portal_type, simulation_state=None, parent=None, embedded=(), **kwargs
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
AccountingZuite_createDocument
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportAgedBalanceDataset.py
0 → 100644
View file @
28c4777c
"""Create data set for aged balance:
$last_month: Purchase invoice 1 (500)
$last_month: Sale invoice 2 (300)
$next_month: Payment 1 (500)
$this_month + one_day: Payment 2 (300)
"""
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
account_module
=
portal
.
account_module
organisation_module
=
portal
.
organisation_module
now
=
DateTime
()
this_month
=
DateTime
(
now
.
year
(),
now
.
month
(),
1
)
last_month
=
this_month
-
1
next_month
=
this_month
+
32
later_this_month
=
this_month
+
8
def
get_object_by_title
(
portal_type
,
title
):
"""Use portal catalog to search&fetch the object."""
result
=
portal
.
portal_catalog
(
portal_type
=
portal_type
,
title
=
SimpleQuery
(
title
=
title
,
comparison_operator
=
'='
))
if
len
(
result
)
==
1
:
return
result
.
getObject
()
return
None
bank1
=
get_object_by_title
(
portal_type
=
'Bank Account'
,
title
=
'Bank1'
)
if
bank1
is
None
:
bank1
=
portal
.
AccountingZuite_createDocument
(
portal_type
=
'Bank Account'
,
title
=
'Bank1'
,
simulation_state
=
'validated'
,
parent
=
organisation_module
.
my_organisation
)
purchase1
=
portal
.
AccountingZuite_createDocument
(
portal_type
=
'Purchase Invoice Transaction'
,
title
=
'Purchase invoice 1'
,
destination_reference
=
'1'
,
source_reference
=
'no'
,
reference
=
'ref1'
,
simulation_state
=
'delivered'
,
ledger
=
''
,
source_section_value
=
organisation_module
.
supplier
,
start_date
=
last_month
,
embedded
=
(
dict
(
portal_type
=
'Purchase Invoice Transaction Line'
,
destination_value
=
account_module
.
goods_purchase
,
destination_debit
=
500.0
),
dict
(
portal_type
=
'Purchase Invoice Transaction Line'
,
destination_value
=
account_module
.
payable
,
destination_credit
=
500.0
)),
)
sale2
=
portal
.
AccountingZuite_createDocument
(
portal_type
=
'Sale Invoice Transaction'
,
title
=
'Sale invoice 2'
,
source_reference
=
'2'
,
destination_reference
=
'no'
,
reference
=
'ref2'
,
simulation_state
=
'delivered'
,
ledger
=
''
,
destination_section_value
=
organisation_module
.
client_1
,
start_date
=
last_month
,
embedded
=
(
dict
(
portal_type
=
'Sale Invoice Transaction Line'
,
source_value
=
account_module
.
goods_sales
,
source_credit
=
300.0
),
dict
(
portal_type
=
'Sale Invoice Transaction Line'
,
source_value
=
account_module
.
receivable
,
source_debit
=
300.0
)),
)
portal
.
Zuite_waitForActivities
()
payment3
=
portal
.
AccountingZuite_createDocument
(
portal_type
=
'Payment Transaction'
,
title
=
'Payment 1'
,
source_reference
=
'3'
,
destination_reference
=
'no'
,
simulation_state
=
'delivered'
,
ledger
=
''
,
causality_value
=
purchase1
,
payment_mode
=
'payment_mode'
,
destination_section_value
=
organisation_module
.
supplier
,
start_date
=
next_month
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
payable
,
source_debit
=
500.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
bank
,
source_credit
=
500.0
)),
)
payment4
=
portal
.
AccountingZuite_createDocument
(
portal_type
=
'Payment Transaction'
,
title
=
'Payment 2'
,
source_reference
=
'4'
,
destination_reference
=
'4'
,
simulation_state
=
'delivered'
,
causality_value
=
sale2
,
payment_mode
=
'payment_mode'
,
ledger
=
''
,
destination_section_value
=
organisation_module
.
client_1
,
start_date
=
later_this_month
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
bank
,
source_debit
=
300.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
receivable
,
source_credit
=
300.0
)),
)
# we should have all receivable and payable lines grouped.
for
transaction
in
[
purchase1
,
sale2
,
payment3
,
payment4
]:
for
line
in
transaction
.
getMovementList
():
if
(
line
.
getSourceValue
()
in
(
account_module
.
receivable
,
account_module
.
payable
)
or
line
.
getDestinationValue
()
in
(
account_module
.
receivable
,
account_module
.
payable
)):
assert
line
.
getGroupingReference
()
assert
line
.
getGroupingDate
()
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportAgedBalanceDataset.xml
0 → 100644
View file @
28c4777c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Python Script"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
AccountingZuite_createReportAgedBalanceDataset
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Python Script
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportDataset.py
0 → 100644
View file @
28c4777c
"""Create Dataset for basic Trial Balance Report such as defined at
https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccountingReports.py#L563
The test operates on 'today' transactions.
"""
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
person_module
=
portal
.
person_module
accounting_module
=
portal
.
accounting_module
account_module
=
portal
.
account_module
organisation_module
=
portal
.
organisation_module
one_hour
=
1.0
/
24.0
one_day
=
1.0
now
=
DateTime
()
today
=
DateTime
(
now
.
year
(),
now
.
month
(),
now
.
day
())
+
8
*
one_hour
yesterday
=
today
-
one_day
tomorrow
=
today
+
one_day
bank1
=
context
.
AccountingZuite_createDocument
(
parent
=
organisation_module
.
my_organisation
,
portal_type
=
'Bank Account'
,
title
=
'Bank1'
,
simulation_state
=
'validated'
)
bank2
=
bank1
if
two_banks
:
bank2
=
context
.
AccountingZuite_createDocument
(
parent
=
organisation_module
.
my_organisation
,
portal_type
=
'Bank Account'
,
title
=
'Bank2'
,
simulation_state
=
'validated'
)
context
.
AccountingZuite_createDocument
(
portal_type
=
'Accounting Transaction'
,
title
=
'Transaction 1'
,
source_reference
=
'1'
,
reference
=
'ref1'
,
simulation_state
=
'delivered'
,
destination_section_value
=
organisation_module
.
client_1
,
start_date
=
yesterday
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
receivable
,
source_debit
=
100.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
payable
,
source_credit
=
100.0
)),
)
context
.
AccountingZuite_createDocument
(
portal_type
=
'Accounting Transaction'
,
title
=
'Transaction 2'
,
source_reference
=
'2'
,
reference
=
'ref2'
,
simulation_state
=
'delivered'
,
destination_section_value
=
organisation_module
.
client_1
,
start_date
=
yesterday
+
one_hour
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
payable
,
source_debit
=
200.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
receivable
,
source_credit
=
200.0
)),
)
# in the period
context
.
AccountingZuite_createDocument
(
portal_type
=
'Payment Transaction'
,
title
=
'Transaction 3'
,
source_reference
=
'3'
,
reference
=
'ref3'
,
simulation_state
=
'delivered'
,
source_payment_value
=
bank1
,
destination_section_value
=
organisation_module
.
client_1
,
start_date
=
today
+
one_hour
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
receivable
,
source_debit
=
300.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
bank
,
source_credit
=
300.0
)),
)
context
.
AccountingZuite_createDocument
(
portal_type
=
'Payment Transaction'
,
title
=
'Transaction 4'
,
destination_reference
=
'4'
,
reference
=
'ref4'
,
simulation_state
=
'delivered'
,
destination_section_value
=
organisation_module
.
my_organisation
,
destination_payment_value
=
bank1
,
source_section_value
=
organisation_module
.
client_2
,
stop_date
=
today
+
2
*
one_hour
,
start_date
=
yesterday
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
destination_value
=
account_module
.
receivable
,
destination_debit
=
400.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
destination_value
=
account_module
.
bank
,
destination_credit
=
400.0
)),
)
context
.
AccountingZuite_createDocument
(
portal_type
=
'Accounting Transaction'
,
title
=
'Transaction 5'
,
source_reference
=
'5'
,
reference
=
'ref5'
,
simulation_state
=
'delivered'
,
source_payment_value
=
bank2
,
destination_section_value
=
person_module
.
john_smith
,
start_date
=
today
+
3
*
one_hour
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
receivable
,
source_debit
=
500.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
bank
,
source_credit
=
500.0
)),
)
context
.
AccountingZuite_createDocument
(
portal_type
=
'Purchase Invoice Transaction'
,
title
=
'Transaction 6'
,
destination_reference
=
'6'
,
reference
=
'ref6'
,
simulation_state
=
'delivered'
,
destination_payment_value
=
bank2
,
source_section_value
=
organisation_module
.
client_1
,
start_date
=
yesterday
+
2
*
one_hour
,
stop_date
=
today
+
4
*
one_hour
,
embedded
=
(
dict
(
portal_type
=
'Purchase Invoice Transaction Line'
,
destination_value
=
account_module
.
receivable
,
destination_debit
=
600.0
),
dict
(
portal_type
=
'Purchase Invoice Transaction Line'
,
destination_value
=
account_module
.
bank
,
destination_credit
=
600.0
)),
)
# another simulation state
context
.
AccountingZuite_createDocument
(
portal_type
=
'Accounting Transaction'
,
title
=
'Transaction 7'
,
source_reference
=
'7'
,
reference
=
'ref7'
,
simulation_state
=
'stopped'
,
source_payment_value
=
bank2
,
destination_section_value
=
organisation_module
.
client_1
,
start_date
=
today
+
5
*
one_hour
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
receivable
,
source_debit
=
700.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
bank
,
source_credit
=
700.0
)),
)
# after the period
context
.
AccountingZuite_createDocument
(
portal_type
=
'Accounting Transaction'
,
title
=
'Transaction 8'
,
source_reference
=
'8'
,
reference
=
'ref8'
,
simulation_state
=
'delivered'
,
source_payment_value
=
bank2
,
destination_section_value
=
organisation_module
.
client_1
,
start_date
=
tomorrow
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
receivable
,
source_debit
=
800.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
bank
,
source_credit
=
800.0
)),
)
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportDataset.xml
0 → 100644
View file @
28c4777c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_params
</string>
</key>
<value>
<string>
two_banks=False
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
AccountingZuite_createReportDataset
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportJournalDataset.py
0 → 100644
View file @
28c4777c
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
accounting_module
=
portal
.
accounting_module
account_module
=
portal
.
account_module
one_hour
=
1.0
/
24.0
today
=
DateTime
(
DateTime
().
Date
())
+
8
*
one_hour
yesterday
=
today
-
1
tomorrow
=
today
+
1
context
.
AccountingZuite_createDocument
(
portal_type
=
'Accounting Transaction'
,
simulation_state
=
'delivered'
,
start_date
=
yesterday
,
embedded
=
[
{
"portal_type"
:
'Accounting Transaction Line'
,
"source_value"
:
account_module
.
equity
,
"source_debit"
:
100
},
{
"portal_type"
:
'Accounting Transaction Line'
,
"source_value"
:
account_module
.
stocks
,
"source_credit"
:
100
}
]
)
context
.
AccountingZuite_createDocument
(
portal_type
=
'Sale Invoice Transaction'
,
title
=
'First One'
,
simulation_state
=
'delivered'
,
reference
=
'1'
,
destination_section_value
=
portal
.
organisation_module
.
client_1
,
start_date
=
today
,
embedded
=
[
{
"portal_type"
:
'Sale Invoice Transaction Line'
,
"source_value"
:
account_module
.
receivable
,
"source_debit"
:
119.60
},
{
"portal_type"
:
'Sale Invoice Transaction Line'
,
"source_value"
:
account_module
.
collected_vat
,
"source_credit"
:
19.60
},
{
"portal_type"
:
'Sale Invoice Transaction Line'
,
"source_value"
:
account_module
.
goods_sales
,
"source_credit"
:
100.00
},
]
)
context
.
AccountingZuite_createDocument
(
portal_type
=
'Sale Invoice Transaction'
,
title
=
'Second One'
,
simulation_state
=
'delivered'
,
reference
=
'2'
,
destination_section_value
=
portal
.
organisation_module
.
client_2
,
start_date
=
today
+
one_hour
,
# different values of hour minutes, because /for now/ sorting is
# done on date, uid. Sorting on [source|destination]_reference
# would be too heavy, and we just want a sort on date, with a
# stable order (hence the cheap sort on uid)
embedded
=
[
{
"portal_type"
:
'Sale Invoice Transaction Line'
,
"source_value"
:
account_module
.
receivable
,
"source_debit"
:
239.20
},
{
"portal_type"
:
'Sale Invoice Transaction Line'
,
"source_value"
:
account_module
.
collected_vat
,
"source_credit"
:
39.20
},
{
"portal_type"
:
'Sale Invoice Transaction Line'
,
"source_value"
:
account_module
.
goods_sales
,
"source_credit"
:
200.00
},
]
)
context
.
AccountingZuite_createDocument
(
portal_type
=
'Sale Invoice Transaction'
,
title
=
'Third One'
,
simulation_state
=
'delivered'
,
reference
=
'3'
,
destination_section_value
=
portal
.
person_module
.
john_smith
,
start_date
=
today
+
2
*
one_hour
,
embedded
=
[
{
"portal_type"
:
'Sale Invoice Transaction Line'
,
"source_value"
:
account_module
.
receivable
,
"source_debit"
:
358.80
},
{
"portal_type"
:
'Sale Invoice Transaction Line'
,
"source_value"
:
account_module
.
collected_vat
,
"source_credit"
:
58.80
},
{
"portal_type"
:
'Sale Invoice Transaction Line'
,
"source_value"
:
account_module
.
goods_sales
,
"title"
:
'Line Title'
,
"source_credit"
:
300.00
},
]
)
context
.
AccountingZuite_createDocument
(
portal_type
=
'Accounting Transaction'
,
simulation_state
=
'delivered'
,
start_date
=
today
,
embedded
=
[
{
"portal_type"
:
'Accounting Transaction Line'
,
"source_value"
:
account_module
.
equity
,
"source_debit"
:
111
},
{
"portal_type"
:
'Accounting Transaction Line'
,
"source_value"
:
account_module
.
stocks
,
"source_credit"
:
111
},
]
)
context
.
AccountingZuite_createDocument
(
portal_type
=
'Sale Invoice Transaction'
,
simulation_state
=
'delivered'
,
destination_section_value
=
portal
.
organisation_module
.
client_2
,
start_date
=
tomorrow
,
embedded
=
[
{
"portal_type"
:
"Sale Invoice Transaction Line"
,
"source_value"
:
account_module
.
receivable
,
"source_debit"
:
598.00
},
{
"portal_type"
:
"Sale Invoice Transaction Line"
,
"source_value"
:
account_module
.
collected_vat
,
"source_credit"
:
98.00
},
{
"portal_type"
:
"Sale Invoice Transaction Line"
,
"source_value"
:
account_module
.
goods_sales
,
"source_credit"
:
500.00
}])
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportJournalDataset.xml
0 → 100644
View file @
28c4777c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
AccountingZuite_createReportJournalDataset
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportOtherPartiesDataset.py
0 → 100644
View file @
28c4777c
"""Create Dataset for basic Trial Balance Report such as defined at
https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccountingReports.py#L4583
The test operates on 'today' transactions.
:param with_ledger: if true then data are prepared for
testOtherPartiesReportLedger unittest rather than testOtherPartiesReport
"""
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
accounting_module
=
portal
.
accounting_module
account_module
=
portal
.
account_module
ledger
=
portal
.
portal_categories
.
ledger
organisation_module
=
portal
.
organisation_module
person_module
=
portal
.
person_module
one_hour
=
1.0
/
24.0
now
=
DateTime
()
today
=
DateTime
(
now
.
year
(),
now
.
month
(),
now
.
day
())
+
8
*
one_hour
if
with_ledger
:
extra_kwargs_general
=
{
'ledger'
:
'accounting/general'
}
extra_kwargs_detailed
=
{
'ledger'
:
'accounting/detailed'
}
accounting_ledger
=
ledger
.
get
(
'accounting'
,
None
)
\
or
ledger
.
newContent
(
portal_type
=
'Category'
,
id
=
'accounting'
)
if
accounting_ledger
.
get
(
'general'
,
None
)
is
None
:
accounting_ledger
.
newContent
(
portal_type
=
'Category'
,
id
=
'general'
)
if
accounting_ledger
.
get
(
'detailed'
,
None
)
is
None
:
accounting_ledger
.
newContent
(
portal_type
=
'Category'
,
id
=
'detailed'
)
# necessary for the "ledger" form field to appear and have correct options
accounting_transaction
=
portal
.
portal_types
.
get
(
'Accounting Transaction'
)
if
not
accounting_transaction
.
getLedgerList
():
accounting_transaction
.
setProperty
(
"ledger_list"
,
[
'accounting/general'
,
'accounting/detailed'
])
else
:
extra_kwargs_general
=
{}
extra_kwargs_detailed
=
{}
context
.
AccountingZuite_createDocument
(
portal_type
=
'Accounting Transaction'
,
title
=
'Transaction 1'
,
source_reference
=
'1'
,
simulation_state
=
'delivered'
,
destination_section_value
=
organisation_module
.
client_1
,
start_date
=
today
+
1
*
one_hour
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
receivable
,
source_debit
=
100.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
goods_sales
,
source_credit
=
100.0
)),
**
extra_kwargs_general
)
context
.
AccountingZuite_createDocument
(
portal_type
=
'Accounting Transaction'
,
title
=
'Transaction 2'
,
source_reference
=
'2'
,
simulation_state
=
'delivered'
,
destination_section_value
=
organisation_module
.
client_1
,
start_date
=
today
+
2
*
one_hour
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
payable
,
source_debit
=
200.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
goods_sales
,
source_credit
=
200.0
)),
**
extra_kwargs_general
)
if
with_ledger
:
context
.
AccountingZuite_createDocument
(
portal_type
=
'Accounting Transaction'
,
title
=
'Transaction 3'
,
source_reference
=
'3'
,
simulation_state
=
'delivered'
,
destination_section_value
=
organisation_module
.
client_1
,
start_date
=
today
+
3
*
one_hour
,
embedded
=
(
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
payable
,
source_debit
=
400.0
),
dict
(
portal_type
=
'Accounting Transaction Line'
,
source_value
=
account_module
.
goods_sales
,
source_credit
=
400.0
)),
**
extra_kwargs_detailed
)
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createReportOtherPartiesDataset.xml
0 → 100644
View file @
28c4777c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Python Script"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_params
</string>
</key>
<value>
<string>
with_ledger=True
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
AccountingZuite_createReportOtherPartiesDataset
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Python Script
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_initializeAccountingTransactionReportTest.py
0 → 100644
View file @
28c4777c
"""Create deterministically transactions to test outputs of Reports."""
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
module
=
portal
.
accounting_module
# This option is necessary for RJS interface to render Reports
# If you'd keep XHTML value "View" the RJS will not crash it will
# only refuse to validate Report Form View
portal
.
AccountingZuite_setAccountReferencePreference
(
report_style
=
report_style
)
# First, clean up the module
module
.
manage_delObjects
(
list
(
module
.
objectIds
()))
# Create datasets
if
report_name
==
"journal"
:
module
.
AccountingZuite_createReportJournalDataset
()
elif
report_name
in
(
"trial-balance"
,
"general-ledger"
):
module
.
AccountingZuite_createReportDataset
()
elif
report_name
in
(
"account-statement"
,
"balance-sheet"
,
"profit-and-loss"
):
module
.
AccountingZuite_createReportDataset
(
two_banks
=
True
)
elif
report_name
==
"other-parties"
:
module
.
AccountingZuite_createReportOtherPartiesDataset
(
with_ledger
=
False
)
elif
report_name
==
"other-parties-ledger"
:
module
.
AccountingZuite_createReportOtherPartiesDataset
()
elif
report_name
==
"aged-balance"
:
module
.
AccountingZuite_createReportAgedBalanceDataset
()
else
:
raise
RuntimeError
(
'Unknown "{}" report - no create*Dataset defined'
.
format
(
report_name
))
# test depends on this
return
"Accounting Transactions Created."
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_initializeAccountingTransactionReportTest.xml
0 → 100644
View file @
28c4777c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_params
</string>
</key>
<value>
<string>
report_name, report_style
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
AccountingZuite_initializeAccountingTransactionReportTest
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reportMacros.xml
0 → 100644
View file @
28c4777c
<?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>
AccountingZuite_reportMacros
</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/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_reportMacros.zpt
0 → 100644
View file @
28c4777c
This diff is collapsed.
Click to expand it.
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_setAccountReferencePreference.py
View file @
28c4777c
preference
=
context
.
portal_preferences
.
accounting_zuite_preference
preference
.
edit
(
preferred_account_number_method
=
'account_reference'
)
preference
.
edit
(
preferred_account_number_method
=
'account_reference'
,
preferred_report_style
=
report_style
)
return
"Preference Set"
bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_setAccountReferencePreference.xml
View file @
28c4777c
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
report_style=\'View\'
</string>
</value>
</item>
<item>
<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