Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Jérome Perrin
erp5
Commits
d418a1e9
Commit
d418a1e9
authored
12 years ago
by
Jérome Perrin
Browse files
Options
Download
Email Patches
Plain Diff
accounting periods: refuse to close if previous period is not closed
parent
ee428750
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_period_workflow/scripts/checkTransactionsState.xml
...unting_period_workflow/scripts/checkTransactionsState.xml
+18
-2
bt5/erp5_accounting/bt/revision
bt5/erp5_accounting/bt/revision
+1
-1
No files found.
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_period_workflow/scripts/checkTransactionsState.xml
View file @
d418a1e9
...
...
@@ -50,7 +50,9 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import translateString\n
\n
period = state_change[\'object\']\n
...
...
@@ -64,6 +66,18 @@ all_state_list = [x[1] for x in\n
invalid_simulation_state_list = [state for state in all_state_list\n
if state not in valid_simulation_state_list]\n
\n
if period.getParentValue().getPortalType() == \'Organisation\':\n
# if this is a "main" accounting period, we refuse to close if the previous\n
# period is not already closed.\n
for other_period in period.getParentValue().contentValues(\n
portal_type=\'Accounting Period\',\n
checked_permission=\'View\'):\n
if other_period != period and \\\n
other_period.getSimulationState() not in (\'delivered\', \'cancelled\') and\\\n
other_period.getStartDate() < period.getStartDate():\n
raise ValidationFailed(translateString(\n
"Previous accounting periods has to be closed first."))\n
\n
section = period.getParentValue()\n
while section.getPortalType() == period.getPortalType():\n
section = section.getParentValue()\n
...
...
@@ -115,7 +129,9 @@ movement_list = portal.portal_simulation.getMovementHistoryList(\n
if movement_list:\n
raise ValidationFailed, translateString(\n
"All Accounting Transactions for this organisation during the period have to be closed first.")\n
</string>
</value>
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_accounting/bt/revision
View file @
d418a1e9
151
6
151
7
This diff is collapsed.
Click to expand it.
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