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
Aaron Chen
erp5
Commits
cdeefdd9
Commit
cdeefdd9
authored
Aug 30, 2011
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deleteContent should be called in this script that has proxy roles.
parent
a1818daa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
96 deletions
+26
-96
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml
...rp5_accounting/AccountingTransaction_deleteEmptyLines.xml
+0
-88
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml
.../accounting_workflow/scripts/validateTransactionLines.xml
+12
-3
bt5/erp5_accounting/bt/revision
bt5/erp5_accounting/bt/revision
+1
-1
bt5/erp5_accounting_simulation_legacy/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml
.../accounting_workflow/scripts/validateTransactionLines.xml
+12
-3
bt5/erp5_accounting_simulation_legacy/bt/revision
bt5/erp5_accounting_simulation_legacy/bt/revision
+1
-1
No files found.
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml
deleted
100644 → 0
View file @
a1818daa
<?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>
_body
</string>
</key>
<value>
<string>
"""Deletes all empty (ie. with balance == 0) lines in an accounting transaction\n
"""\n
from Products.ERP5Type.Message import translateString\n
lines_portal_type = context.getPortalAccountingMovementTypeList()\n
transaction = context.getObject()\n
transaction_lines = transaction.objectValues(portal_type=lines_portal_type)\n
id_to_delete_list = []\n
\n
for line in transaction_lines:\n
if line.getSourceInventoriatedTotalAssetPrice() or \\\n
line.getDestinationInventoriatedTotalAssetPrice() or \\\n
line.isSimulated():\n
continue\n
id_to_delete_list.append(line.getId())\n
\n
# Don\'t delete everything\n
if len(id_to_delete_list) != len(transaction_lines):\n
transaction.deleteContent(id_to_delete_list)\n
\n
if redirect:\n
context.REQUEST.RESPONSE.redirect("%s/view?portal_status_message=%s" % (\n
transaction.absolute_url(), translateString(\'Empty lines deleted.\')))\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
redirect=0
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
AccountingTransaction_deleteEmptyLines
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml
View file @
cdeefdd9
...
@@ -70,8 +70,9 @@ container.validateTransaction(state_change)\n
...
@@ -70,8 +70,9 @@ container.validateTransaction(state_change)\n
\n
\n
# Check that all lines uses open accounts, and doesn\'t use invalid third\n
# Check that all lines uses open accounts, and doesn\'t use invalid third\n
# parties or bank accounts\n
# parties or bank accounts\n
for line in transaction.contentValues(filter=dict(\n
transaction_lines = transaction.objectValues(portal_type=transaction.getPortalAccountingMovementTypeList())\n
portal_type=transaction.getPortalAccountingMovementTypeList())):\n
id_to_delete_list = []\n
for line in transaction_lines:\n
\n
\n
for account, third_party, bank_account in (\n
for account, third_party, bank_account in (\n
( line.getSourceValue(portal_type=\'Account\'),\n
( line.getSourceValue(portal_type=\'Account\'),\n
...
@@ -139,9 +140,17 @@ for line in transaction.contentValues(filter=dict(\n
...
@@ -139,9 +140,17 @@ for line in transaction.contentValues(filter=dict(\n
line.getDestinationInventoriatedTotalAssetDebit())):\n
line.getDestinationInventoriatedTotalAssetDebit())):\n
raise ValidationFailed(translateString(\n
raise ValidationFailed(translateString(\n
"Destination conversion should not be set."))\n
"Destination conversion should not be set."))\n
\n
if line.getSourceInventoriatedTotalAssetPrice() or \\\n
line.getDestinationInventoriatedTotalAssetPrice() or \\\n
line.isSimulated():\n
continue\n
id_to_delete_list.append(line.getId())\n
\n
\n
# Delete empty lines\n
# Delete empty lines\n
transaction.AccountingTransaction_deleteEmptyLines(redirect=0)\n
# Don\'t delete everything\n
if len(id_to_delete_list) != len(transaction_lines):\n
transaction.deleteContent(id_to_delete_list)\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
bt5/erp5_accounting/bt/revision
View file @
cdeefdd9
1466
1467
\ No newline at end of file
\ No newline at end of file
bt5/erp5_accounting_simulation_legacy/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml
View file @
cdeefdd9
...
@@ -70,8 +70,9 @@ container.validateTransaction(state_change)\n
...
@@ -70,8 +70,9 @@ container.validateTransaction(state_change)\n
\n
\n
# Check that all lines uses open accounts, and doesn\'t use invalid third\n
# Check that all lines uses open accounts, and doesn\'t use invalid third\n
# parties or bank accounts\n
# parties or bank accounts\n
for line in transaction.contentValues(filter=dict(\n
transaction_lines = transaction.objectValues(portal_type=transaction.getPortalAccountingMovementTypeList())\n
portal_type=transaction.getPortalAccountingMovementTypeList())):\n
id_to_delete_list = []\n
for line in transaction_lines:\n
\n
\n
for account, third_party, bank_account in (\n
for account, third_party, bank_account in (\n
( line.getSourceValue(portal_type=\'Account\'),\n
( line.getSourceValue(portal_type=\'Account\'),\n
...
@@ -139,9 +140,17 @@ for line in transaction.contentValues(filter=dict(\n
...
@@ -139,9 +140,17 @@ for line in transaction.contentValues(filter=dict(\n
line.getDestinationInventoriatedTotalAssetDebit())):\n
line.getDestinationInventoriatedTotalAssetDebit())):\n
raise ValidationFailed(translateString(\n
raise ValidationFailed(translateString(\n
"Destination conversion should not be set."))\n
"Destination conversion should not be set."))\n
\n
if line.getSourceInventoriatedTotalAssetPrice() or \\\n
line.getDestinationInventoriatedTotalAssetPrice() or \\\n
line.isSimulated():\n
continue\n
id_to_delete_list.append(line.getId())\n
\n
\n
# Delete empty lines\n
# Delete empty lines\n
transaction.AccountingTransaction_deleteEmptyLines(redirect=0)\n
# Don\'t delete everything\n
if len(id_to_delete_list) != len(transaction_lines):\n
transaction.deleteContent(id_to_delete_list)\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
bt5/erp5_accounting_simulation_legacy/bt/revision
View file @
cdeefdd9
5
6
\ No newline at end of file
\ No newline at end of file
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