Commit dea4eaf7 authored by Jérome Perrin's avatar Jérome Perrin

do not delete if _converted_ values are different from 0


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5599 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b047ae55
......@@ -73,18 +73,20 @@ This script deletes all empty (ie. with balance == 0) lines in an accounting tra
lines_portal_type = context.getPortalAccountingMovementTypeList()\n
transaction = context.getObject()\n
\n
for line in transaction.objectValues(portal_type=lines_portal_type) : \n
for line in transaction.objectValues(portal_type=lines_portal_type) :\n
line = line.getObject()\n
# Do not delete lines involved in simulation\n
if len( line.getDeliveryRelatedValueList(portal_type = \'Simulation Movement\') + \n
line.getOrderRelatedValueList(portal_type = \'Simulation Movement\') ) == 0 : \n
balance = line.getSourceDebit() - line.getSourceCredit()\n
if balance == 0 : \n
if len( line.getDeliveryRelatedValueList(\n
portal_type = \'Simulation Movement\') +\n
line.getOrderRelatedValueList(\n
portal_type = \'Simulation Movement\') ) == 0 :\n
if not line.getSourceInventoriatedTotalAssetPrice() and \\\n
not line.getDestinationInventoriatedTotalAssetPrice() :\n
transaction.deleteContent(line.getId())\n
\n
if redirect :\n
context.REQUEST.RESPONSE.redirect("%s/view?portal_status_message=%s" % (\n
transaction.getPath(), context.Base_TranslateString(\'Empty Lines Deleted.\')))\n
transaction.getPath(), context.Base_translateString(\'Empty Lines Deleted.\')))\n
</string> </value>
</item>
<item>
......@@ -93,9 +95,15 @@ if redirect :\n
<none/>
</value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines</string> </value>
<value> <string>Script (Python):/erp5/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......@@ -133,7 +141,6 @@ if redirect :\n
<string>_getiter_</string>
<string>line</string>
<string>len</string>
<string>balance</string>
</tuple>
</value>
</item>
......@@ -163,4 +170,25 @@ if redirect :\n
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment