Commit 8c66c72a authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: erp5_immobilisation: Migrate Documents and Unit Test from filesystem.

parent 38cc3c27
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Document Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>Immobilisation</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Document.Immobilisation</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.Immobilisation</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Document 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>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Document Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ImmobilisationLine</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Document.ImmobilisationLine</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.ImmobilisationLine</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Document 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>
......@@ -164,7 +164,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
assignment.open()
person.validate()
def updateRoleMappings(self, portal_type_list=[]):
def updateRoleMappings(self, portal_type_list=()):
"""
Update the local roles in existing objects.
"""
......@@ -172,7 +172,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
for portal_type in portal_type_list:
for brain in portal_catalog(portal_type = portal_type):
obj = brain.getObject()
userdb_path, user_id = obj.getOwnerTuple()
_, user_id = obj.getOwnerTuple()
obj.updateLocalRolesOnSecurityGroups(user_name = user_id)
#obj.assignRoleToSecurityGroup(user_name = user_id)
......@@ -188,26 +188,6 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.createCategories()
#Assert default security Value
list_module = [ 'Inventory Module',
'Purchase Packing List Module',
'Internal Packing List Module',
'Sale Packing List Module',
'Building Module',
'Incorporeal Item Module',
'Reevaluation Module',
'Restoration Module',
self.getAccountingModule().getPortalType(),
self.getOrganisationModule().getPortalType(),
self.getItemModule().getPortalType(),
self.getPackingListModule().getPortalType(),
self.getInventoryModule().getPortalType(),
self.getAccountModule().getPortalType(),
self.getCurrencyModule().getPortalType(),
self.getPersonModule().getPortalType()
]
# Then add new components
self.createCurrency()
self.createOrganisationList()
......@@ -403,17 +383,17 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
def stepCreatePackingList(self, sequence=None, sequence_list=None, **kw):
property_dict = {}
for property in ('source_section','destination_section','datetime','destination'):
value_list = sequence.get(property)
for property_ in ('source_section','destination_section','datetime','destination'):
value_list = sequence.get(property_)
if value_list is not None:
if type(value_list) == type([]):
if isinstance(value_list, list):
value = value_list[0]
value_list.remove(value)
else:
value = value_list
else:
value = value_list
property_dict[property] = value
property_dict[property_] = value
pl_module = self.getPackingListModule()
pl = pl_module.newContent(portal_type = self.packing_list_portal_type)
pl.edit( source_section_value = property_dict['source_section'],
......@@ -676,7 +656,6 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.stepAggregateItems(sequence=sequence)
self.stepDeliverPackingList(sequence=sequence)
parameter_dict.update( {'amortisation_method':UNIMMOBILISING_METHOD,
'amortisation_start_price':12000,
'amortisation_start_price':0,
'amortisation_duration':48,
'immobilisation_vat':0 })
......@@ -843,9 +822,9 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.stepCreatePackingList(sequence=sequence)
self.stepAggregateItems(sequence=sequence)
self.stepDeliverPackingList(sequence=sequence)
for property in ('amortisation_start_price','amortisation_duration','immobilisation_vat',
'extra_cost_price','disposal_price'):
del parameter_dict[property]
for property_ in ('amortisation_start_price','amortisation_duration','immobilisation_vat',
'extra_cost_price','disposal_price'):
del parameter_dict[property_]
parameter_dict['amortisation_method'] = NO_CHANGE_METHOD
sequence.edit(datetime = DateTime('2001/01/01'),
parameter_dict = parameter_dict,
......@@ -903,11 +882,11 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.stepAggregateItems(sequence=sequence)
self.stepDeliverPackingList(sequence=sequence)
self.tic()
for property in ('amortisation_start_price','amortisation_duration','immobilisation_vat',
'extra_cost_price','disposal_price'):
del parameter_dict[property]
for property in self.account_dict.keys():
del parameter_dict[property]
for property_ in ('amortisation_start_price','amortisation_duration','immobilisation_vat',
'extra_cost_price','disposal_price'):
del parameter_dict[property_]
for property_ in self.account_dict.keys():
del parameter_dict[property_]
parameter_dict.update(self.extra_monthly_dict)
sequence.edit(datetime = DateTime('2002/03/01'),
parameter_dict = parameter_dict,
......@@ -1138,10 +1117,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
c_value = c_period[key]
is_float = 0
try:
if type(c_value) != type(DateTime()):
if isinstance(c_value, DateTime):
c_value=float(c_value)
is_float = 1
except:
except ValueError:
pass
if is_float:
self.assertEqual(round(c_value,2),e_value)
......@@ -2108,10 +2087,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
c_value = getattr(c_movement,key)()
is_float = 0
try:
if type(c_value) != type(DateTime()):
if isinstance(c_value, DateTime):
c_value=float(c_value)
is_float = 1
except:
except ValueError:
pass
if is_float:
wrong_movement = (round(c_value,2) != round(e_value,2))
......@@ -2144,7 +2123,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
#LOG('More expected movements than calculated ! Remaining expected ones are', 0, e_simulation_movement_list)
self.assertEqual(len(e_simulation_movement_list),0)
def _buildExpectedTransaction(self, date, source_section, destination_section, causality_state, causality_list=[]):
def _buildExpectedTransaction(self, date, source_section, destination_section, causality_state, causality_list=None):
self.id_transaction+=1
r_dict = {'id':self.id_transaction,'start_date':DateTime(date), 'stop_date':DateTime(date),
'resource':'currency_module/EUR', 'line_list':[],
......@@ -2154,10 +2133,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
r_dict[name] = None
else:
r_dict[name] = self.getOrganisationModule()[prop]
causality_value_list = []
for causality in causality_list:
causality_value_list.append(self.getItemModule()[causality])
if len(causality_value_list) != 0:
if causality_list is not None:
causality_value_list = []
for causality in causality_list:
causality_value_list.append(self.getItemModule()[causality])
r_dict['causality_value_list'] = causality_value_list
return r_dict
......@@ -2952,14 +2931,14 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
#LOG('c_value : ',0,c_value)
is_float = 0
try:
if type(c_value) != type(DateTime()):
if isinstance(c_value, DateTime):
c_value=float(c_value)
is_float = 1
except:
except ValueError:
pass
if type(c_value) == type([]):
if isinstance(c_value, list):
c_value.sort(key=lambda x: x.getId())
if type(e_value) == type([]):
if isinstance(e_value, list):
e_value.sort(key=lambda x: x.getId())
if is_float:
wrong_transaction = (round(c_value,2) != round(e_value,2))
......@@ -2997,10 +2976,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
c_value = getattr(c_line,key)()
is_float = 0
try:
if type(c_value) != type(DateTime()):
if isinstance(c_value, DateTime):
c_value=float(c_value)
is_float = 1
except:
except ValueError:
pass
if is_float:
wrong_line = (round(c_value,2) != round(e_value,2))
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testImmobilisation</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testImmobilisation</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testImmobilisation</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test 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
document.erp5.AmortisationRule
document.erp5.ImmobilisableItem
document.erp5.Immobilisation
document.erp5.ImmobilisationLine
\ No newline at end of file
test.erp5.testImmobilisation
\ 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