Commit c0676d7d authored by Rafael Monnerat's avatar Rafael Monnerat

erp5_open_trade: Don't archive already archived Open Orders

    If two open orders are validated on the same transaction, archivePrevious script will get the an already archived as catalog will be outdated.
parent 5162d9e3
...@@ -11,4 +11,7 @@ for open_order in sci.getPortal().portal_catalog.searchResults( ...@@ -11,4 +11,7 @@ for open_order in sci.getPortal().portal_catalog.searchResults(
reference=open_order.getReference(), reference=open_order.getReference(),
validation_state='validated'): validation_state='validated'):
if this_uid != open_order.uid: if this_uid != open_order.uid:
open_order.getObject().archive() # The object could be already archived on this transaction, and not
# reindexed yet.
if open_order.getValidationState() != "archived":
open_order.getObject().archive()
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