From 93c0e09991a6b46f6e6deff4a50fd4e5bb44ab55 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Thu, 6 Sep 2007 14:30:29 +0000
Subject: [PATCH] rename isInventoryLine to isInventoryMovement add method to
 define reindex_kw, it acts like activate_kw but for reindexing

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16120 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Base.py | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py
index cd44912cea..432abf4544 100644
--- a/product/ERP5Type/Base.py
+++ b/product/ERP5Type/Base.py
@@ -672,10 +672,10 @@ class Base( CopyContainer,
   isCapacity = 0      #
   isCategory = 0      #
   isBaseCategory = 0  #
+  isInventoryMovement = 0      #
   isMovement = 0      #
   isDelivery = 0      #
   isInventory = 0     #
-  isInventoryLine = 0 #
   isIndexable = 1     # If set to 0, reindexing will not happen (useful for optimization)
   isPredicate = 0     #
   isTemplate = 0      #
@@ -2533,6 +2533,10 @@ class Base( CopyContainer,
       if activate_kw is None:
         activate_kw = {}
 
+      reindex_kw = self.getDefaultReindexParametersDict()
+      if reindex_kw is not None:
+        kw.update(reindex_kw)
+      
       group_id_list  = []
       if kw.get("group_id", "") not in ('', None):
         group_id_list.append(kw.get("group_id", ""))
@@ -3299,6 +3303,24 @@ class Base( CopyContainer,
     dochelper.setDynamicPropertyList(dynamic_property_list)
     return dochelper
 
+
+  security.declareProtected(permissions.ModifyPortalContent, 'setDefaultReindexParameters' )
+  def setDefaultReindexParameters(self, **kw):
+    # This method sets the default keyword parameters to reindex. This is useful
+    # when you need to specify special parameters implicitly (e.g. to reindexObject).
+    tv = getTransactionalVariable(self)
+    key = ('default_reindex_parameter', id(aq_base(self)))
+    tv[key] = kw
+
+  security.declareProtected(permissions.View, 'getDefaultReindexParameterDict' )
+  def getDefaultReindexParametersDict(self):
+    # This method returns default reindex parameters to self.
+    # The result can be either a dict object or None.
+    tv = getTransactionalVariable(self)
+    key = ('default_reindex_parameter', id(aq_base(self)))
+    return tv.get(key)
+
+
 InitializeClass(Base)
 
 class TempBase(Base):
-- 
2.30.9