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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
fb51700c
Commit
fb51700c
authored
Nov 13, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accounting: introduce AccountingTransaction_checkConsistency
parent
544441e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
0 deletions
+106
-0
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_checkConsistency.py
...erp5_accounting/AccountingTransaction_checkConsistency.py
+17
-0
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_checkConsistency.xml
...rp5_accounting/AccountingTransaction_checkConsistency.xml
+62
-0
bt5/erp5_accounting/TestTemplateItem/portal_components/test.erp5.testAccounting.py
...emplateItem/portal_components/test.erp5.testAccounting.py
+27
-0
No files found.
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_checkConsistency.py
0 → 100644
View file @
fb51700c
"""Check consistency of an accounting transaction.
This verifies the constraints defined in constraints and also "temporary" constraints,
such as "client is validated" or "accounting period is open" that are currently defined
in workflow script.
This is intentded to be used in custom scripts creating accounting transactions and
validating them.
"""
context
.
Base_checkConsistency
()
accounting_workflow
=
context
.
getPortalObject
().
portal_workflow
.
accounting_workflow
accounting_workflow
.
script_validateTransactionLines
(
{
'object'
:
context
,
'kwargs'
:
{},
'transition'
:
accounting_workflow
.
transition_deliver_action
})
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_checkConsistency.xml
0 → 100644
View file @
fb51700c
<?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>
AccountingTransaction_checkConsistency
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_accounting/TestTemplateItem/portal_components/test.erp5.testAccounting.py
View file @
fb51700c
...
...
@@ -1147,6 +1147,33 @@ class TestTransactionValidation(AccountingTestCase):
self
.
portal
.
portal_workflow
.
doActionFor
(
accounting_transaction
,
'stop_action'
)
def
test_AccountingTransaction_checkConsistency
(
self
):
accounting_transaction
=
self
.
_makeOne
(
portal_type
=
'Accounting Transaction'
,
start_date
=
DateTime
(
'2008/12/31'
),
destination_section_value
=
self
.
organisation_module
.
supplier
,
lines
=
(
dict
(
id
=
'line_with_wrong_quantity'
,
source_value
=
self
.
account_module
.
goods_purchase
,
source_debit
=
400
),
dict
(
source_value
=
self
.
account_module
.
receivable
,
source_credit
=
500
)))
self
.
assertRaisesRegexp
(
ValidationFailed
,
'Transaction is not balanced'
,
accounting_transaction
.
AccountingTransaction_checkConsistency
,
)
accounting_transaction
.
line_with_wrong_quantity
.
setSourceDebit
(
500
)
self
.
assertRaisesRegexp
(
ValidationFailed
,
'Date is not in a started Accounting Period'
,
accounting_transaction
.
AccountingTransaction_checkConsistency
,
)
accounting_transaction
.
setStartDate
(
DateTime
(
'2007/11/11'
))
accounting_transaction
.
AccountingTransaction_checkConsistency
()
class
TestClosingPeriod
(
AccountingTestCase
):
"""Various tests for closing the period.
...
...
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