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
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
84bc00b2
Commit
84bc00b2
authored
Dec 23, 2013
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[slapos_accounting] Add test for Invoice Root Simulation Rule
parent
007371d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
1 deletion
+76
-1
master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingRule.py
...s_accounting/TestTemplateItem/testSlapOSAccountingRule.py
+75
-0
master/bt5/slapos_accounting/bt/revision
master/bt5/slapos_accounting/bt/revision
+1
-1
No files found.
master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingRule.py
View file @
84bc00b2
...
...
@@ -158,6 +158,81 @@ class TestDefaultInvoiceTransactionRule(testSlapOSMixin):
SimulationMovement
.
getSimulationState
=
SimulationMovement
\
.
original_getSimulationState
class
TestDefaultInvoiceRule
(
testSlapOSMixin
):
@
withAbort
def
test_simulation
(
self
):
SimulationMovement
.
original_getSimulationState
=
SimulationMovement
\
.
getSimulationState
try
:
SimulationMovement
.
getSimulationState
=
getSimulationStatePlanned
source
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
destination
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
resource
=
self
.
portal
.
service_module
.
slapos_account_validation
start_date
=
DateTime
(
'2011/02/16'
)
stop_date
=
DateTime
(
'2011/02/16'
)
root_applied_rule
=
self
.
portal
.
portal_simulation
.
newContent
(
specialise_value
=
self
.
portal
.
portal_rules
\
.
slapos_invoice_root_simulation_rule
,
portal_type
=
'Applied Rule'
)
root_simulation_movement
=
root_applied_rule
.
newContent
(
id
=
'root_simulation_movement'
,
portal_type
=
'Simulation Movement'
,
price
=
1.67
,
quantity
=
1
,
source_value
=
source
,
source_section_value
=
source
,
destination_value
=
destination
,
destination_section_value
=
destination
,
resource_value
=
resource
,
start_date
=
start_date
,
stop_date
=
stop_date
,
base_contribution_list
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
price_currency
=
'currency_module/EUR'
,
use
=
'trade/sale'
,
trade_phase
=
'slapos/invoicing'
,
quantity_unit
=
'unit/piece'
,
specialise
=
'sale_trade_condition_module/slapos_aggregated_trade_condition'
,
causality_list
=
[
'business_process_module/slapos_aggregated_business_process/invoice_path'
,
'business_process_module/slapos_aggregated_business_process/invoice'
])
self
.
assertEqual
(
'planned'
,
root_simulation_movement
.
getSimulationState
())
root_simulation_movement
.
expand
(
expand_policy
=
'immediate'
)
applied_rule_list
=
root_simulation_movement
.
contentValues
(
portal_type
=
'Applied Rule'
)
# movement in not final state, it shall not be expanded
self
.
assertEqual
(
0
,
len
(
applied_rule_list
))
# movement is in final state, it shall be expanded
SimulationMovement
.
getSimulationState
=
getSimulationStatePlannedDelivered
self
.
assertEqual
(
'delivered'
,
root_simulation_movement
.
getSimulationState
())
root_simulation_movement
.
expand
(
expand_policy
=
'immediate'
)
applied_rule_list
=
root_simulation_movement
.
contentValues
(
portal_type
=
'Applied Rule'
)
self
.
assertEqual
(
2
,
len
(
applied_rule_list
))
SimulationMovement
.
getSimulationState
=
getSimulationStateDelivered
root_simulation_movement
.
expand
(
expand_policy
=
'immediate'
)
child_applied_rule_type_list
=
[
q
.
getSpecialiseReference
()
for
q
in
\
root_simulation_movement
.
contentValues
(
portal_type
=
'Applied Rule'
)]
self
.
assertSameSet
(
[
'default_invoice_transaction_rule'
,
'default_trade_model_rule'
],
child_applied_rule_type_list
)
finally
:
SimulationMovement
.
getSimulationState
=
SimulationMovement
\
.
original_getSimulationState
class
TestDefaultInvoicingRule
(
testSlapOSMixin
):
@
withAbort
def
test_simulation
(
self
):
...
...
master/bt5/slapos_accounting/bt/revision
View file @
84bc00b2
263
\ No newline at end of file
264
\ 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