Commit 72b8067f authored by Arnaud Fontaine's avatar Arnaud Fontaine

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

parent eaa9dd75
<?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>
...@@ -72,28 +72,6 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -72,28 +72,6 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
""" """
self.commit() self.commit()
def getBusinessTemplateList(self):
"""
Return the list of business templates.
"""
return ("erp5_core_proxy_field_legacy",
"erp5_base",
"erp5_pdm",# Needed by accounting
"erp5_simulation",
"erp5_trade",
"erp5_accounting",
"erp5_invoicing",
"erp5_simplified_invoicing",
"erp5_immobilisation",
"erp5_computer_immobilisation", # In order to use items
'erp5_configurator_standard_trade_template',
'erp5_configurator_standard_accounting_template',
'erp5_configurator_standard_invoicing_template',
"erp5_simulation_test",
"erp5_movement_table_catalog" # ImmobilisationItem.py uses movement table
)
def getRuleTool(self): def getRuleTool(self):
return getattr(self.getPortal(), 'portal_rules', None) return getattr(self.getPortal(), 'portal_rules', None)
def getAccountingModule(self): def getAccountingModule(self):
...@@ -164,7 +142,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -164,7 +142,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
assignment.open() assignment.open()
person.validate() person.validate()
def updateRoleMappings(self, portal_type_list=[]): def updateRoleMappings(self, portal_type_list=()):
""" """
Update the local roles in existing objects. Update the local roles in existing objects.
""" """
...@@ -172,7 +150,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -172,7 +150,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
for portal_type in portal_type_list: for portal_type in portal_type_list:
for brain in portal_catalog(portal_type = portal_type): for brain in portal_catalog(portal_type = portal_type):
obj = brain.getObject() obj = brain.getObject()
userdb_path, user_id = obj.getOwnerTuple() _, user_id = obj.getOwnerTuple()
obj.updateLocalRolesOnSecurityGroups(user_name = user_id) obj.updateLocalRolesOnSecurityGroups(user_name = user_id)
#obj.assignRoleToSecurityGroup(user_name = user_id) #obj.assignRoleToSecurityGroup(user_name = user_id)
...@@ -188,26 +166,6 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -188,26 +166,6 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.createCategories() 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 # Then add new components
self.createCurrency() self.createCurrency()
self.createOrganisationList() self.createOrganisationList()
...@@ -403,17 +361,17 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -403,17 +361,17 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
def stepCreatePackingList(self, sequence=None, sequence_list=None, **kw): def stepCreatePackingList(self, sequence=None, sequence_list=None, **kw):
property_dict = {} property_dict = {}
for property in ('source_section','destination_section','datetime','destination'): for property_ in ('source_section','destination_section','datetime','destination'):
value_list = sequence.get(property) value_list = sequence.get(property_)
if value_list is not None: if value_list is not None:
if type(value_list) == type([]): if isinstance(value_list, list):
value = value_list[0] value = value_list[0]
value_list.remove(value) value_list.remove(value)
else: else:
value = value_list value = value_list
else: else:
value = value_list value = value_list
property_dict[property] = value property_dict[property_] = value
pl_module = self.getPackingListModule() pl_module = self.getPackingListModule()
pl = pl_module.newContent(portal_type = self.packing_list_portal_type) pl = pl_module.newContent(portal_type = self.packing_list_portal_type)
pl.edit( source_section_value = property_dict['source_section'], pl.edit( source_section_value = property_dict['source_section'],
...@@ -843,9 +801,9 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -843,9 +801,9 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.stepCreatePackingList(sequence=sequence) self.stepCreatePackingList(sequence=sequence)
self.stepAggregateItems(sequence=sequence) self.stepAggregateItems(sequence=sequence)
self.stepDeliverPackingList(sequence=sequence) self.stepDeliverPackingList(sequence=sequence)
for property in ('amortisation_start_price','amortisation_duration','immobilisation_vat', for property_ in ('amortisation_start_price','amortisation_duration','immobilisation_vat',
'extra_cost_price','disposal_price'): 'extra_cost_price','disposal_price'):
del parameter_dict[property] del parameter_dict[property_]
parameter_dict['amortisation_method'] = NO_CHANGE_METHOD parameter_dict['amortisation_method'] = NO_CHANGE_METHOD
sequence.edit(datetime = DateTime('2001/01/01'), sequence.edit(datetime = DateTime('2001/01/01'),
parameter_dict = parameter_dict, parameter_dict = parameter_dict,
...@@ -903,11 +861,11 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -903,11 +861,11 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.stepAggregateItems(sequence=sequence) self.stepAggregateItems(sequence=sequence)
self.stepDeliverPackingList(sequence=sequence) self.stepDeliverPackingList(sequence=sequence)
self.tic() self.tic()
for property in ('amortisation_start_price','amortisation_duration','immobilisation_vat', for property_ in ('amortisation_start_price','amortisation_duration','immobilisation_vat',
'extra_cost_price','disposal_price'): 'extra_cost_price','disposal_price'):
del parameter_dict[property] del parameter_dict[property_]
for property in self.account_dict.keys(): for property_ in self.account_dict.keys():
del parameter_dict[property] del parameter_dict[property_]
parameter_dict.update(self.extra_monthly_dict) parameter_dict.update(self.extra_monthly_dict)
sequence.edit(datetime = DateTime('2002/03/01'), sequence.edit(datetime = DateTime('2002/03/01'),
parameter_dict = parameter_dict, parameter_dict = parameter_dict,
...@@ -1138,10 +1096,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -1138,10 +1096,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
c_value = c_period[key] c_value = c_period[key]
is_float = 0 is_float = 0
try: try:
if type(c_value) != type(DateTime()): if not isinstance(c_value, DateTime):
c_value=float(c_value) c_value=float(c_value)
is_float = 1 is_float = 1
except: except Exception:
pass pass
if is_float: if is_float:
self.assertEqual(round(c_value,2),e_value) self.assertEqual(round(c_value,2),e_value)
...@@ -2108,10 +2066,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -2108,10 +2066,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
c_value = getattr(c_movement,key)() c_value = getattr(c_movement,key)()
is_float = 0 is_float = 0
try: try:
if type(c_value) != type(DateTime()): if not isinstance(c_value, DateTime):
c_value=float(c_value) c_value=float(c_value)
is_float = 1 is_float = 1
except: except Exception:
pass pass
if is_float: if is_float:
wrong_movement = (round(c_value,2) != round(e_value,2)) wrong_movement = (round(c_value,2) != round(e_value,2))
...@@ -2144,7 +2102,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -2144,7 +2102,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
#LOG('More expected movements than calculated ! Remaining expected ones are', 0, e_simulation_movement_list) #LOG('More expected movements than calculated ! Remaining expected ones are', 0, e_simulation_movement_list)
self.assertEqual(len(e_simulation_movement_list),0) 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):
self.id_transaction+=1 self.id_transaction+=1
r_dict = {'id':self.id_transaction,'start_date':DateTime(date), 'stop_date':DateTime(date), r_dict = {'id':self.id_transaction,'start_date':DateTime(date), 'stop_date':DateTime(date),
'resource':'currency_module/EUR', 'line_list':[], 'resource':'currency_module/EUR', 'line_list':[],
...@@ -2952,14 +2910,14 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -2952,14 +2910,14 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
#LOG('c_value : ',0,c_value) #LOG('c_value : ',0,c_value)
is_float = 0 is_float = 0
try: try:
if type(c_value) != type(DateTime()): if not isinstance(c_value, DateTime):
c_value=float(c_value) c_value=float(c_value)
is_float = 1 is_float = 1
except: except Exception:
pass pass
if type(c_value) == type([]): if isinstance(c_value, list):
c_value.sort(key=lambda x: x.getId()) 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()) e_value.sort(key=lambda x: x.getId())
if is_float: if is_float:
wrong_transaction = (round(c_value,2) != round(e_value,2)) wrong_transaction = (round(c_value,2) != round(e_value,2))
...@@ -2997,10 +2955,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase): ...@@ -2997,10 +2955,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
c_value = getattr(c_line,key)() c_value = getattr(c_line,key)()
is_float = 0 is_float = 0
try: try:
if type(c_value) != type(DateTime()): if not isinstance(c_value, DateTime):
c_value=float(c_value) c_value=float(c_value)
is_float = 1 is_float = 1
except: except Exception:
pass pass
if is_float: if is_float:
wrong_line = (round(c_value,2) != round(e_value,2)) 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 document.erp5.AmortisationRule
\ No newline at end of file document.erp5.ImmobilisableItem
document.erp5.Immobilisation
document.erp5.ImmobilisationLine
\ No newline at end of file
test.erp5.testImmobilisation
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_core_proxy_field_legacy
erp5_base
erp5_pdm
erp5_simulation
erp5_trade
erp5_accounting
erp5_invoicing
erp5_simplified_invoicing
erp5_immobilisation
erp5_computer_immobilisation
erp5_configurator_standard_trade_template
erp5_configurator_standard_accounting_template
erp5_configurator_standard_invoicing_template
erp5_simulation_test
erp5_movement_table_catalog
\ 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