Commit eadb4b9d authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: XXX consumption price must be set to 0

XXX migrate existing packing list
parent 0e02a9b2
...@@ -72,16 +72,9 @@ for movement in movement_list: ...@@ -72,16 +72,9 @@ for movement in movement_list:
specialise=specialise, specialise=specialise,
price_currency=movement.getPriceCurrency(), price_currency=movement.getPriceCurrency(),
start_date=movement.getStartDate(), start_date=movement.getStartDate(),
price=movement.getPrice(0.0),
) )
# XXX Shamefully hardcoded values
if movement.getResource() in ('service_module/slapos_instance_subscription',
'service_module/slapos_reservation_refund'):
temp_movement.edit(price=movement.getPrice(0.0))
else:
temp_movement.edit(price=0.0)
instance_tree = movement.getAggregateValue(portal_type="Instance Tree") instance_tree = movement.getAggregateValue(portal_type="Instance Tree")
if movement.getSpecialiseUid() in consumption_specialise_uid_list: if movement.getSpecialiseUid() in consumption_specialise_uid_list:
......
...@@ -9,8 +9,6 @@ result = [] ...@@ -9,8 +9,6 @@ result = []
if context.getValidationState() in ["cancelled", "shared"]: if context.getValidationState() in ["cancelled", "shared"]:
return return
raise NotImplementedError('Disable')
try: try:
tioxml_dict = document.ComputerConsumptionTioXMLFile_parseXml() tioxml_dict = document.ComputerConsumptionTioXMLFile_parseXml()
except KeyError: except KeyError:
...@@ -113,6 +111,7 @@ else: ...@@ -113,6 +111,7 @@ else:
destination_project=project, destination_project=project,
resource_value=service, resource_value=service,
quantity_unit=service.getQuantityUnit(), quantity_unit=service.getQuantityUnit(),
price=0,
) )
delivery.confirm(comment="Created from %s" % context.getRelativeUrl()) delivery.confirm(comment="Created from %s" % context.getRelativeUrl())
delivery.start() delivery.start()
......
...@@ -378,6 +378,7 @@ class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration( ...@@ -378,6 +378,7 @@ class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration(
self.assertEqual(line.getTitle(), "fooà") self.assertEqual(line.getTitle(), "fooà")
self.assertEqual(line.getQuantity(), 42.42) self.assertEqual(line.getQuantity(), 42.42)
self.assertEqual(line.getPrice(), 0)
self.assertEqual(line.getAggregateList(), [ self.assertEqual(line.getAggregateList(), [
self.compute_node.partition1.getRelativeUrl(), self.compute_node.partition1.getRelativeUrl(),
self.start_requested_software_instance.getRelativeUrl(), self.start_requested_software_instance.getRelativeUrl(),
...@@ -434,6 +435,7 @@ class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration( ...@@ -434,6 +435,7 @@ class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration(
self.assertEqual(line.getTitle(), "fooà") self.assertEqual(line.getTitle(), "fooà")
self.assertEqual(line.getQuantity(), 42.42) self.assertEqual(line.getQuantity(), 42.42)
self.assertEqual(line.getPrice(), 0)
self.assertEqual(line.getAggregateList(), [ self.assertEqual(line.getAggregateList(), [
self.compute_node.partition2.getRelativeUrl(), self.compute_node.partition2.getRelativeUrl(),
self.stop_requested_software_instance.getRelativeUrl(), self.stop_requested_software_instance.getRelativeUrl(),
......
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