Commit 3f8ba168 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: WIP selling virtual master to customer

parent e3699adc
...@@ -226,7 +226,7 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster ...@@ -226,7 +226,7 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster
self.tic() self.tic()
return web_site, now, currency, sale_person, seller_organisation return web_site, now, currency, sale_person, seller_organisation, internal_trade_condition
def checkSiteConsistency(self): def checkSiteConsistency(self):
self.logout() self.logout()
...@@ -339,12 +339,13 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster ...@@ -339,12 +339,13 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster
start_date=now, start_date=now,
effective_date=now, effective_date=now,
resource_value=service, resource_value=service,
quantity_unit_value=open_order_line.getQuantityUnitValue(), quantity_unit=open_order_line.getQuantityUnit(),
quantity=1,
ledger="automated", ledger="automated",
specialise_value=open_sale_order.getSpecialiseValue(), specialise_value=open_sale_order.getSpecialiseValue(),
destination_value=open_sale_order.getSourceValue(), destination=open_sale_order.getSource(),
destination_section_value=open_sale_order.getSourceSectionValue(), destination_section=open_sale_order.getSourceSection(),
price_currency_value=open_sale_order.getPriceCurrencyValue(), price_currency=open_sale_order.getPriceCurrency(),
price=open_order_line.getPrice() price=open_order_line.getPrice()
) )
""" """
...@@ -530,14 +531,14 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster ...@@ -530,14 +531,14 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster
return subscription_request return subscription_request
def test_virtual_master_sale_subscribe_to_project(self): def test_virtual_master_sale_subscribe_to_project(self):
_, now, _, sale_person, _ = self.bootstrapSubscriptionRequestScenario() _, now, _, sale_person, _, _ = self.bootstrapSubscriptionRequestScenario()
self.tic() self.tic()
self.checkVirtualMasterSubscription(sale_person, now) self.checkVirtualMasterSubscription(sale_person, now)
self.checkSiteConsistency() self.checkSiteConsistency()
def test_virtual_master_customer_subscribe_to_project(self): def test_virtual_master_customer_subscribe_to_project(self):
web_site, now, _, sale_person, _ = self.bootstrapSubscriptionRequestScenario() web_site, now, _, sale_person, _, internal_trade_condition = self.bootstrapSubscriptionRequestScenario()
self.tic() self.tic()
main_project_subscription = self.checkVirtualMasterSubscription(sale_person, now) main_project_subscription = self.checkVirtualMasterSubscription(sale_person, now)
...@@ -557,24 +558,27 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster ...@@ -557,24 +558,27 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster
] ]
) )
""" #################################
sale_person.setCareerSubordinationValue(seller_organisation) # Buy the first project
internal_trade_condition = self.portal.sale_trade_condition_module.newContent( customer_person = self.createCustomer(web_site)
self.logout()
self.login(sale_person.getUserId())
user_trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition", portal_type="Sale Trade Condition",
reference='internal_for_%s' % seller_organisation.getTitle(), reference='user_for_%s' % customer_person.getTitle(),
# XXX hardcoded # XXX hardcoded
specialise="business_process_module/slapos_ultimate_business_process", specialise_value=internal_trade_condition,
source_value=seller_organisation, #source_value=seller_organisation,
source_section_value=seller_organisation, #source_section_value=seller_organisation,
destination_section_value=seller_organisation, destination_value=customer_person,
destination_section_value=customer_person,
effective_date=now.earliestTime(), effective_date=now.earliestTime(),
price_currency_value=currency #price_currency_value=currency
) )
internal_trade_condition.validate() user_trade_condition.validate()
""" self.tic()
#################################
# Buy the first project
customer_person = self.createCustomer(web_site)
self.logout() self.logout()
self.login(customer_person.getUserId()) self.login(customer_person.getUserId())
self.checkVirtualMasterSubscription(customer_person, now) self.checkVirtualMasterSubscription(customer_person, now)
......
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