Commit ec2c2b36 authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5:

* add hardcoded test to expand an open order
* no need to use hardcoded organisation...
  too check the bank account obj
parent 92bc5b08
......@@ -154,6 +154,106 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
self.stepcheckERP5Consistency()
# after accept, an email is send containing the reset link
last_message = self.portal.MailHost._last_message
assert last_message is None, last_message
def test_open_order_scenario(self):
# create a default project
project = self.addProject()
person = self.portal.person_module.newContent(
portal_type="Person",
default_email_coordinate_text='a@example.org',
)
organisation = self.portal.organisation_module.newContent(
portal_type="Organisation"
)
sale_trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
reference='slapos_ultimate_trade_condition',
# XXX hardcoded
specialise="business_process_module/slapos_ultimate_business_process"
)
sale_trade_condition.newContent(
portal_type="Trade Model Line",
reference="VAT",
resource="service_module/slapos_tax",
base_application="base_amount/invoicing/taxable",
trade_phase="slapos/tax",
price=0.2,
quantity=1.0,
membership_criterion_base_category=('price_currency',),
membership_criterion_category=('price_currency/currency_module/EUR',)
)
sale_trade_condition.validate()
for _ in range(1):
hosting_subscription = self.portal.hosting_subscription_module.newContent(
portal_type="Hosting Subscription",
# XXX hardcoded
ledger="automated",
)
hosting_subscription.validate()
start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate()
# create open order
open_sale_order = self.portal.open_sale_order_module.newContent(
portal_type="Open Sale Order",
ledger=hosting_subscription.getLedger(),
destination_project_value=project,
source_value=organisation,
source_section_value=organisation,
destination_value=person,
destination_section_value=person,
destination_decision_value=person,
price_currency='currency_module/EUR',
payment_mode="payzen",
start_date=start_date,
# Ensure stop date value is higher than start date
# it will be updated by OpenSaleOrder_updatePeriod
stop_date=start_date + 1,
specialise_value=sale_trade_condition
)
open_sale_order.newContent(
portal_type="Open Sale Order Line",
quantity=10,
price=2,
resource='service_module/slapos_virtual_master_subscription',
aggregate_value=[
hosting_subscription,
project
]
)
open_sale_order.order()
open_sale_order.validate()
self.tic()
# XXX Do this for every scenario tests
self.logout()
for _ in range(20):
self.stepCallAlarmList()
self.tic()
self.login()
# Ensure no unexpected object has been created
# destination project:
# 1 open order
# 2 accounting transaction
# 1 packing list
# 7 simulation mvt
# aggregate:
# 1 invoice line
# 1 packing list line
# 1 open order line
related_object_list = project.Base_getRelatedObjectList(**{'category.category_strict_membership': 1})
assert len(related_object_list) == 14, [x.getRelativeUrl() for x in related_object_list]
self.stepcheckERP5Consistency()
# after accept, an email is send containing the reset link
last_message = self.portal.MailHost._last_message
assert last_message is None, last_message
\ 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