Commit cd375713 authored by Łukasz Nowak's avatar Łukasz Nowak

- support DummyMovement to be in DummyDelivery

 - set up is as movement in orders and deliveries


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28117 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b046fbf2
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2006 Nexedi SA and Contributors. All Rights Reserved.
# Jerome Perrin <jerome@nexedi.com>
# Łukasz Nowak <luke@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
......@@ -32,8 +34,8 @@ from Products.ERP5.Document.Movement import Movement
class DummyMovement(Movement):
"""Dummy Movement for testing purposes."""
meta_type = 'ERP5 Movement'
portal_type = 'Movement'
meta_type = 'ERP5 Dummy Movement'
portal_type = 'Dummy Movement'
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
......@@ -61,25 +63,38 @@ class DummyMovement(Movement):
"""Our dummy movement are always accountable."""
return getattr(self, 'is_accountable', 1)
def _getPropertyDirectlyOrFromDummyDelivery(self, property, default=None):
"""Returns property from delivery, in case if in Dummy Delivery, or movement"""
if self.getParentValue().getPortalType() == 'Dummy Delivery':
return self.getParentValue().getSimulationState()
return getattr(self, property, default)
def getSimulationState(self):
"""Directly returns a simulation state."""
return getattr(self, 'simulation_state', 'draft')
return self._getPropertyDirectlyOrFromDummyDelivery(
'simulation_state', 'draft')
def setSimulationState(self, state):
"""Directly sets a simulation state."""
self.simulation_state = state
"""Directly sets a simulation state if not in Dummy Delivery."""
if self.getParentValue().getPortalType() != 'Dummy Delivery':
self.simulation_state = state
else:
raise ValueError
def getCausalityState(self):
"""Directly returns a causality state."""
return getattr(self, 'simulation_state', 'draft')
return self._getPropertyDirectlyOrFromDummyDelivery(
'causality_state', 'draft')
def setCausalityState(self, state):
"""Directly sets a causality state."""
self.causality_state = state
if self.getParentValue().getPortalType() != 'Dummy Delivery':
self.simulation_state = state
else:
raise ValueError
def getDeliveryValue(self):
"""A dummy movement doesn't have a delivery relation, so return self as delivery.
"""
return self
def hasCellContent(self):
return False
......@@ -3,21 +3,12 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Type.ERP5Type</string>
<string>ERP5TypeInformation</string>
</tuple>
<none/>
<global name="ERP5TypeInformation" module="Products.ERP5Type.ERP5Type"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_actions</string> </key>
<value>
......@@ -30,12 +21,6 @@
<dictionary/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_roles</string> </key>
<value>
......@@ -81,7 +66,10 @@
<item>
<key> <string>group_list</string> </key>
<value>
<tuple/>
<tuple>
<string>delivery_movement</string>
<string>order_movement</string>
</tuple>
</value>
</item>
<item>
......@@ -98,6 +86,10 @@
<key> <string>init_script</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>permission</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>property_sheet_list</string> </key>
<value>
......
0.1
\ No newline at end of file
0.2
\ 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