Commit db2989ce authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: XXX open order template does not exist anymore

slapos_cloud: XXX open order template does not exist anymore

slapos_accounting: XXX do not use open order template to create open order

slapos_accounting: XXX stop using open order template

slapos_cloud: xxx stop using hardcoded open order template

slapos_accounting: do not use template
parent 56c3b790
......@@ -161,3 +161,4 @@ if instance_tree.getCausalityState() == 'diverged':
# Person_storeOpenSaleOrderJournal should fix all divergent Instance Tree in one run
assert instance_tree.getCausalityState() == 'solved'
return open_order
......@@ -174,6 +174,7 @@ class TestInstanceTree_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
self.assertEqual("validated",
hosting_subscription.getValidationState())
self.assertEqual(subscription.getRelativeUrl(), line.getAggregateList()[1])
"""
open_sale_order_line_template = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredOpenSaleOrderLineTemplate())
self.assertEqual(open_sale_order_line_template.getResource(),
......@@ -184,6 +185,7 @@ class TestInstanceTree_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
line.getQuantity())
self.assertEqual(open_sale_order_line_template.getPrice(),
line.getPrice())
"""
self.assertEqual(DateTime().earliestTime(), line.getStartDate())
self.assertEqual(min(DateTime().day(), 28),
hosting_subscription.getPeriodicityMonthDay())
......@@ -241,6 +243,7 @@ class TestInstanceTree_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
self.assertEqual("validated",
hosting_subscription.getValidationState())
self.assertEqual(subscription.getRelativeUrl(), line.getAggregateList()[1])
"""
open_sale_order_line_template = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredOpenSaleOrderLineTemplate())
self.assertTrue(all([q in line.getCategoryList() \
......@@ -251,6 +254,7 @@ class TestInstanceTree_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
line.getQuantity())
self.assertEqual(open_sale_order_line_template.getPrice(),
line.getPrice())
"""
self.assertEqual(DateTime().earliestTime(), line.getStartDate())
self.assertEqual(min(DateTime().day(), 28),
hosting_subscription.getPeriodicityMonthDay())
......@@ -305,6 +309,7 @@ class TestInstanceTree_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
self.assertEqual(subscription.getRelativeUrl(),
archived_line.getAggregateList()[1])
"""
self.assertTrue(all([q in archived_line.getCategoryList() \
for q in open_sale_order_line_template.getCategoryList()]))
self.assertEqual(open_sale_order_line_template.getResource(),
......@@ -313,6 +318,7 @@ class TestInstanceTree_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
line.getQuantity())
self.assertEqual(open_sale_order_line_template.getPrice(),
line.getPrice())
"""
self.assertEqual(DateTime().earliestTime(), archived_line.getStartDate())
self.assertEqual(DateTime('2112/02/02'), line.getStopDate())
......@@ -407,6 +413,7 @@ class TestInstanceTree_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
self.assertEqual("validated",
line.getAggregateValueList()[0].getValidationState())
self.assertEqual(subscription.getRelativeUrl(), line.getAggregateList()[1])
"""
open_sale_order_line_template = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredOpenSaleOrderLineTemplate())
self.assertTrue(all([q in line.getCategoryList() \
......@@ -417,7 +424,7 @@ class TestInstanceTree_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
line.getQuantity())
self.assertEqual(open_sale_order_line_template.getPrice(),
line.getPrice())
"""
subscription2 = self.portal.instance_tree_module\
.template_instance_tree.Base_createCloneDocument(batch_mode=1)
subscription2.edit(reference='TESTHS-%s' % self.generateNewId(),
......@@ -462,20 +469,20 @@ class TestInstanceTree_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
portal_type='Open Sale Order Line')
self.assertEqual(1, len(validated_line_list))
validated_line_2 = validated_line_list[0]
validated_line_1 = line
#validated_line_1 = line
"""
self.assertEqual(open_sale_order_line_template.getQuantity(),
line.getQuantity())
self.assertEqual(open_sale_order_line_template.getPrice(),
line.getPrice())
"""
hosting_subscription_2 = validated_line_2.getAggregateValueList()[0]
self.assertEqual("Hosting Subscription",
hosting_subscription_2.getPortalType())
self.assertEqual("validated",
hosting_subscription_2.getValidationState())
self.assertEqual(subscription2.getRelativeUrl(), validated_line_2.getAggregateList()[1])
"""
self.assertTrue(all([q in validated_line_1.getCategoryList() \
for q in open_sale_order_line_template.getCategoryList()]))
self.assertEqual(open_sale_order_line_template.getResource(),
......@@ -484,9 +491,10 @@ class TestInstanceTree_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
line.getQuantity())
self.assertEqual(open_sale_order_line_template.getPrice(),
line.getPrice())
"""
#self.assertEqual(request_time, validated_line_1.getStartDate())
#self.assertEqual(stop_date, validated_line_1.getStopDate())
"""
self.assertTrue(all([q in validated_line_2.getCategoryList() \
for q in open_sale_order_line_template.getCategoryList()]))
self.assertEqual(open_sale_order_line_template.getResource(),
......@@ -495,6 +503,7 @@ class TestInstanceTree_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
line.getQuantity())
self.assertEqual(open_sale_order_line_template.getPrice(),
line.getPrice())
"""
#self.assertEqual(request_time_2, validated_line_2.getStartDate())
#self.assertEqual(stop_date_2, validated_line_2.getStopDate())
......@@ -1122,7 +1131,8 @@ class TestSlapOSUpdateOpenSaleOrderPeriod(SlapOSTestCaseMixin):
def createOpenOrder(self):
open_order = self.portal.open_sale_order_module\
.slapos_accounting_open_sale_order_template.Base_createCloneDocument(batch_mode=1)
.newContent()
# .slapos_accounting_open_sale_order_template.Base_createCloneDocument(batch_mode=1)
open_order.edit(
title=self.generateNewSoftwareTitle(),
reference="TESTHS-%s" % self.generateNewId(),
......@@ -1201,8 +1211,9 @@ class TestSlapOSReindexOpenSaleOrder(SlapOSTestCaseMixin):
def createOpenOrder(self):
open_order = self.portal.open_sale_order_module\
.slapos_accounting_open_sale_order_template.\
Base_createCloneDocument(batch_mode=1)
.newContent()
# .slapos_accounting_open_sale_order_template.\
# Base_createCloneDocument(batch_mode=1)
open_order.edit(
title=self.generateNewSoftwareTitle(),
reference="TESTHS-%s" % self.generateNewId(),
......
......@@ -421,11 +421,13 @@ class TestHostingSubscriptionSimulation(SlapOSTestCaseMixin):
def _prepare(self):
person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1)
self.subscription = self.portal.hosting_subscription_module.newContent()
#self.subscription = self.portal.hosting_subscription_module.newContent()
self.instance_tree = self.portal.instance_tree_module\
.template_instance_tree.Base_createCloneDocument(batch_mode=1)
self.instance_tree.edit(destination_section=person.getRelativeUrl())
self.initial_date = DateTime('2011/02/16')
stop_date = DateTime('2011/04/16')
"""
self.subscription.edit(
periodicity_hour=0,
periodicity_minute=0,
......@@ -433,21 +435,26 @@ class TestHostingSubscriptionSimulation(SlapOSTestCaseMixin):
destination_section=person.getRelativeUrl()
)
self.portal.portal_workflow._jumpToStateFor(self.subscription, 'validated')
"""
self.portal.portal_workflow._jumpToStateFor(self.instance_tree, 'validated')
open_order = self.instance_tree.InstanceTree_requestUpdateOpenSaleOrder()
"""
open_sale_order_template = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredOpenSaleOrderTemplate())
open_sale_order_line_template = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredOpenSaleOrderLineTemplate())
open_order = open_sale_order_template.Base_createCloneDocument(
batch_mode=1)
"""
open_order.edit(
destination_decision=person.getRelativeUrl(),
destination_section=person.getRelativeUrl(),
destination=person.getRelativeUrl(),
#destination_decision=person.getRelativeUrl(),
#destination_section=person.getRelativeUrl(),
#destination=person.getRelativeUrl(),
effective_date=self.initial_date,
expiration_date=self.initial_date + 1,
)
"""
self.portal.portal_workflow._jumpToStateFor(open_order, 'validated')
self.open_order_line = open_sale_order_line_template.Base_createCloneDocument(
......@@ -457,6 +464,20 @@ class TestHostingSubscriptionSimulation(SlapOSTestCaseMixin):
start_date=self.initial_date,
stop_date=stop_date
)
"""
self.open_order_line = open_order.contentValues(portal_type="Open Sale Order Line")[0]
self.open_order_line.edit(
#aggregate=self.subscription.getRelativeUrl(),
start_date=self.initial_date,
stop_date=stop_date
)
self.subscription = self.open_order_line.getAggregateValue(portal_type="Hosting Subscription")
self.subscription.edit(
periodicity_hour=0,
periodicity_minute=0,
periodicity_month_day=self.initial_date.day(),
# destination_section=person.getRelativeUrl()
)
self.tic()
applied_rule_list = self.portal.portal_catalog(portal_type='Applied Rule',
......
......@@ -705,10 +705,10 @@ return %s""" % (script_name, fake_return ))
'accounting_module/slapos_pre_payment_template',
preferred_instance_delivery_template=\
'sale_packing_list_module/slapos_accounting_instance_delivery_template',
preferred_open_sale_order_line_template=\
'open_sale_order_module/slapos_accounting_open_sale_order_line_template/slapos_accounting_open_sale_order_line_template',
preferred_open_sale_order_template=\
'open_sale_order_module/slapos_accounting_open_sale_order_template',
#preferred_open_sale_order_line_template=\
# 'open_sale_order_module/slapos_accounting_open_sale_order_line_template/slapos_accounting_open_sale_order_line_template',
#preferred_open_sale_order_template=\
# 'open_sale_order_module/slapos_accounting_open_sale_order_template',
preferred_zh_pre_payment_template=\
'accounting_module/slapos_wechat_pre_payment_template',
preferred_zh_pre_payment_subscription_invoice_template=\
......@@ -764,6 +764,7 @@ return %s""" % (script_name, fake_return ))
source_value=organisation
)
"""
open_sale_order_module = self.portal.open_sale_order_module
preferred_open_sale_order_template=\
......@@ -773,7 +774,7 @@ return %s""" % (script_name, fake_return ))
source_section_value = organisation,
source_value=organisation
)
"""
system_preference = self.portal.portal_preferences.slapos_default_system_preference
system_preference.edit(
......@@ -785,8 +786,8 @@ return %s""" % (script_name, fake_return ))
preferred_default_pre_payment_subscription_invoice_template.getRelativeUrl(),
preferred_instance_delivery_template=\
preferred_instance_delivery_template.getRelativeUrl(),
preferred_open_sale_order_template=\
preferred_open_sale_order_template.getRelativeUrl()
#preferred_open_sale_order_template=\
# preferred_open_sale_order_template.getRelativeUrl()
)
self.tic()
......@@ -841,7 +842,7 @@ return %s""" % (script_name, fake_return ))
source_section_value=fr_organisation,
source_value=fr_organisation
)
"""
open_sale_order_module = self.portal.open_sale_order_module
preferred_open_sale_order_template=\
......@@ -851,7 +852,7 @@ return %s""" % (script_name, fake_return ))
source_section_value=fr_organisation,
source_value=fr_organisation
)
"""
system_preference = self.portal.portal_preferences.slapos_default_system_preference
system_preference.edit(
......@@ -863,8 +864,8 @@ return %s""" % (script_name, fake_return ))
preferred_default_pre_payment_subscription_invoice_template.getRelativeUrl(),
preferred_instance_delivery_template=\
preferred_instance_delivery_template.getRelativeUrl(),
preferred_open_sale_order_template=\
preferred_open_sale_order_template.getRelativeUrl()
#preferred_open_sale_order_template=\
# preferred_open_sale_order_template.getRelativeUrl()
)
self.tic()
......
......@@ -1638,12 +1638,12 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
# Disable on this test the pricing on the template to not generate debt before
# them expected
line = self.portal.open_sale_order_module.\
slapos_accounting_open_sale_order_line_template.\
slapos_accounting_open_sale_order_line_template
#line = self.portal.open_sale_order_module.\
# slapos_accounting_open_sale_order_line_template.\
# slapos_accounting_open_sale_order_line_template
previous_price = line.getPrice()
line.setPrice(0.0)
#previous_price = line.getPrice()
#line.setPrice(0.0)
try:
self.login(self.normal_user.getUserId())
......@@ -1675,7 +1675,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
default_email_text, self.subscription_server
)
finally:
line.setPrice(previous_price)
#line.setPrice(previous_price)
pass
return default_email_text, name
......
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