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
33385367
Commit
33385367
authored
Feb 17, 2023
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: builder test: set ledger and destination_project
Use a test trade condition
parent
6f9abe0a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
155 additions
and
77 deletions
+155
-77
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingBuilder.py
...ortal_components/test.erp5.testSlapOSAccountingBuilder.py
+155
-77
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingBuilder.py
View file @
33385367
...
@@ -8,8 +8,6 @@
...
@@ -8,8 +8,6 @@
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
from
DateTime
import
DateTime
from
DateTime
import
DateTime
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
=
'sale_trade_condition_module/slapos_aggregated_trade_condition_v3'
def
convertCategoryList
(
base
,
l
):
def
convertCategoryList
(
base
,
l
):
return
[
'%s/%s'
%
(
base
,
q
)
for
q
in
l
]
return
[
'%s/%s'
%
(
base
,
q
)
for
q
in
l
]
...
@@ -21,6 +19,27 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
...
@@ -21,6 +19,27 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
title
=
"testSlapOSAccountingBuilder"
title
=
"testSlapOSAccountingBuilder"
).
getRelativeUrl
()
).
getRelativeUrl
()
self
.
slapos_project
=
self
.
addProject
()
self
.
slapos_trade_condition
=
self
.
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
reference
=
'test_trade_condition%s'
%
self
.
generateNewId
(),
# XXX hardcoded
specialise
=
"business_process_module/slapos_ultimate_business_process"
)
self
.
slapos_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.196
,
quantity
=
1.0
,
membership_criterion_base_category
=
(
'price_currency'
,),
membership_criterion_category
=
(
'price_currency/currency_module/EUR'
,)
)
self
.
slapos_trade_condition
.
validate
()
def
checkSimulationMovement
(
self
,
simulation_movement
):
def
checkSimulationMovement
(
self
,
simulation_movement
):
self
.
assertEqual
(
1.0
,
simulation_movement
.
getDeliveryRatio
())
self
.
assertEqual
(
1.0
,
simulation_movement
.
getDeliveryRatio
())
self
.
assertEqual
(
0.0
,
simulation_movement
.
getDeliveryError
())
self
.
assertEqual
(
0.0
,
simulation_movement
.
getDeliveryError
())
...
@@ -69,16 +88,19 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
...
@@ -69,16 +88,19 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
self
.
assertEqual
(
expected_stop_date
,
delivery
.
getStopDate
())
self
.
assertEqual
(
expected_stop_date
,
delivery
.
getStopDate
())
self
.
assertSameSet
([
self
.
assertSameSet
([
'ledger/automated'
,
'source/%s'
%
self
.
expected_slapos_organisation
,
'source/%s'
%
self
.
expected_slapos_organisation
,
'source_section/%s'
%
self
.
expected_slapos_organisation
,
'source_section/%s'
%
self
.
expected_slapos_organisation
,
'price_currency/currency_module/EUR'
,
'price_currency/currency_module/EUR'
,
'specialise/%s'
%
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
]
\
'specialise/%s'
%
self
.
slapos_trade_condition
.
getRelativeUrl
()
]
\
+
convertCategoryList
(
'destination'
,
+
convertCategoryList
(
'destination'
,
simulation_movement
.
getDestinationList
())
\
simulation_movement
.
getDestinationList
())
\
+
convertCategoryList
(
'destination_section'
,
+
convertCategoryList
(
'destination_section'
,
simulation_movement
.
getDestinationSectionList
())
\
simulation_movement
.
getDestinationSectionList
())
\
+
convertCategoryList
(
'destination_decision'
,
+
convertCategoryList
(
'destination_decision'
,
simulation_movement
.
getDestinationDecisionList
())
\
simulation_movement
.
getDestinationDecisionList
())
\
+
convertCategoryList
(
'destination_project'
,
simulation_movement
.
getDestinationProjectList
())
\
+
category_list
,
+
category_list
,
delivery
.
getCategoryList
())
delivery
.
getCategoryList
())
...
@@ -100,15 +122,17 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
...
@@ -100,15 +122,17 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
causality
=
[
'business_process_module/slapos_aggregated_business_process'
causality
=
[
'business_process_module/slapos_aggregated_business_process'
'/deliver'
,
'business_process_module/slapos_sale_business_pr'
'/deliver'
,
'business_process_module/slapos_sale_business_pr'
'ocess/delivery_path'
],
'ocess/delivery_path'
],
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'service_module/slapos_instance_subscription'
,
resource
=
'service_module/slapos_instance_subscription'
,
source
=
self
.
expected_slapos_organisation
,
source
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise_value
=
self
.
slapos_trade_condition
,
ledger
=
'automated'
,
trade_phase
=
'slapos/delivery'
,
trade_phase
=
'slapos/delivery'
,
use
=
'trade/sale'
,
use
=
'trade/sale'
,
)
)
...
@@ -158,6 +182,7 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
...
@@ -158,6 +182,7 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
self
.
checkDelivery
(
simulation_movement_1
,
delivery_1
,
**
delivery_kw
)
self
.
checkDelivery
(
simulation_movement_1
,
delivery_1
,
**
delivery_kw
)
self
.
checkDelivery
(
simulation_movement_2
,
delivery_2
,
**
delivery_kw
)
self
.
checkDelivery
(
simulation_movement_2
,
delivery_2
,
**
delivery_kw
)
class
TestSlapOSSaleInvoiceBuilder
(
TestSlapOSSalePackingListBuilder
):
class
TestSlapOSSaleInvoiceBuilder
(
TestSlapOSSalePackingListBuilder
):
def
test
(
self
,
causality1
=
None
,
causality2
=
None
):
# pylint: disable=arguments-differ
def
test
(
self
,
causality1
=
None
,
causality2
=
None
):
# pylint: disable=arguments-differ
...
@@ -169,7 +194,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -169,7 +194,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
source
=
self
.
expected_slapos_organisation
,
source
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise_value
=
self
.
slapos_trade_condition
,
ledger
=
'automated'
)
)
delivery_line_kw
=
dict
(
delivery_line_kw
=
dict
(
portal_type
=
'Sale Packing List Line'
,
portal_type
=
'Sale Packing List Line'
,
...
@@ -180,9 +206,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -180,9 +206,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
'base_amount/invoicing/taxable'
],
'base_amount/invoicing/taxable'
],
)
)
delivery_1
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
delivery_1
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
start_date
=
DateTime
(
'2012/01/01'
),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
causality_value
=
causality1
,
causality_value
=
causality1
,
...
@@ -215,9 +242,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -215,9 +242,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
# Create second delivery
# Create second delivery
delivery_2
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
delivery_2
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
start_date
=
DateTime
(
'2012/01/01'
),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
causality_value
=
causality2
,
causality_value
=
causality2
,
...
@@ -246,16 +274,18 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -246,16 +274,18 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
causality
=
[
causality
=
[
'business_process_module/slapos_aggregated_business_process/deliver'
,
'business_process_module/slapos_aggregated_business_process/deliver'
,
'business_process_module/slapos_sale_business_process/delivery_path'
],
'business_process_module/slapos_sale_business_process/delivery_path'
],
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'service_module/slapos_instance_subscription'
,
resource
=
'service_module/slapos_instance_subscription'
,
source
=
self
.
expected_slapos_organisation
,
source
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
trade_phase
=
'slapos/delivery'
,
trade_phase
=
'slapos/delivery'
,
ledger
=
'automated'
,
use
=
'trade/sale'
,
use
=
'trade/sale'
,
delivery_ratio
=
1.0
delivery_ratio
=
1.0
)
)
...
@@ -475,7 +505,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -475,7 +505,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
source
=
self
.
expected_slapos_organisation
,
source
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
specialise
_value
=
self
.
slapos_trade_condition
,
)
)
delivery_line_kw
=
dict
(
delivery_line_kw
=
dict
(
portal_type
=
'Sale Packing List Line'
,
portal_type
=
'Sale Packing List Line'
,
...
@@ -486,12 +516,14 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -486,12 +516,14 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
'base_amount/invoicing/taxable'
],
'base_amount/invoicing/taxable'
],
)
)
delivery_1
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
delivery_1
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
start_date
=
DateTime
(
'2012/01/01'
),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
causality_value
=
causality1
,
causality_value
=
causality1
,
ledger
=
'automated'
,
**
delivery_kw
**
delivery_kw
)
)
...
@@ -521,12 +553,14 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -521,12 +553,14 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
# Create second delivery
# Create second delivery
delivery_2
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
delivery_2
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
start_date
=
DateTime
(
'2012/01/01'
),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
causality_value
=
causality2
,
causality_value
=
causality2
,
ledger
=
'automated'
,
**
delivery_kw
**
delivery_kw
)
)
applied_rule_2
=
self
.
portal
.
portal_simulation
.
newContent
(
applied_rule_2
=
self
.
portal
.
portal_simulation
.
newContent
(
...
@@ -552,16 +586,18 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -552,16 +586,18 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
causality
=
[
causality
=
[
'business_process_module/slapos_aggregated_business_process/deliver'
,
'business_process_module/slapos_aggregated_business_process/deliver'
,
'business_process_module/slapos_sale_business_process/delivery_path'
],
'business_process_module/slapos_sale_business_process/delivery_path'
],
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'service_module/slapos_instance_subscription'
,
resource
=
'service_module/slapos_instance_subscription'
,
source
=
self
.
expected_slapos_organisation
,
source
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
trade_phase
=
'slapos/delivery'
,
trade_phase
=
'slapos/delivery'
,
ledger
=
'automated'
,
use
=
'trade/sale'
,
use
=
'trade/sale'
,
delivery_ratio
=
1.0
delivery_ratio
=
1.0
)
)
...
@@ -746,7 +782,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -746,7 +782,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
source
=
self
.
expected_slapos_organisation
,
source
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise_value
=
self
.
slapos_trade_condition
,
ledger
=
'automated'
)
)
delivery_line_kw
=
dict
(
delivery_line_kw
=
dict
(
portal_type
=
'Sale Packing List Line'
,
portal_type
=
'Sale Packing List Line'
,
...
@@ -757,9 +794,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -757,9 +794,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
'base_amount/invoicing/taxable'
],
'base_amount/invoicing/taxable'
],
)
)
delivery_1
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
delivery_1
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
start_date
=
DateTime
(
'2012/01/01'
),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
**
delivery_kw
**
delivery_kw
...
@@ -791,9 +829,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -791,9 +829,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
# Create second delivery
# Create second delivery
delivery_2
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
delivery_2
=
self
.
portal
.
sale_packing_list_module
.
newContent
(
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
start_date
=
DateTime
(
'2012/02/01'
),
start_date
=
DateTime
(
'2012/02/01'
),
stop_date
=
DateTime
(
'2012/03/01'
),
stop_date
=
DateTime
(
'2012/03/01'
),
**
delivery_kw
**
delivery_kw
...
@@ -821,16 +860,18 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -821,16 +860,18 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
causality
=
[
causality
=
[
'business_process_module/slapos_aggregated_business_process/deliver'
,
'business_process_module/slapos_aggregated_business_process/deliver'
,
'business_process_module/slapos_sale_business_process/delivery_path'
],
'business_process_module/slapos_sale_business_process/delivery_path'
],
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'service_module/slapos_instance_subscription'
,
resource
=
'service_module/slapos_instance_subscription'
,
source
=
self
.
expected_slapos_organisation
,
source
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
trade_phase
=
'slapos/delivery'
,
trade_phase
=
'slapos/delivery'
,
ledger
=
'automated'
,
use
=
'trade/sale'
,
use
=
'trade/sale'
,
delivery_ratio
=
1.0
delivery_ratio
=
1.0
)
)
...
@@ -1053,8 +1094,9 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1053,8 +1094,9 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise_value
=
self
.
slapos_trade_condition
,
created_by_builder
=
1
created_by_builder
=
1
,
ledger
=
'automated'
)
)
invoice_line_kw
=
dict
(
invoice_line_kw
=
dict
(
portal_type
=
'Invoice Line'
,
portal_type
=
'Invoice Line'
,
...
@@ -1074,9 +1116,10 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1074,9 +1116,10 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
invoice_1
=
self
.
portal
.
accounting_module
.
newContent
(
invoice_1
=
self
.
portal
.
accounting_module
.
newContent
(
start_date
=
DateTime
(
'2012/01/01'
),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
**
invoice_kw
**
invoice_kw
)
)
invoice_line_1
=
invoice_1
.
newContent
(
invoice_line_1
=
invoice_1
.
newContent
(
...
@@ -1092,9 +1135,10 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1092,9 +1135,10 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
invoice_2
=
self
.
portal
.
accounting_module
.
newContent
(
invoice_2
=
self
.
portal
.
accounting_module
.
newContent
(
start_date
=
DateTime
(
'2012/01/01'
),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
**
invoice_kw
**
invoice_kw
)
)
invoice_line_2
=
invoice_2
.
newContent
(
invoice_line_2
=
invoice_2
.
newContent
(
...
@@ -1124,16 +1168,18 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1124,16 +1168,18 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
portal_type
=
'Simulation Movement'
,
portal_type
=
'Simulation Movement'
,
base_contribution
=
[
'base_amount/invoicing/discounted'
,
base_contribution
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
'base_amount/invoicing/taxable'
],
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'service_module/slapos_instance_subscription'
,
resource
=
'service_module/slapos_instance_subscription'
,
source
=
self
.
expected_slapos_organisation
,
source
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
use
=
'trade/sale'
,
use
=
'trade/sale'
,
ledger
=
'automated'
)
)
invoice_rule_1
=
simulation_movement_1
.
newContent
(
invoice_rule_1
=
simulation_movement_1
.
newContent
(
portal_type
=
'Applied Rule'
,
portal_type
=
'Applied Rule'
,
...
@@ -1152,10 +1198,11 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1152,10 +1198,11 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
delivery_ratio
=
1.
,
delivery_ratio
=
1.
,
delivery_error
=
0.
,
delivery_error
=
0.
,
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
resource
=
'service_module/slapos_tax'
,
resource
=
'service_module/slapos_tax'
,
base_application
=
'base_amount/invoicing/taxable'
,
base_application
=
'base_amount/invoicing/taxable'
,
use
=
'trade/tax'
,
use
=
'trade/tax'
,
ledger
=
'automated'
,
causality
=
[
'business_process_module/slapos_aggregated_business_process/tax'
,
causality
=
[
'business_process_module/slapos_aggregated_business_process/tax'
,
'business_process_module/slapos_aggregated_business_process/trade_model_path'
,
'business_process_module/slapos_aggregated_business_process/trade_model_path'
,
'sale_trade_condition_module/slapos_aggregated_trade_condition/1'
],
'sale_trade_condition_module/slapos_aggregated_trade_condition/1'
],
...
@@ -1169,6 +1216,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1169,6 +1216,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
destination
=
invoice_movement_1
.
getDestination
(),
destination
=
invoice_movement_1
.
getDestination
(),
source_section
=
invoice_movement_1
.
getSourceSection
(),
source_section
=
invoice_movement_1
.
getSourceSection
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_project
=
invoice_movement_1
.
getDestinationProject
(),
quantity
=
invoice_movement_1
.
getTotalPrice
(),
quantity
=
invoice_movement_1
.
getTotalPrice
(),
delivery
=
invoice_line_1_tax
.
getRelativeUrl
(),
delivery
=
invoice_line_1_tax
.
getRelativeUrl
(),
**
trade_movement_kw
**
trade_movement_kw
...
@@ -1192,6 +1240,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1192,6 +1240,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
destination
=
invoice_movement_2
.
getDestination
(),
destination
=
invoice_movement_2
.
getDestination
(),
source_section
=
invoice_movement_2
.
getSourceSection
(),
source_section
=
invoice_movement_2
.
getSourceSection
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_project
=
invoice_movement_2
.
getDestinationProject
(),
quantity
=
invoice_movement_2
.
getTotalPrice
(),
quantity
=
invoice_movement_2
.
getTotalPrice
(),
delivery
=
invoice_line_2_tax
.
getRelativeUrl
(),
delivery
=
invoice_line_2_tax
.
getRelativeUrl
(),
**
trade_movement_kw
**
trade_movement_kw
...
@@ -1218,12 +1267,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1218,12 +1267,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
destination
=
[
'account_module/payable'
],
destination
=
[
'account_module/payable'
],
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_project
=
invoice_movement_1
.
getDestinationProject
(),
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
source
=
'account_module/receivable'
,
source
=
'account_module/receivable'
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
trade_phase
=
'slapos/accounting'
,
trade_phase
=
'slapos/accounting'
,
ledger
=
'automated'
,
price
=
1.0
,
price
=
1.0
,
quantity
=
invoice_movement_1
.
getTotalPrice
()
*
-
1
,
quantity
=
invoice_movement_1
.
getTotalPrice
()
*
-
1
,
)
)
...
@@ -1238,12 +1289,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1238,12 +1289,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
destination
=
[
'account_module/purchase'
],
destination
=
[
'account_module/purchase'
],
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_project
=
invoice_movement_1
.
getDestinationProject
(),
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
source
=
'account_module/receivable'
,
source
=
'account_module/receivable'
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
trade_phase
=
'slapos/accounting'
,
trade_phase
=
'slapos/accounting'
,
ledger
=
'automated'
,
price
=
1.0
,
price
=
1.0
,
quantity
=
invoice_movement_1
.
getTotalPrice
(),
quantity
=
invoice_movement_1
.
getTotalPrice
(),
)
)
...
@@ -1259,12 +1312,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1259,12 +1312,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
destination
=
[
'account_module/payable'
],
destination
=
[
'account_module/payable'
],
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_project
=
invoice_movement_1
.
getDestinationProject
(),
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
source
=
'account_module/receivable'
,
source
=
'account_module/receivable'
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
trade_phase
=
'slapos/accounting'
,
trade_phase
=
'slapos/accounting'
,
ledger
=
'automated'
,
price
=
1.0
,
price
=
1.0
,
quantity
=
trade_movement_1
.
getTotalPrice
()
*
-
1
,
quantity
=
trade_movement_1
.
getTotalPrice
()
*
-
1
,
)
)
...
@@ -1278,12 +1333,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1278,12 +1333,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
destination
=
[
'account_module/refundable_vat'
],
destination
=
[
'account_module/refundable_vat'
],
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_project
=
invoice_movement_1
.
getDestinationProject
(),
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
source
=
'account_module/coll_vat'
,
source
=
'account_module/coll_vat'
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
trade_phase
=
'slapos/accounting'
,
trade_phase
=
'slapos/accounting'
,
ledger
=
'automated'
,
price
=
1.0
,
price
=
1.0
,
quantity
=
trade_movement_1
.
getTotalPrice
(),
quantity
=
trade_movement_1
.
getTotalPrice
(),
)
)
...
@@ -1300,12 +1357,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1300,12 +1357,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
destination
=
[
'account_module/payable'
],
destination
=
[
'account_module/payable'
],
destination_decision
=
invoice_movement_2
.
getDestinationDecision
(),
destination_decision
=
invoice_movement_2
.
getDestinationDecision
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_project
=
invoice_movement_2
.
getDestinationProject
(),
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
source
=
'account_module/receivable'
,
source
=
'account_module/receivable'
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
trade_phase
=
'slapos/accounting'
,
trade_phase
=
'slapos/accounting'
,
ledger
=
'automated'
,
price
=
1.0
,
price
=
1.0
,
quantity
=
invoice_movement_2
.
getTotalPrice
()
*
-
1
,
quantity
=
invoice_movement_2
.
getTotalPrice
()
*
-
1
,
)
)
...
@@ -1317,12 +1376,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1317,12 +1376,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
destination
=
[
'account_module/purchase'
],
destination
=
[
'account_module/purchase'
],
destination_decision
=
invoice_movement_2
.
getDestinationDecision
(),
destination_decision
=
invoice_movement_2
.
getDestinationDecision
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_project
=
invoice_movement_2
.
getDestinationProject
(),
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
source
=
'account_module/receivable'
,
source
=
'account_module/receivable'
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
trade_phase
=
'slapos/accounting'
,
trade_phase
=
'slapos/accounting'
,
ledger
=
'automated'
,
price
=
1.0
,
price
=
1.0
,
quantity
=
invoice_movement_2
.
getTotalPrice
(),
quantity
=
invoice_movement_2
.
getTotalPrice
(),
)
)
...
@@ -1338,12 +1399,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1338,12 +1399,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
destination
=
[
'account_module/payable'
],
destination
=
[
'account_module/payable'
],
destination_decision
=
invoice_movement_2
.
getDestinationDecision
(),
destination_decision
=
invoice_movement_2
.
getDestinationDecision
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_project
=
invoice_movement_2
.
getDestinationProject
(),
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
source
=
'account_module/receivable'
,
source
=
'account_module/receivable'
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
trade_phase
=
'slapos/accounting'
,
trade_phase
=
'slapos/accounting'
,
ledger
=
'automated'
,
price
=
1.0
,
price
=
1.0
,
quantity
=
trade_movement_2
.
getTotalPrice
()
*
-
1
,
quantity
=
trade_movement_2
.
getTotalPrice
()
*
-
1
,
)
)
...
@@ -1354,12 +1417,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1354,12 +1417,14 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
destination
=
[
'account_module/refundable_vat'
],
destination
=
[
'account_module/refundable_vat'
],
destination_decision
=
invoice_movement_2
.
getDestinationDecision
(),
destination_decision
=
invoice_movement_2
.
getDestinationDecision
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_project
=
invoice_movement_2
.
getDestinationProject
(),
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
source
=
'account_module/coll_vat'
,
source
=
'account_module/coll_vat'
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
trade_phase
=
'slapos/accounting'
,
trade_phase
=
'slapos/accounting'
,
ledger
=
'automated'
,
price
=
1.0
,
price
=
1.0
,
quantity
=
trade_movement_2
.
getTotalPrice
(),
quantity
=
trade_movement_2
.
getTotalPrice
(),
)
)
...
@@ -1556,12 +1621,14 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1556,12 +1621,14 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
resource
=
'currency_module/EUR'
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise_value
=
self
.
slapos_trade_condition
,
ledger
=
'automated'
,
created_by_builder
=
1
created_by_builder
=
1
)
)
invoice_line_kw
=
dict
(
invoice_line_kw
=
dict
(
portal_type
=
'Invoice Line'
,
portal_type
=
'Invoice Line'
,
use
=
'trade/sale'
,
use
=
'trade/sale'
,
ledger
=
'automated'
,
resource
=
'service_module/slapos_instance_subscription'
,
resource
=
'service_module/slapos_instance_subscription'
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
base_contribution
=
[
'base_amount/invoicing/discounted'
,
base_contribution
=
[
'base_amount/invoicing/discounted'
,
...
@@ -1571,9 +1638,10 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1571,9 +1638,10 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
invoice_1
=
self
.
portal
.
accounting_module
.
newContent
(
invoice_1
=
self
.
portal
.
accounting_module
.
newContent
(
start_date
=
DateTime
(
'2012/01/01'
),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
**
invoice_kw
**
invoice_kw
)
)
invoice_line_1
=
invoice_1
.
newContent
(
invoice_line_1
=
invoice_1
.
newContent
(
...
@@ -1584,9 +1652,10 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1584,9 +1652,10 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
invoice_2
=
self
.
portal
.
accounting_module
.
newContent
(
invoice_2
=
self
.
portal
.
accounting_module
.
newContent
(
start_date
=
DateTime
(
'2012/01/01'
),
start_date
=
DateTime
(
'2012/01/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
stop_date
=
DateTime
(
'2012/02/01'
),
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
**
invoice_kw
**
invoice_kw
)
)
invoice_line_2
=
invoice_2
.
newContent
(
invoice_line_2
=
invoice_2
.
newContent
(
...
@@ -1611,15 +1680,17 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1611,15 +1680,17 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
portal_type
=
'Simulation Movement'
,
portal_type
=
'Simulation Movement'
,
base_contribution
=
[
'base_amount/invoicing/discounted'
,
base_contribution
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
'base_amount/invoicing/taxable'
],
destination
=
person
.
getRelativeUrl
(),
destination_value
=
person
,
destination_decision
=
person
.
getRelativeUrl
(),
destination_decision_value
=
person
,
destination_section
=
person
.
getRelativeUrl
(),
destination_section_value
=
person
,
destination_project_value
=
self
.
slapos_project
,
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
resource
=
'service_module/slapos_instance_subscription'
,
resource
=
'service_module/slapos_instance_subscription'
,
source
=
self
.
expected_slapos_organisation
,
source
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise_value
=
self
.
slapos_trade_condition
,
ledger
=
'automated'
,
use
=
'trade/sale'
,
use
=
'trade/sale'
,
)
)
invoice_rule_1
=
simulation_movement_1
.
newContent
(
invoice_rule_1
=
simulation_movement_1
.
newContent
(
...
@@ -1630,7 +1701,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1630,7 +1701,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
stop_date
=
invoice_1
.
getStopDate
(),
stop_date
=
invoice_1
.
getStopDate
(),
quantity
=
invoice_line_1
.
getQuantity
(),
quantity
=
invoice_line_1
.
getQuantity
(),
price
=
invoice_line_1
.
getPrice
(),
price
=
invoice_line_1
.
getPrice
(),
delivery
=
invoice_line_1
.
getRelativeUrl
()
,
delivery
_value
=
invoice_line_1
,
**
invoice_movement_kw
)
**
invoice_movement_kw
)
invoice_rule_2
=
simulation_movement_2
.
newContent
(
invoice_rule_2
=
simulation_movement_2
.
newContent
(
...
@@ -1641,7 +1712,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1641,7 +1712,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
stop_date
=
invoice_2
.
getStopDate
(),
stop_date
=
invoice_2
.
getStopDate
(),
quantity
=
invoice_line_2
.
getQuantity
(),
quantity
=
invoice_line_2
.
getQuantity
(),
price
=
invoice_line_2
.
getPrice
(),
price
=
invoice_line_2
.
getPrice
(),
delivery
=
invoice_line_2
.
getRelativeUrl
()
,
delivery
_value
=
invoice_line_2
,
**
invoice_movement_kw
)
**
invoice_movement_kw
)
self
.
tic
()
self
.
tic
()
...
@@ -1655,11 +1726,12 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1655,11 +1726,12 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
model_movement_kw
=
dict
(
model_movement_kw
=
dict
(
base_application
=
'base_amount/invoicing/taxable'
,
base_application
=
'base_amount/invoicing/taxable'
,
ledger
=
'automated'
,
price_currency
=
'currency_module/EUR'
,
price_currency
=
'currency_module/EUR'
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
'unit/piece'
,
source
=
self
.
expected_slapos_organisation
,
source
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
source_section
=
self
.
expected_slapos_organisation
,
specialise
=
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
,
specialise
_value
=
self
.
slapos_trade_condition
,
portal_type
=
'Simulation Movement'
,
portal_type
=
'Simulation Movement'
,
)
)
model_rule_1
=
invoice_movement_1
.
newContent
(
model_rule_1
=
invoice_movement_1
.
newContent
(
...
@@ -1670,6 +1742,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1670,6 +1742,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
destination
=
invoice_movement_1
.
getDestination
(),
destination
=
invoice_movement_1
.
getDestination
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_project
=
invoice_movement_1
.
getDestinationProject
(),
resource
=
'service_module/slapos_tax'
,
resource
=
'service_module/slapos_tax'
,
trade_phase
=
'slapos/tax'
,
trade_phase
=
'slapos/tax'
,
causality
=
[
'business_process_module/slapos_aggregated_business_process/tax'
,
causality
=
[
'business_process_module/slapos_aggregated_business_process/tax'
,
...
@@ -1684,6 +1757,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1684,6 +1757,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
destination
=
invoice_movement_1
.
getDestination
(),
destination
=
invoice_movement_1
.
getDestination
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_section
=
invoice_movement_1
.
getDestinationSection
(),
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_decision
=
invoice_movement_1
.
getDestinationDecision
(),
destination_project
=
invoice_movement_1
.
getDestinationProject
(),
resource
=
'service_module/slapos_tax'
,
resource
=
'service_module/slapos_tax'
,
trade_phase
=
'slapos/tax'
,
trade_phase
=
'slapos/tax'
,
causality
=
[
'business_process_module/slapos_aggregated_business_process/tax'
,
causality
=
[
'business_process_module/slapos_aggregated_business_process/tax'
,
...
@@ -1703,6 +1777,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1703,6 +1777,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
destination
=
invoice_movement_2
.
getDestination
(),
destination
=
invoice_movement_2
.
getDestination
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_section
=
invoice_movement_2
.
getDestinationSection
(),
destination_decision
=
invoice_movement_2
.
getDestinationDecision
(),
destination_decision
=
invoice_movement_2
.
getDestinationDecision
(),
destination_project
=
invoice_movement_2
.
getDestinationProject
(),
resource
=
'service_module/slapos_tax'
,
resource
=
'service_module/slapos_tax'
,
trade_phase
=
'slapos/tax'
,
trade_phase
=
'slapos/tax'
,
causality
=
[
'business_process_module/slapos_aggregated_business_process/tax'
,
causality
=
[
'business_process_module/slapos_aggregated_business_process/tax'
,
...
@@ -1834,7 +1909,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1834,7 +1909,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
self
.
assertEqual
(
invoice_2
.
getRelativeUrl
(),
self
.
assertEqual
(
invoice_2
.
getRelativeUrl
(),
model_line_2_tax_bis
.
getParentValue
().
getRelativeUrl
())
model_line_2_tax_bis
.
getParentValue
().
getRelativeUrl
())
"""
class TestSlapOSAggregatedDeliveryBuilder(SlapOSTestCaseMixin):
class TestSlapOSAggregatedDeliveryBuilder(SlapOSTestCaseMixin):
def emptyBuild(self, **kw):
def emptyBuild(self, **kw):
delivery_list = self._build(**kw)
delivery_list = self._build(**kw)
...
@@ -1885,13 +1960,15 @@ class TestSlapOSAggregatedDeliveryBuilder(SlapOSTestCaseMixin):
...
@@ -1885,13 +1960,15 @@ class TestSlapOSAggregatedDeliveryBuilder(SlapOSTestCaseMixin):
self.assertEqual('confirmed', built_delivery.getSimulationState())
self.assertEqual('confirmed', built_delivery.getSimulationState())
self.assertEqual('building', built_delivery.getCausalityState())
self.assertEqual('building', built_delivery.getCausalityState())
self.assertSameSet([
self.assertSameSet([
'ledger/automated',
'destination/%s' % person.getRelativeUrl(),
'destination/%s' % person.getRelativeUrl(),
'destination_decision/%s' % person.getRelativeUrl(),
'destination_decision/%s' % person.getRelativeUrl(),
'destination_section/%s' % person.getRelativeUrl(),
'destination_section/%s' % person.getRelativeUrl(),
'destination_project/%s' % self.slapos_project.getRelativeUrl(),
'price_currency/currency_module/EUR',
'price_currency/currency_module/EUR',
'source/%s' % self.expected_slapos_organisation,
'source/%s' % self.expected_slapos_organisation,
'source_section/%s' % self.expected_slapos_organisation,
'source_section/%s' % self.expected_slapos_organisation,
'specialise/%s'
%
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
],
'specialise/%s' %
self.slapos_trade_condition.getRelativeUrl()
],
built_delivery.getCategoryList())
built_delivery.getCategoryList())
self.assertEqual(DateTime().earliestTime(), built_delivery.getStartDate())
self.assertEqual(DateTime().earliestTime(), built_delivery.getStartDate())
delivery_line_list = built_delivery.contentValues(
delivery_line_list = built_delivery.contentValues(
...
@@ -2015,3 +2092,4 @@ class TestSlapOSAggregatedDeliveryBuilder(SlapOSTestCaseMixin):
...
@@ -2015,3 +2092,4 @@ class TestSlapOSAggregatedDeliveryBuilder(SlapOSTestCaseMixin):
self.assertEqual(0.0, built_delivery_line.getPrice())
self.assertEqual(0.0, built_delivery_line.getPrice())
self.assertEqual(delivery_line_2.getResource(),
self.assertEqual(delivery_line_2.getResource(),
built_delivery_line.getResource())
built_delivery_line.getResource())
"""
\ 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