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

slapos_cloud: test: create project by doing a subscription request

parent aa264205
......@@ -147,6 +147,18 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
"""Overwrite this function on project context to tweak production focus tests"""
pass
def addAccountingManagerAssignment(self, person):
person.newContent(
portal_type='Assignment',
function='accounting/manager'
).open()
def addSaleManagerAssignment(self, person):
person.newContent(
portal_type='Assignment',
function='sale/manager'
).open()
def addProjectProductionManagerAssignment(self, person, project):
person.newContent(
portal_type='Assignment',
......@@ -161,59 +173,17 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
function='customer'
).open()
def addProject(self, is_accountable=False):
project = self.portal.project_module.newContent(
portal_type='Project',
title='project-%s' % self.generateNewId()
)
if is_accountable:
currency = self.portal.currency_module.newContent(
portal_type="Currency",
reference="test-currency-%s" % self.generateNewId(),
short_title="tc%s" % self.generateNewId(),
base_unit_quantity=0.01
)
currency.validate()
seller_organisation = self.portal.organisation_module.newContent(
portal_type="Organisation",
title="test-seller-%s" % self.generateNewId()
)
seller_bank_account = seller_organisation.newContent(
portal_type="Bank Account",
title="test_bank_account_%s" % self.generateNewId()
)
seller_organisation.validate()
sale_trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
reference='seller_organisation_%s' % seller_organisation.getTitle(),
# XXX hardcoded
specialise="business_process_module/slapos_ultimate_business_process",
destination_project_value=project,
source_value=seller_organisation,
source_section_value=seller_organisation,
source_payment_value=seller_bank_account,
price_currency_value=currency
)
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/%s' % currency.getRelativeUrl(),)
)
def addProject(self, organisation=None, currency=None, person=None, is_accountable=False):
# Action to submit project subscription
service = self.portal.restrictedTraverse('service_module/slapos_virtual_master_subscription')
subscription_request = service.Resource_createSubscriptionRequest(person, None)
self.tic()
sale_trade_condition.validate()
# XXX Is it a good idea to have a cross relation?
project.edit(specialise_value=sale_trade_condition)
self.portal.portal_alarms.slapos_subscription_request_validate_submitted.activeSense()
self.tic()
self.logout()
project.validate()
return project
return subscription_request.getAggregate()
def _addERP5Login(self, document, **kw):
if document.getPortalType() == "Person":
......
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