Commit 92424b19 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: erp5_immobilisation: Migrate ImmobilisationItem and its Interface from FS.

parent 8b2c9d5c
......@@ -32,7 +32,8 @@ from AccessControl import ClassSecurityInfo
from DateTime import DateTime
from string import capitalize
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type import Permissions, PropertySheet
from erp5.component.interface.IImmobilisationItem import IImmobilisationItem
from Products.ERP5Type.DateUtils import addToDate, getClosestDate, roundDate
from Products.ERP5Type.DateUtils import getRoundedMonthBetween, millis
from Products.ERP5Type.DateUtils import getAccountableYearFraction
......@@ -78,7 +79,7 @@ class ImmobilisableItem(Item, Amount):
, PropertySheet.Amortisation
)
zope.interface.implements(interfaces.IImmobilisationItem)
zope.interface.implements(IImmobilisationItem)
# IExpandableItem interface implementation
def getSimulationMovementSimulationState(self, simulation_movement):
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>IImmobilisationItem</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.immobilisation_item</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.IImmobilisationItem</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</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>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
document.erp5.ImmobilisableItem
\ No newline at end of file
interface.erp5.IImmobilisationItem
\ No newline at end of file
......@@ -28,10 +28,8 @@
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.Document.ImmobilisableItem import ImmobilisationValidityError
class ImmobilisationDelivery(XMLObject):
"""
......@@ -68,6 +66,7 @@ class ImmobilisationDelivery(XMLObject):
an invalid state
"""
if self.getImmobilisationState() == 'calculating':
from erp5.component.document.ImmobilisableItem import ImmobilisationValidityError
try:
if self.isValidImmobilisationMovement(**kw):
self.validateImmobilisation()
......@@ -116,11 +115,12 @@ class ImmobilisationDelivery(XMLObject):
"""
Return the list of each next immobilisation movement for each aggregated item
"""
from erp5.component.interface.IImmobilisationItem import IImmobilisationItem
returned_list = []
sub_movement_list = self.contentValues()
for movement in self.getImmobilisationMovementList(**kw):
for item in movement.getAggregateValueList():
if interfaces.IImmobilisationItem.providedBy(item):
if IImmobilisationItem.providedBy(item):
future_movement_list = item.getFutureImmobilisationMovementValueList(
at_date = self.getStopDate(),
from_movement = self,
......
......@@ -28,7 +28,7 @@
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.Document.Movement import Movement
......@@ -97,6 +97,8 @@ class ImmobilisationMovement(Movement, XMLObject):
"""
If to_translate is set, the method may return a dictionary {'msg':'...', 'mapping':{} }
"""
from erp5.component.interface.IImmobilisationItem import IImmobilisationItem
relative_url = self.getRelativeUrl()
def checkValuesAreNotNone(property_list):
errors = []
......@@ -140,7 +142,7 @@ class ImmobilisationMovement(Movement, XMLObject):
# Check if the date of this movement is unique
date_error = 0
for item in self.getAggregateValueList():
if interfaces.IImmobilisationItem.providedBy(item):
if IImmobilisationItem.providedBy(item):
same_date_list = item.getUnfilteredImmobilisationMovementValueList(
from_date = self.getStopDate(),
to_date = self.getStopDate(),
......@@ -198,7 +200,7 @@ class ImmobilisationMovement(Movement, XMLObject):
return checkPreviousMovementForItem(previous_movement, item)
return checkPreviousMovementForItem(previous_movement, item)
for item in self.getAggregateValueList():
if interfaces.IImmobilisationItem.providedBy(item):
if IImmobilisationItem.providedBy(item):
if not checkPreviousMovementForItem(self,item):
check_uncontinuous = 1
else:
......
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