Commit 4331e3de authored by Łukasz Nowak's avatar Łukasz Nowak

Pass path as uid is not supported by searchAndActivate

parent 59f48f8d
...@@ -56,14 +56,14 @@ portal = context.getPortalObject()\n ...@@ -56,14 +56,14 @@ portal = context.getPortalObject()\n
activate_kw = {\n activate_kw = {\n
\'tag\': tag\n \'tag\': tag\n
}\n }\n
uid_list = [q.UID for q in portal.Base_getNotCategoryRelatedList(\n path_list = [q.getPath() for q in portal.Base_getNotCategoryRelatedList(\n
portal_type_list=[\'Sale Order Line\'],\n portal_type_list=[\'Sale Order Line\'],\n
simulation_state_list=[\'confirmed\'],\n simulation_state_list=[\'confirmed\'],\n
base_category_uid=portal.portal_categories.delivery.getUid())]\n base_category_uid=portal.portal_categories.delivery.getUid())]\n
\n \n
if len(uid_list) > 0:\n if len(path_list) > 0:\n
portal.portal_catalog.searchAndActivate(\n portal.portal_catalog.searchAndActivate(\n
uid=uid_list,\n path=path_list,\n
activate_kw=activate_kw,\n activate_kw=activate_kw,\n
packet_size=1, # Separate calls to many transactions\n packet_size=1, # Separate calls to many transactions\n
method_id=\'DeliveryLine_updateAppliedRule\',\n method_id=\'DeliveryLine_updateAppliedRule\',\n
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n
activate_kw = {\n activate_kw = {\n
\'tag\': tag\n \'tag\': tag\n
}\n }\n
...@@ -64,25 +65,25 @@ kw = dict(\n ...@@ -64,25 +65,25 @@ kw = dict(\n
simulation_state_list=simulation_state_list,\n simulation_state_list=simulation_state_list,\n
base_category_uid=portal.portal_categories.delivery.getUid()\n base_category_uid=portal.portal_categories.delivery.getUid()\n
)\n )\n
uid_list = set()\n path_list = set()\n
\n \n
for q in portal.Base_getNotCategoryRelatedList(**kw):\n for q in portal.Base_getNotCategoryRelatedList(**kw):\n
uid_list.add(q.UID)\n path_list.add(q.getPath())\n
\n \n
for q in portal.Base_getNotSynchronisedSimulationStateCategoryRelatedList(**kw):\n for q in portal.Base_getNotSynchronisedSimulationStateCategoryRelatedList(**kw):\n
uid_list.add(q.UID)\n path_list.add(q.getPath())\n
\n \n
# and all invoice lines and and transcation lines in confirmed state\n # and all invoice lines and and transcation lines in confirmed state\n
# XXX: We do simple version, and in Vifib confirmed ones can be often expanded, as it is short living state\n # XXX: We do simple version, and in Vifib confirmed ones can be often expanded, as it is short living state\n
\n \n
for q in portal.portal_catalog(portal_type=\'Invoice Line\', simulation_state=\'confirmed\'):\n for q in portal.portal_catalog(portal_type=\'Invoice Line\', simulation_state=\'confirmed\'):\n
if q.getSimulationState() == \'confirmed\':\n if q.getSimulationState() == \'confirmed\':\n
uid_list.add(q.UID)\n path_list.add(q.getPath())\n
uid_list = list(uid_list)\n path_list = list(path_list)\n
\n \n
if len(uid_list) > 0:\n if len(path_list) > 0:\n
portal.portal_catalog.searchAndActivate(\n portal.portal_catalog.searchAndActivate(\n
uid=uid_list,\n path=path_list,\n
packet_size=1, # Separate calls to many transactions\n packet_size=1, # Separate calls to many transactions\n
activate_kw=activate_kw,\n activate_kw=activate_kw,\n
method_id=\'DeliveryLine_updateAppliedRule\',\n method_id=\'DeliveryLine_updateAppliedRule\',\n
......
427 428
\ 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