| Total Complexity | 2 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 2 | |||
| 3 | from bika.lims import api |
||
| 4 | |||
| 5 | |||
| 6 | def _reindexWorkflowVariables(self, ob): |
||
| 7 | """This function is called by DCWorkflow immediately after the workflow |
||
| 8 | action is invoked in WorkflowTool.doActionFor. |
||
| 9 | |||
| 10 | The original function is only responsible of reindexing the variables that |
||
| 11 | may have changed due to the transition (e.g review_state) along with |
||
| 12 | security-related indexes. However, the original function does two calls |
||
| 13 | to reindexObject, one for workflow variables and another one for the |
||
| 14 | security-related indexes. Metadata is updated on both calls as well, cause |
||
| 15 | those workflow-variables might also be stored as metadata. |
||
| 16 | |||
| 17 | Since quite often the transition involves changes not only in |
||
| 18 | workflow-related variables, but to other field values, it becomes almost |
||
| 19 | a requirement to always reindex the object after a transition. Therefore, |
||
| 20 | we simply do a full reindexObject here instead of taking only some indexes |
||
| 21 | into account. |
||
| 22 | """ |
||
| 23 | if api.is_temporary(ob): |
||
| 24 | return |
||
| 25 | |||
| 26 | # do a full reindex |
||
| 27 | ob.reindexObject() |
||
| 28 |