Commit 205b9a0e authored by Julien Muchembled's avatar Julien Muchembled

inventory: fix indexation when erp5_stock_cache is not installed

parent 179c43bb
...@@ -331,16 +331,17 @@ class Inventory(Delivery): ...@@ -331,16 +331,17 @@ class Inventory(Delivery):
immediate_reindex_archive=immediate_reindex_archive) immediate_reindex_archive=immediate_reindex_archive)
if stock_object_list: if stock_object_list:
# Delete existing stock records and old inventory_cache first. kw = dict(sql_catalog_id=sql_catalog_id,
portal.portal_catalog.catalogObjectList(
stock_object_list[:], method_id_list=('z0_uncatalog_stock',
'SQLCatalog_trimInventoryCacheOnCatalog', ),
sql_catalog_id = sql_catalog_id,
disable_cache=1, check_uid=0, disable_archive=disable_archive, disable_cache=1, check_uid=0, disable_archive=disable_archive,
immediate_reindex_archive=immediate_reindex_archive) immediate_reindex_archive=immediate_reindex_archive)
method_id_list = ['z0_uncatalog_stock']
script_id = 'SQLCatalog_trimInventoryCacheOnCatalog'
if getattr(portal, script_id, None) is not None:
method_id_list.append(script_id)
# Delete existing stock records and old inventory_cache first.
portal.portal_catalog.catalogObjectList(
stock_object_list[:], method_id_list=method_id_list, **kw)
# Then insert new records without delete. # Then insert new records without delete.
portal.portal_catalog.catalogObjectList( portal.portal_catalog.catalogObjectList(
stock_object_list[:], method_id_list=('z_catalog_stock_list_without_delete_for_inventory_virtual_movement', ), stock_object_list, method_id_list=('z_catalog_stock_list_without_delete_for_inventory_virtual_movement', ),
sql_catalog_id = sql_catalog_id, **kw)
disable_cache=1, check_uid=0, disable_archive=disable_archive,
immediate_reindex_archive=immediate_reindex_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