Commit 7d725c1f authored by Jérome Perrin's avatar Jérome Perrin

use 'isSimulated' from API, and only call this expensive method if a quantity is defined

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36357 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 294ddf02
...@@ -61,20 +61,15 @@ transaction = context.getObject()\n ...@@ -61,20 +61,15 @@ transaction = context.getObject()\n
transaction_lines = transaction.objectValues(portal_type=lines_portal_type)\n transaction_lines = transaction.objectValues(portal_type=lines_portal_type)\n
id_to_delete_list = []\n id_to_delete_list = []\n
\n \n
\n
for line in transaction_lines:\n for line in transaction_lines:\n
line = line.getObject()\n if line.getSourceInventoriatedTotalAssetPrice() or \\\n
# Do not delete lines involved in simulation\n line.getDestinationInventoriatedTotalAssetPrice() or \\\n
if len(line.getDeliveryRelatedValueList(\n line.isSimulated():\n
portal_type = \'Simulation Movement\') +\n continue\n
line.getOrderRelatedValueList(\n id_to_delete_list.append(line.getId())\n
portal_type = \'Simulation Movement\')) == 0:\n
if not line.getSourceInventoriatedTotalAssetPrice() and \\\n
not line.getDestinationInventoriatedTotalAssetPrice():\n
id_to_delete_list.append(line.getId())\n
\n \n
# Don\'t delete everything\n
if len(id_to_delete_list) != len(transaction_lines):\n if len(id_to_delete_list) != len(transaction_lines):\n
# Don\'t delete everything\n
transaction.deleteContent(id_to_delete_list)\n transaction.deleteContent(id_to_delete_list)\n
\n \n
if redirect:\n if redirect:\n
......
1287 1288
\ No newline at end of file \ No newline at end of file
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