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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Douglas
erp5
Commits
ae08f36f
Commit
ae08f36f
authored
May 27, 2016
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_accounting: adds filtering on ledger for Trial Balance Report
parent
20f4b267
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
378 additions
and
1 deletion
+378
-1
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.py
...accounting/AccountModule_getAccountListForTrialBalance.py
+13
-0
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.xml
...ccounting/AccountModule_getAccountListForTrialBalance.xml
+1
-1
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceReportSectionList.py
...ounting/AccountModule_getTrialBalanceReportSectionList.py
+2
-0
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewTrialBalanceReport.xml
.../erp5_accounting/AccountModule_viewTrialBalanceReport.xml
+1
-0
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewTrialBalanceReport/your_ledger.xml
...ting/AccountModule_viewTrialBalanceReport/your_ledger.xml
+84
-0
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewTrialBalanceReportDialog.xml
...accounting/AccountModule_viewTrialBalanceReportDialog.xml
+1
-0
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewTrialBalanceReportDialog/your_ledger.xml
...ccountModule_viewTrialBalanceReportDialog/your_ledger.xml
+84
-0
product/ERP5/tests/testAccountingReports.py
product/ERP5/tests/testAccountingReports.py
+192
-0
No files found.
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.py
View file @
ae08f36f
...
...
@@ -3,6 +3,7 @@ from Products.PythonScripts.standard import Object
from
ZTUtils
import
LazyFilter
portal
=
context
.
getPortalObject
()
portal_categories
=
portal
.
portal_categories
request
=
portal
.
REQUEST
getInventoryList_
=
portal
.
portal_simulation
.
getInventoryList
traverse
=
portal
.
restrictedTraverse
...
...
@@ -91,6 +92,18 @@ if project:
if
mirror_section_category
:
inventory_params
[
'mirror_section_category'
]
=
mirror_section_category
if
ledger
:
if
ledger
==
'None'
:
inventory_params
[
'ledger_uid'
]
=
Query
(
ledger_uid
=
None
)
else
:
if
not
isinstance
(
ledger
,
list
):
# Allows the generation of reports on different ledgers as the same time
ledger
=
[
ledger
]
ledger_value_list
=
[
portal_categories
.
restrictedTraverse
(
ledger_category
,
None
)
for
ledger_category
in
ledger
]
for
ledger_value
in
ledger_value_list
:
inventory_params
.
setdefault
(
'ledger_uid'
,
[]).
append
(
ledger_value
.
getUid
())
# a dictionary (node_relative_url, mirror_section_uid, payment_uid + analytic)
# -> {'debit'=, 'credit'=}
line_per_account
=
{}
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountListForTrialBalance.xml
View file @
ae08f36f
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
show_empty_accounts, expand_accounts, at_date, from_date, period_start_date, section_uid, simulation_state, precision, node_uid, gap_root=None, per_account_class_summary=0, portal_type=None, function=None, funding=None, project=None, group_analytic=[], mirror_section_category=None, show_detailed_balance_columns=False, src__=False, **kw
</string>
</value>
<value>
<string>
show_empty_accounts, expand_accounts, at_date, from_date, period_start_date, section_uid, simulation_state, precision, node_uid, gap_root=None, per_account_class_summary=0, portal_type=None, function=None, funding=None, project=None,
ledger=None,
group_analytic=[], mirror_section_category=None, show_detailed_balance_columns=False, src__=False, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceReportSectionList.py
View file @
ae08f36f
...
...
@@ -10,6 +10,7 @@ from_date = request.get('from_date', None)
portal_type
=
request
.
get
(
'portal_type'
,
None
)
function
=
request
.
get
(
'function'
,
None
)
funding
=
request
.
get
(
'funding'
,
None
)
ledger
=
request
.
get
(
'ledger'
,
None
)
project
=
request
.
get
(
'project'
,
None
)
simulation_state
=
request
[
'simulation_state'
]
expand_accounts
=
request
.
get
(
'expand_accounts'
,
False
)
...
...
@@ -119,6 +120,7 @@ return [ ReportSection(
section_uid
=
section_uid
,
function
=
function
,
funding
=
funding
,
ledger
=
ledger
,
project
=
project
,
portal_type
=
portal_type
,
simulation_state
=
simulation_state
,
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewTrialBalanceReport.xml
View file @
ae08f36f
...
...
@@ -100,6 +100,7 @@
<string>
your_mirror_section_category_list
</string>
<string>
your_gap_root
</string>
<string>
your_portal_type
</string>
<string>
your_ledger
</string>
<string>
your_simulation_state
</string>
<string>
your_report_date
</string>
</list>
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewTrialBalanceReport/your_ledger.xml
0 → 100644
View file @
ae08f36f
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_ledger
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
your_ledger
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
AccountModule_viewReportFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewTrialBalanceReportDialog.xml
View file @
ae08f36f
...
...
@@ -107,6 +107,7 @@
<string>
your_simulation_state
</string>
<string>
your_portal_type
</string>
<string>
your_mirror_section_category_list
</string>
<string>
your_ledger
</string>
<string>
your_landscape
</string>
</list>
</value>
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_viewTrialBalanceReportDialog/your_ledger.xml
0 → 100644
View file @
ae08f36f
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_ledger
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
your_ledger
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
AccountModule_viewDialogFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/tests/testAccountingReports.py
View file @
ae08f36f
...
...
@@ -798,6 +798,47 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
dict
(
source_value
=
account_module
.
goods_sales
,
source_credit
=
300.0
)))
def
createLedgerDataSet
(
self
):
# create some ledgers
ledger
=
self
.
portal
.
portal_categories
.
ledger
self
.
accounting_ledger
=
ledger
.
get
(
'accounting'
,
None
)
if
self
.
accounting_ledger
is
None
:
self
.
accounting_ledger
=
ledger
.
newContent
(
portal_type
=
'Category'
,
id
=
'accounting'
)
if
self
.
accounting_ledger
.
get
(
'general'
,
None
)
is
None
:
self
.
accounting_ledger
.
newContent
(
portal_type
=
'Category'
,
id
=
'general'
)
if
self
.
accounting_ledger
.
get
(
'detailed'
,
None
)
is
None
:
self
.
accounting_ledger
.
newContent
(
portal_type
=
'Category'
,
id
=
'detailed'
)
account_module
=
self
.
portal
.
account_module
self
.
_makeOne
(
portal_type
=
'Sale Invoice Transaction'
,
title
=
'Ledger detailed'
,
simulation_state
=
'delivered'
,
destination_section_value
=
self
.
organisation_module
.
client_1
,
ledger
=
'accounting/detailed'
,
start_date
=
DateTime
(
2006
,
2
,
2
),
lines
=
(
dict
(
source_value
=
account_module
.
receivable
,
source_debit
=
300.0
),
dict
(
source_value
=
account_module
.
goods_sales
,
source_credit
=
300.0
),
dict
(
source_value
=
account_module
.
receivable
,
source_debit
=
200.0
),
dict
(
source_value
=
account_module
.
goods_sales
,
source_credit
=
200.0
)))
self
.
_makeOne
(
portal_type
=
'Sale Invoice Transaction'
,
title
=
'Ledger general'
,
simulation_state
=
'delivered'
,
destination_section_value
=
self
.
organisation_module
.
client_1
,
ledger
=
'accounting/general'
,
start_date
=
DateTime
(
2006
,
2
,
2
),
lines
=
(
dict
(
source_value
=
account_module
.
receivable
,
source_debit
=
500.0
),
dict
(
source_value
=
account_module
.
goods_sales
,
source_credit
=
500.0
)))
def
test_Resource_zGetMovementHistoryList
(
self
):
# Check if Resource_zGetMovementHistoryList works fine with derived_merge optimizer.
# see https://bugs.launchpad.net/maria/+bug/985828
...
...
@@ -3569,6 +3610,157 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
credit
=
300
,
final_debit_balance
=
300
,
final_credit_balance
=
300
,
final_balance_if_debit
=
300
,
final_balance_if_credit
=
300
)
def
testTrialBalanceLedger
(
self
):
# trial balance restricted to a ledger
self
.
createLedgerDataSet
()
# set request variables and render
request_form
=
self
.
portal
.
REQUEST
.
form
request_form
[
'from_date'
]
=
DateTime
(
2006
,
1
,
1
)
request_form
[
'at_date'
]
=
DateTime
(
2006
,
12
,
31
)
request_form
[
'section_category'
]
=
'group/demo_group'
request_form
[
'section_category_strict'
]
=
False
request_form
[
'simulation_state'
]
=
[
'stopped'
,
'delivered'
]
request_form
[
'show_empty_accounts'
]
=
0
request_form
[
'expand_accounts'
]
=
0
request_form
[
'per_account_class_summary'
]
=
0
request_form
[
'portal_type'
]
=
[
'Sale Invoice Transaction'
]
request_form
[
'group_analytic'
]
=
[]
request_form
[
'show_detailed_balance_columns'
]
=
1
# only get transactions belonging to ledger.accounting.general
request_form
[
'ledger'
]
=
'ledger/accounting/general'
report_section_list
=
self
.
getReportSectionList
(
self
.
portal
.
accounting_module
,
'AccountModule_viewTrialBalanceReport'
)
self
.
assertEqual
(
1
,
len
(
report_section_list
))
line_list
=
self
.
getListBoxLineList
(
report_section_list
[
0
])
data_line_list
=
[
l
for
l
in
line_list
if
l
.
isDataLine
()]
self
.
assertEqual
(
2
,
len
(
data_line_list
))
self
.
checkLineProperties
(
data_line_list
[
0
],
node_id
=
'41'
,
node_title
=
'Receivable'
,
initial_debit_balance
=
0
,
initial_credit_balance
=
0
,
debit
=
500
,
credit
=
0
,
final_debit_balance
=
500
,
final_credit_balance
=
0
,
final_balance_if_debit
=
500
,
final_balance_if_credit
=
0
,)
self
.
checkLineProperties
(
data_line_list
[
1
],
node_id
=
'7'
,
node_title
=
'Goods Sales'
,
initial_debit_balance
=
0
,
initial_credit_balance
=
0
,
debit
=
0
,
credit
=
500
,
final_debit_balance
=
0
,
final_credit_balance
=
500
,
final_balance_if_debit
=
0
,
final_balance_if_credit
=
500
,)
self
.
assertTrue
(
line_list
[
-
1
].
isStatLine
())
self
.
checkLineProperties
(
line_list
[
-
1
],
node_id
=
None
,
node_title
=
None
,
initial_debit_balance
=
0
,
initial_credit_balance
=
0
,
debit
=
500
,
credit
=
500
,
final_debit_balance
=
500
,
final_credit_balance
=
500
,
final_balance_if_debit
=
500
,
final_balance_if_credit
=
500
)
def
testTrialBalanceWithMultipleLedger
(
self
):
# trial balance restricted to a ledger
self
.
createLedgerDataSet
()
# get a report on both ledgers
request_form
=
self
.
portal
.
REQUEST
.
form
request_form
[
'from_date'
]
=
DateTime
(
2006
,
1
,
1
)
request_form
[
'at_date'
]
=
DateTime
(
2006
,
12
,
31
)
request_form
[
'section_category'
]
=
'group/demo_group'
request_form
[
'section_category_strict'
]
=
False
request_form
[
'simulation_state'
]
=
[
'stopped'
,
'delivered'
]
request_form
[
'show_empty_accounts'
]
=
0
request_form
[
'expand_accounts'
]
=
0
request_form
[
'per_account_class_summary'
]
=
0
request_form
[
'portal_type'
]
=
[
'Sale Invoice Transaction'
]
request_form
[
'group_analytic'
]
=
[]
request_form
[
'show_detailed_balance_columns'
]
=
1
request_form
[
'ledger'
]
=
[
'ledger/accounting/general'
,
'ledger/accounting/detailed'
]
report_section_list
=
self
.
getReportSectionList
(
self
.
portal
.
accounting_module
,
'AccountModule_viewTrialBalanceReport'
)
self
.
assertEqual
(
1
,
len
(
report_section_list
))
line_list
=
self
.
getListBoxLineList
(
report_section_list
[
0
])
data_line_list
=
[
l
for
l
in
line_list
if
l
.
isDataLine
()]
self
.
assertEqual
(
2
,
len
(
data_line_list
))
self
.
checkLineProperties
(
data_line_list
[
0
],
node_id
=
'41'
,
node_title
=
'Receivable'
,
initial_debit_balance
=
0
,
initial_credit_balance
=
0
,
debit
=
1000
,
credit
=
0
,
final_debit_balance
=
1000
,
final_credit_balance
=
0
,
final_balance_if_debit
=
1000
,
final_balance_if_credit
=
0
,)
self
.
checkLineProperties
(
data_line_list
[
1
],
node_id
=
'7'
,
node_title
=
'Goods Sales'
,
initial_debit_balance
=
0
,
initial_credit_balance
=
0
,
debit
=
0
,
credit
=
1000
,
final_debit_balance
=
0
,
final_credit_balance
=
1000
,
final_balance_if_debit
=
0
,
final_balance_if_credit
=
1000
,)
self
.
assertTrue
(
line_list
[
-
1
].
isStatLine
())
self
.
checkLineProperties
(
line_list
[
-
1
],
node_id
=
None
,
node_title
=
None
,
initial_debit_balance
=
0
,
initial_credit_balance
=
0
,
debit
=
1000
,
credit
=
1000
,
final_debit_balance
=
1000
,
final_credit_balance
=
1000
,
final_balance_if_debit
=
1000
,
final_balance_if_credit
=
1000
)
def
testTrialBalanceNoLedger
(
self
):
# trial balance with no filter on ledger
# it is expected to return a report on all movements
self
.
createLedgerDataSet
()
# Document with no ledger
self
.
_makeOne
(
portal_type
=
'Sale Invoice Transaction'
,
title
=
'Ledger general'
,
reference
=
'noledger'
,
simulation_state
=
'delivered'
,
destination_section_value
=
self
.
organisation_module
.
client_1
,
start_date
=
DateTime
(
2006
,
2
,
2
),
lines
=
(
dict
(
source_value
=
self
.
portal
.
account_module
.
receivable
,
source_debit
=
400.0
),
dict
(
source_value
=
self
.
portal
.
account_module
.
goods_sales
,
source_credit
=
400.0
)))
# set request variables and render
request_form
=
self
.
portal
.
REQUEST
.
form
request_form
[
'from_date'
]
=
DateTime
(
2006
,
1
,
1
)
request_form
[
'at_date'
]
=
DateTime
(
2006
,
12
,
31
)
request_form
[
'section_category'
]
=
'group/demo_group'
request_form
[
'section_category_strict'
]
=
False
request_form
[
'simulation_state'
]
=
[
'stopped'
,
'delivered'
]
request_form
[
'ledger'
]
=
'None'
request_form
[
'show_empty_accounts'
]
=
0
request_form
[
'expand_accounts'
]
=
0
request_form
[
'per_account_class_summary'
]
=
0
request_form
[
'portal_type'
]
=
[
'Sale Invoice Transaction'
]
request_form
[
'group_analytic'
]
=
[]
request_form
[
'show_detailed_balance_columns'
]
=
1
report_section_list
=
self
.
getReportSectionList
(
self
.
portal
.
accounting_module
,
'AccountModule_viewTrialBalanceReport'
)
self
.
assertEqual
(
1
,
len
(
report_section_list
))
line_list
=
self
.
getListBoxLineList
(
report_section_list
[
0
])
data_line_list
=
[
l
for
l
in
line_list
if
l
.
isDataLine
()]
self
.
assertEqual
(
2
,
len
(
data_line_list
))
self
.
checkLineProperties
(
data_line_list
[
0
],
node_id
=
'41'
,
node_title
=
'Receivable'
,
initial_debit_balance
=
0
,
initial_credit_balance
=
0
,
debit
=
400
,
credit
=
0
,
final_debit_balance
=
400
,
final_credit_balance
=
0
,
final_balance_if_debit
=
400
,
final_balance_if_credit
=
0
,)
self
.
checkLineProperties
(
data_line_list
[
1
],
node_id
=
'7'
,
node_title
=
'Goods Sales'
,
initial_debit_balance
=
0
,
initial_credit_balance
=
0
,
debit
=
0
,
credit
=
400
,
final_debit_balance
=
0
,
final_credit_balance
=
400
,
final_balance_if_debit
=
0
,
final_balance_if_credit
=
400
,)
self
.
assertTrue
(
line_list
[
-
1
].
isStatLine
())
self
.
checkLineProperties
(
line_list
[
-
1
],
node_id
=
None
,
node_title
=
None
,
initial_debit_balance
=
0
,
initial_credit_balance
=
0
,
debit
=
400
,
credit
=
400
,
final_debit_balance
=
400
,
final_credit_balance
=
400
,
final_balance_if_debit
=
400
,
final_balance_if_credit
=
400
)
def
testGeneralLedger
(
self
):
# Simple test of general ledger
...
...
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