Commit 4dccd2dd authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

simulation: add 'frozen' state in causality workflow for documents that are no longer simulated.

* erp5_base: add 'frozen' state and 'freeze' transition in delivery_causality_workflow.
* ERP5/mixin/rule.py: do nothing in _updateSimulation() if causality_state is 'frozen'.
parent 1fe4ce2c
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<tuple> <tuple>
<string>converge</string> <string>converge</string>
<string>diverge</string> <string>diverge</string>
<string>freeze</string>
<string>solve_automatically</string> <string>solve_automatically</string>
<string>start_building</string> <string>start_building</string>
</tuple> </tuple>
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<tuple> <tuple>
<string>converge</string> <string>converge</string>
<string>diverge</string> <string>diverge</string>
<string>freeze</string>
<string>solve_automatically</string> <string>solve_automatically</string>
<string>solve_divergence</string> <string>solve_divergence</string>
<string>solve_divergence_action</string> <string>solve_divergence_action</string>
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<string>calculate</string> <string>calculate</string>
<string>converge</string> <string>converge</string>
<string>diverge</string> <string>diverge</string>
<string>freeze</string>
<string>solve_automatically</string> <string>solve_automatically</string>
<string>solve_divergence</string> <string>solve_divergence</string>
<string>solve_divergence_action</string> <string>solve_divergence_action</string>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<key> <string>transitions</string> </key> <key> <string>transitions</string> </key>
<value> <value>
<tuple> <tuple>
<string>freeze</string>
<string>start_building</string> <string>start_building</string>
</tuple> </tuple>
</value> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="StateDefinition" module="Products.DCWorkflow.States"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>The document is no longer simulated.</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>frozen</string> </value>
</item>
<item>
<key> <string>permission_roles</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Frozen</string> </value>
</item>
<item>
<key> <string>transitions</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>Add portal content</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<string>calculate</string> <string>calculate</string>
<string>converge</string> <string>converge</string>
<string>diverge</string> <string>diverge</string>
<string>freeze</string>
<string>solve_automatically</string> <string>solve_automatically</string>
<string>start_building</string> <string>start_building</string>
</tuple> </tuple>
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<tuple> <tuple>
<string>converge</string> <string>converge</string>
<string>diverge</string> <string>diverge</string>
<string>freeze</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Make the document no longer simulated.</string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>freeze</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string>frozen</string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Freeze</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Modify portal content</string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -224,3 +224,4 @@ portal_current_inventory_state_list = ('delivered', 'started', 'stopped', 'invoi ...@@ -224,3 +224,4 @@ portal_current_inventory_state_list = ('delivered', 'started', 'stopped', 'invoi
portal_updatable_amortisation_transaction_state_list = ('draft',) portal_updatable_amortisation_transaction_state_list = ('draft',)
portal_frozen_causality_state_list = ('frozen',)
...@@ -1287,6 +1287,14 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1287,6 +1287,14 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
return self._getPortalConfiguration( return self._getPortalConfiguration(
'portal_updatable_amortisation_transaction_state_list') 'portal_updatable_amortisation_transaction_state_list')
security.declareProtected(Permissions.AccessContentsInformation,
'getPortalFrozenCausalityStateList')
def getPortalFrozenCausalityStateList(self):
"""
Return all causality states where the document is no longer simulated.
"""
return self._getPortalConfiguration('portal_frozen_causality_state_list')
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getPortalGroupedSimulationStateList') 'getPortalGroupedSimulationStateList')
def getPortalGroupedSimulationStateList(self): def getPortalGroupedSimulationStateList(self):
......
...@@ -495,6 +495,8 @@ class SimulableMixin(Base): ...@@ -495,6 +495,8 @@ class SimulableMixin(Base):
See _updateSimulation for accepted parameters. See _updateSimulation for accepted parameters.
""" """
if self.getCausalityState() == self.getPortalFrozenCausalityStateList():
return
tv = getTransactionalVariable() tv = getTransactionalVariable()
key = 'SimulableMixin.updateSimulation', self.getUid() key = 'SimulableMixin.updateSimulation', self.getUid()
item_list = kw.items() item_list = kw.items()
......
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