Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
9e1d8d75
Commit
9e1d8d75
authored
Feb 22, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: test: factorise accountable project creation
parent
4e52f051
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
1 deletion
+46
-1
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
...teItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
+46
-1
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseMixin.py
View file @
9e1d8d75
...
...
@@ -161,11 +161,56 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
function
=
'customer'
).
open
()
def
addProject
(
self
):
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_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
,
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
(),)
)
sale_trade_condition
.
validate
()
# XXX Is it a good idea to have a cross relation?
project
.
edit
(
specialise_value
=
sale_trade_condition
)
project
.
validate
()
return
project
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment