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
0
Merge Requests
0
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
Jérome Perrin
slapos.core
Commits
8461cb86
Commit
8461cb86
authored
Nov 21, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify the test.
parent
4fa2d2b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
111 deletions
+35
-111
master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingBuilder.py
...ccounting/TestTemplateItem/testSlapOSAccountingBuilder.py
+34
-110
master/bt5/slapos_accounting/bt/revision
master/bt5/slapos_accounting/bt/revision
+1
-1
No files found.
master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingBuilder.py
View file @
8461cb86
...
...
@@ -320,100 +320,13 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
)
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
delivery_kw
=
dict
(
portal_type
=
'Sale Packing List'
,
causality
=
hosting_subscription
.
getRelativeUrl
(),
price_currency
=
'currency_module/EUR'
,
source
=
'organisation_module/slapos'
,
source_section
=
'organisation_module/slapos'
,
specialise
=
'sale_trade_condition_module/slapos_trade_condition'
,
)
delivery_line_kw
=
dict
(
portal_type
=
'Sale Packing List Line'
,
resource
=
'service_module/slapos_instance_subscription'
,
use
=
'trade/sale'
,
quantity_unit
=
'unit/piece'
,
base_contribution_list
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
aggregate
=
hosting_subscription
.
getRelativeUrl
(),
)
delivery_1
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
destination
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
destination_section
=
person
.
getRelativeUrl
(),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
**
delivery_kw
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
delivery_1
,
'delivered'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
delivery_1
,
'calculating'
)
delivery_line_1
=
delivery_1
.
newContent
(
quantity
=
1.2
,
price
=
3.4
,
**
delivery_line_kw
)
delivery_2
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
destination
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
destination_section
=
person
.
getRelativeUrl
(),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
**
delivery_kw
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
delivery_2
,
'delivered'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
delivery_2
,
'calculating'
)
delivery_line_2
=
delivery_2
.
newContent
(
quantity
=
5.6
,
price
=
7.8
,
**
delivery_line_kw
)
simulation_movement_kw
=
dict
(
portal_type
=
'Simulation Movement'
,
aggregate
=
hosting_subscription
.
getRelativeUrl
(),
base_contribution
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
causality
=
[
'business_process_module/slapos_sale_business_process'
'/deliver'
,
'business_process_module/slapos_sale_business_pr'
'ocess/delivery_path'
],
destination
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
destination_section
=
person
.
getRelativeUrl
(),
price_currency
=
'currency_module/EUR'
,
quantity_unit
=
'unit/piece'
,
resource
=
'service_module/slapos_instance_subscription'
,
source
=
'organisation_module/slapos'
,
source_section
=
'organisation_module/slapos'
,
specialise
=
'sale_trade_condition_module/slapos_trade_condition'
,
trade_phase
=
'slapos/delivery'
,
use
=
'trade/sale'
,
delivery_ratio
=
1.0
)
simulation_movement_1
=
applied_rule
.
newContent
(
quantity
=
delivery_line_1
.
getQuantity
(),
price
=
delivery_line_1
.
getPrice
(),
start_date
=
delivery_1
.
getStartDate
(),
stop_date
=
delivery_1
.
getStopDate
(),
delivery
=
delivery_line_1
.
getRelativeUrl
(),
**
simulation_movement_kw
portal_type
=
'Simulation Movement'
)
simulation_movement_2
=
applied_rule
.
newContent
(
quantity
=
delivery_line_2
.
getQuantity
(),
price
=
delivery_line_2
.
getPrice
(),
start_date
=
delivery_2
.
getStartDate
(),
stop_date
=
delivery_2
.
getStopDate
(),
delivery
=
delivery_line_2
.
getRelativeUrl
(),
**
simulation_movement_kw
portal_type
=
'Simulation Movement'
)
self
.
tic
()
delivery_1
.
updateCausalityState
(
solve_automatically
=
False
)
delivery_2
.
updateCausalityState
(
solve_automatically
=
False
)
self
.
tic
()
# test the test
self
.
assertEqual
(
'solved'
,
delivery_1
.
getCausalityState
())
self
.
assertEqual
(
'solved'
,
delivery_2
.
getCausalityState
())
# linked invoice
invoice_kw
=
dict
(
portal_type
=
'Sale Invoice Transaction'
,
...
...
@@ -434,33 +347,31 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
)
invoice_1
=
self
.
portal
.
accounting_module
.
newContent
(
causality
=
delivery_1
.
getRelativeUrl
(),
start_date
=
delivery_1
.
getStartDate
(),
stop_date
=
delivery_1
.
getStopDate
(),
destination
=
delivery_1
.
getDestination
(),
destination_section
=
delivery_1
.
getDestinationSection
(),
destination_decision
=
delivery_1
.
getDestinationDecision
(),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
destination
=
person
.
getRelativeUrl
(),
destination_section
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
**
invoice_kw
)
invoice_line_1
=
invoice_1
.
newContent
(
aggregate
=
delivery_line_1
.
getAggregate
(),
price
=
delivery_line_1
.
getPrice
()
,
quantity
=
delivery_line_1
.
getQuantity
()
,
aggregate
=
hosting_subscription
.
getRelativeUrl
(),
price
=
1.2
,
quantity
=
3.4
,
**
invoice_line_kw
)
invoice_2
=
self
.
portal
.
accounting_module
.
newContent
(
causality
=
delivery_2
.
getRelativeUrl
(),
start_date
=
delivery_2
.
getStartDate
(),
stop_date
=
delivery_2
.
getStopDate
(),
destination
=
delivery_2
.
getDestination
(),
destination_section
=
delivery_2
.
getDestinationSection
(),
destination_decision
=
delivery_2
.
getDestinationDecision
(),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
destination
=
person
.
getRelativeUrl
(),
destination_section
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
**
invoice_kw
)
invoice_line_2
=
invoice_2
.
newContent
(
aggregate
=
delivery_line_2
.
getAggregate
(),
price
=
delivery_line_2
.
getPrice
()
,
quantity
=
delivery_line_2
.
getQuantity
()
,
aggregate
=
hosting_subscription
.
getRelativeUrl
(),
price
=
5.6
,
quantity
=
7.8
,
**
invoice_line_kw
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice_1
,
'confirmed'
)
...
...
@@ -469,15 +380,28 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
invoice_2
,
'calculating'
)
# create new simulation movements
invoice_movement_kw
=
simulation_movement_kw
.
copy
()
invoice_movement_kw
.
update
(
invoice_movement_kw
=
dict
(
causality
=
[
'business_process_module/slapos_sale_business_process/invoice'
,
'business_process_module/slapos_sale_business_process/invoice_path'
],
trade_phase
=
'slapos/invoicing'
,
delivery_ratio
=
1.0
,
delivery_error
=
0.0
delivery_error
=
0.0
,
portal_type
=
'Simulation Movement'
,
aggregate
=
hosting_subscription
.
getRelativeUrl
(),
base_contribution
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
destination
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
destination_section
=
person
.
getRelativeUrl
(),
price_currency
=
'currency_module/EUR'
,
quantity_unit
=
'unit/piece'
,
resource
=
'service_module/slapos_instance_subscription'
,
source
=
'organisation_module/slapos'
,
source_section
=
'organisation_module/slapos'
,
specialise
=
'sale_trade_condition_module/slapos_trade_condition'
,
use
=
'trade/sale'
,
)
invoice_rule_1
=
simulation_movement_1
.
newContent
(
portal_type
=
'Applied Rule'
,
...
...
master/bt5/slapos_accounting/bt/revision
View file @
8461cb86
120
\ No newline at end of file
121
\ No newline at end of file
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