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
Titouan Soulard
slapos.core
Commits
7d09b24c
Commit
7d09b24c
authored
Mar 10, 2023
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: testSlapOSAccountingBuilder: update quantity unit of software product
parent
9949fecd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
36 deletions
+75
-36
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingBuilder.py
...ortal_components/test.erp5.testSlapOSAccountingBuilder.py
+75
-36
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingBuilder.py
View file @
7d09b24c
...
@@ -19,13 +19,14 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
...
@@ -19,13 +19,14 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
self
.
assertNotEqual
(
None
,
simulation_movement
.
getDeliveryValue
())
self
.
assertNotEqual
(
None
,
simulation_movement
.
getDeliveryValue
())
def
checkDeliveryLine
(
self
,
simulation_movement
,
delivery_line
,
def
checkDeliveryLine
(
self
,
simulation_movement
,
delivery_line
,
line_portal_type
,
cell_portal_type
,
has_date_on_line
):
line_portal_type
,
cell_portal_type
):
self
.
assertEqual
(
line_portal_type
,
delivery_line
.
getPortalType
())
self
.
assertEqual
(
line_portal_type
,
delivery_line
.
getPortalType
())
self
.
assertSameSet
([
self
.
assertSameSet
([
'use/trade/sale'
,
'use/trade/sale'
,
'quantity_unit/unit/piece'
,
'base_contribution/base_amount/invoicing/discounted'
,
'base_contribution/base_amount/invoicing/discounted'
,
'base_contribution/base_amount/invoicing/taxable'
]
\
'base_contribution/base_amount/invoicing/taxable'
]
\
+
convertCategoryList
(
'quantity_unit'
,
simulation_movement
.
getQuantityUnitList
())
+
convertCategoryList
(
'aggregate'
,
+
convertCategoryList
(
'aggregate'
,
simulation_movement
.
getAggregateList
())
simulation_movement
.
getAggregateList
())
+
convertCategoryList
(
'resource'
,
+
convertCategoryList
(
'resource'
,
...
@@ -36,8 +37,8 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
...
@@ -36,8 +37,8 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
delivery_line
.
getQuantity
())
delivery_line
.
getQuantity
())
self
.
assertEqual
(
simulation_movement
.
getPrice
(),
self
.
assertEqual
(
simulation_movement
.
getPrice
(),
delivery_line
.
getPrice
())
delivery_line
.
getPrice
())
self
.
assert
Equal
(
delivery_line
.
hasStartDate
(),
has_date_on_line
)
self
.
assert
False
(
delivery_line
.
hasStartDate
()
)
self
.
assert
Equal
(
delivery_line
.
hasStopDate
(),
has_date_on_line
)
self
.
assert
False
(
delivery_line
.
hasStopDate
()
)
self
.
assertEqual
([],
delivery_line
.
contentValues
(
self
.
assertEqual
([],
delivery_line
.
contentValues
(
portal_type
=
cell_portal_type
))
portal_type
=
cell_portal_type
))
self
.
assertSameSet
([
simulation_movement
.
getRelativeUrl
()],
self
.
assertSameSet
([
simulation_movement
.
getRelativeUrl
()],
...
@@ -52,13 +53,17 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
...
@@ -52,13 +53,17 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
self
.
assertEqual
(
'building'
,
delivery
.
getCausalityState
())
self
.
assertEqual
(
'building'
,
delivery
.
getCausalityState
())
delivery
.
updateCausalityState
(
solve_automatically
=
False
)
delivery
.
updateCausalityState
(
solve_automatically
=
False
)
self
.
assertEqual
(
'solved'
,
delivery
.
getCausalityState
())
self
.
assertEqual
(
'solved'
,
delivery
.
getCausalityState
())
self
.
assertTrue
(
delivery
.
hasStartDate
())
self
.
assertTrue
(
delivery
.
hasStopDate
())
if
expected_start_date
is
None
:
if
expected_start_date
is
None
:
expected_start_date
=
simulation_movement
.
getStartDate
()
expected_start_date
=
simulation_movement
.
getStartDate
()
self
.
assertEqual
(
expected_start_date
,
delivery
.
getStartDate
())
self
.
assertEqual
(
expected_start_date
,
delivery
.
getStartDate
())
self
.
assertEqual
(
simulation_movement
.
getStartDate
(),
delivery
.
getStartDate
())
if
expected_stop_date
is
None
:
if
expected_stop_date
is
None
:
expected_stop_date
=
simulation_movement
.
getStopDate
()
expected_stop_date
=
simulation_movement
.
getStopDate
()
self
.
assertEqual
(
expected_stop_date
,
delivery
.
getStopDate
())
self
.
assertEqual
(
expected_stop_date
,
delivery
.
getStopDate
())
self
.
assertEqual
(
simulation_movement
.
getStopDate
(),
delivery
.
getStopDate
())
self
.
assertSameSet
([
self
.
assertSameSet
([
'ledger/automated'
]
\
'ledger/automated'
]
\
...
@@ -112,7 +117,7 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
...
@@ -112,7 +117,7 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
destination_section_value
=
destination
,
destination_section_value
=
destination
,
destination_project_value
=
project
,
destination_project_value
=
project
,
price_currency_value
=
currency
,
price_currency_value
=
currency
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
resource
.
getQuantityUnit
()
,
resource_value
=
resource
,
resource_value
=
resource
,
source_value
=
source
,
source_value
=
source
,
source_section_value
=
source
,
source_section_value
=
source
,
...
@@ -150,8 +155,7 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
...
@@ -150,8 +155,7 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
delivery_line_2
.
getRelativeUrl
())
delivery_line_2
.
getRelativeUrl
())
line_kw
=
dict
(
line_portal_type
=
'Sale Packing List Line'
,
line_kw
=
dict
(
line_portal_type
=
'Sale Packing List Line'
,
cell_portal_type
=
'Sale Packing List Cell'
,
cell_portal_type
=
'Sale Packing List Cell'
)
has_date_on_line
=
False
)
self
.
checkDeliveryLine
(
simulation_movement_1
,
delivery_line_1
,
**
line_kw
)
self
.
checkDeliveryLine
(
simulation_movement_1
,
delivery_line_1
,
**
line_kw
)
self
.
checkDeliveryLine
(
simulation_movement_2
,
delivery_line_2
,
**
line_kw
)
self
.
checkDeliveryLine
(
simulation_movement_2
,
delivery_line_2
,
**
line_kw
)
...
@@ -194,7 +198,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -194,7 +198,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
portal_type
=
'Sale Packing List Line'
,
portal_type
=
'Sale Packing List Line'
,
resource_value
=
resource
,
resource_value
=
resource
,
use
=
'trade/sale'
,
use
=
'trade/sale'
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
resource
.
getQuantityUnit
()
,
base_contribution_list
=
[
'base_amount/invoicing/discounted'
,
base_contribution_list
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
'base_amount/invoicing/taxable'
],
)
)
...
@@ -230,7 +234,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -230,7 +234,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
batch_mode
=
1
)
batch_mode
=
1
)
delivery_line_1_bis
.
edit
(
delivery_line_1_bis
.
edit
(
price
=
0.0
,
price
=
0.0
,
resource
=
'service_module/slapos_instance_setup'
resource
=
'service_module/slapos_instance_setup'
,
quantity_unit
=
'unit/piece'
)
)
# Create second delivery
# Create second delivery
...
@@ -272,7 +277,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -272,7 +277,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
destination_section_value
=
destination
,
destination_section_value
=
destination
,
destination_project_value
=
project
,
destination_project_value
=
project
,
price_currency_value
=
currency
,
price_currency_value
=
currency
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
resource
.
getQuantityUnit
()
,
resource_value
=
resource
,
resource_value
=
resource
,
source_value
=
source
,
source_value
=
source
,
source_section_value
=
source
,
source_section_value
=
source
,
...
@@ -299,7 +304,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -299,7 +304,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
delivery
=
delivery_line_1_bis
.
getRelativeUrl
(),
delivery
=
delivery_line_1_bis
.
getRelativeUrl
(),
**
simulation_movement_kw
**
simulation_movement_kw
)
)
simulation_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
())
simulation_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
(),
quantity_unit
=
delivery_line_1_bis
.
getQuantityUnit
()
)
simulation_movement_2
=
applied_rule_2
.
newContent
(
simulation_movement_2
=
applied_rule_2
.
newContent
(
quantity
=
delivery_line_2
.
getQuantity
(),
quantity
=
delivery_line_2
.
getQuantity
(),
price
=
delivery_line_2
.
getPrice
(),
price
=
delivery_line_2
.
getPrice
(),
...
@@ -349,7 +357,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -349,7 +357,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
quantity
=
delivery_line_1_bis
.
getQuantity
(),
quantity
=
delivery_line_1_bis
.
getQuantity
(),
price
=
delivery_line_1_bis
.
getPrice
(),
price
=
delivery_line_1_bis
.
getPrice
(),
**
invoice_movement_kw
)
**
invoice_movement_kw
)
invoice_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
())
invoice_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
(),
quantity_unit
=
delivery_line_1_bis
.
getQuantityUnit
()
)
invoice_rule_2
=
simulation_movement_2
.
newContent
(
invoice_rule_2
=
simulation_movement_2
.
newContent
(
portal_type
=
'Applied Rule'
,
portal_type
=
'Applied Rule'
,
...
@@ -381,8 +392,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -381,8 +392,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
invoice_line_1_bis
.
getParentValue
())
invoice_line_1_bis
.
getParentValue
())
line_kw
=
dict
(
line_portal_type
=
'Invoice Line'
,
line_kw
=
dict
(
line_portal_type
=
'Invoice Line'
,
cell_portal_type
=
'Invoice Cell'
,
cell_portal_type
=
'Invoice Cell'
)
has_date_on_line
=
True
)
self
.
checkDeliveryLine
(
invoice_movement_1
,
invoice_line_1
,
**
line_kw
)
self
.
checkDeliveryLine
(
invoice_movement_1
,
invoice_line_1
,
**
line_kw
)
self
.
checkDeliveryLine
(
invoice_movement_1_bis
,
invoice_line_1_bis
,
self
.
checkDeliveryLine
(
invoice_movement_1_bis
,
invoice_line_1_bis
,
**
line_kw
)
**
line_kw
)
...
@@ -415,7 +425,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -415,7 +425,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
# Keep price different else this line will be merged with delivery_line_1_bis
# Keep price different else this line will be merged with delivery_line_1_bis
# on the invoice side
# on the invoice side
price
=
1.1
,
price
=
1.1
,
resource
=
'service_module/slapos_instance_setup'
resource
=
'service_module/slapos_instance_setup'
,
quantity_unit
=
'unit/piece'
)
)
simulation_movement_2_bis
=
applied_rule_2
.
newContent
(
simulation_movement_2_bis
=
applied_rule_2
.
newContent
(
quantity
=
delivery_line_2_bis
.
getQuantity
(),
quantity
=
delivery_line_2_bis
.
getQuantity
(),
...
@@ -425,7 +436,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -425,7 +436,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
delivery
=
delivery_line_2_bis
.
getRelativeUrl
(),
delivery
=
delivery_line_2_bis
.
getRelativeUrl
(),
**
simulation_movement_kw
**
simulation_movement_kw
)
)
simulation_movement_2_bis
.
edit
(
resource
=
delivery_line_2_bis
.
getResource
())
simulation_movement_2_bis
.
edit
(
resource
=
delivery_line_2_bis
.
getResource
(),
quantity_unit
=
delivery_line_2_bis
.
getQuantityUnit
()
)
invoice_rule_2_bis
=
simulation_movement_2_bis
.
newContent
(
invoice_rule_2_bis
=
simulation_movement_2_bis
.
newContent
(
portal_type
=
'Applied Rule'
,
portal_type
=
'Applied Rule'
,
specialise
=
'portal_rules/slapos_invoice_simulation_rule'
)
specialise
=
'portal_rules/slapos_invoice_simulation_rule'
)
...
@@ -435,7 +449,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -435,7 +449,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
quantity
=
delivery_line_2_bis
.
getQuantity
(),
quantity
=
delivery_line_2_bis
.
getQuantity
(),
price
=
delivery_line_2_bis
.
getPrice
(),
price
=
delivery_line_2_bis
.
getPrice
(),
**
invoice_movement_kw
)
**
invoice_movement_kw
)
invoice_movement_2_bis
.
edit
(
resource
=
delivery_line_2_bis
.
getResource
())
invoice_movement_2_bis
.
edit
(
resource
=
delivery_line_2_bis
.
getResource
(),
quantity_unit
=
delivery_line_2_bis
.
getQuantityUnit
()
)
self
.
tic
()
self
.
tic
()
# test the test
# test the test
delivery_2
.
updateCausalityState
(
solve_automatically
=
False
)
delivery_2
.
updateCausalityState
(
solve_automatically
=
False
)
...
@@ -509,7 +526,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -509,7 +526,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
portal_type
=
'Sale Packing List Line'
,
portal_type
=
'Sale Packing List Line'
,
resource_value
=
resource
,
resource_value
=
resource
,
use
=
'trade/sale'
,
use
=
'trade/sale'
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
resource
.
getQuantityUnit
()
,
base_contribution_list
=
[
'base_amount/invoicing/discounted'
,
base_contribution_list
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
'base_amount/invoicing/taxable'
],
)
)
...
@@ -546,7 +563,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -546,7 +563,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
batch_mode
=
1
)
batch_mode
=
1
)
delivery_line_1_bis
.
edit
(
delivery_line_1_bis
.
edit
(
price
=
0.0
,
price
=
0.0
,
resource
=
'service_module/slapos_instance_setup'
resource
=
'service_module/slapos_instance_setup'
,
quantity_unit
=
'unit/piece'
)
)
# Create second delivery
# Create second delivery
...
@@ -589,7 +607,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -589,7 +607,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
destination_section_value
=
destination
,
destination_section_value
=
destination
,
destination_project_value
=
project
,
destination_project_value
=
project
,
price_currency_value
=
currency
,
price_currency_value
=
currency
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
resource
.
getQuantityUnit
()
,
resource_value
=
resource
,
resource_value
=
resource
,
source_value
=
source
,
source_value
=
source
,
source_section_value
=
source
,
source_section_value
=
source
,
...
@@ -615,7 +633,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -615,7 +633,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
delivery
=
delivery_line_1_bis
.
getRelativeUrl
(),
delivery
=
delivery_line_1_bis
.
getRelativeUrl
(),
**
simulation_movement_kw
**
simulation_movement_kw
)
)
simulation_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
())
simulation_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
(),
quantity_unit
=
delivery_line_1_bis
.
getQuantityUnit
()
)
simulation_movement_2
=
applied_rule_2
.
newContent
(
simulation_movement_2
=
applied_rule_2
.
newContent
(
quantity
=
delivery_line_2
.
getQuantity
(),
quantity
=
delivery_line_2
.
getQuantity
(),
price
=
delivery_line_2
.
getPrice
(),
price
=
delivery_line_2
.
getPrice
(),
...
@@ -665,7 +686,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -665,7 +686,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
quantity
=
delivery_line_1_bis
.
getQuantity
(),
quantity
=
delivery_line_1_bis
.
getQuantity
(),
price
=
delivery_line_1_bis
.
getPrice
(),
price
=
delivery_line_1_bis
.
getPrice
(),
**
invoice_movement_kw
)
**
invoice_movement_kw
)
invoice_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
())
invoice_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
(),
quantity_unit
=
delivery_line_1_bis
.
getQuantityUnit
()
)
invoice_rule_2
=
simulation_movement_2
.
newContent
(
invoice_rule_2
=
simulation_movement_2
.
newContent
(
portal_type
=
'Applied Rule'
,
portal_type
=
'Applied Rule'
,
...
@@ -725,7 +749,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -725,7 +749,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
batch_mode
=
1
)
batch_mode
=
1
)
delivery_line_2_bis
.
edit
(
delivery_line_2_bis
.
edit
(
price
=
0.0
,
price
=
0.0
,
resource
=
'service_module/slapos_instance_setup'
resource
=
'service_module/slapos_instance_setup'
,
quantity_unit
=
'unit/piece'
)
)
simulation_movement_2_bis
=
applied_rule_2
.
newContent
(
simulation_movement_2_bis
=
applied_rule_2
.
newContent
(
quantity
=
delivery_line_2_bis
.
getQuantity
(),
quantity
=
delivery_line_2_bis
.
getQuantity
(),
...
@@ -772,6 +797,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -772,6 +797,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
)
)
def
test_with_different_date
(
self
):
def
test_with_different_date
(
self
):
self
.
portal
.
testromain
()
resource
,
_
,
_
,
_
,
_
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
is_accountable
=
True
)
resource
,
_
,
_
,
_
,
_
,
instance_tree
=
self
.
bootstrapAllocableInstanceTree
(
is_accountable
=
True
)
project
=
instance_tree
.
getFollowUpValue
()
project
=
instance_tree
.
getFollowUpValue
()
trade_condition
=
project
.
getSpecialiseValue
()
trade_condition
=
project
.
getSpecialiseValue
()
...
@@ -793,7 +819,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -793,7 +819,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
portal_type
=
'Sale Packing List Line'
,
portal_type
=
'Sale Packing List Line'
,
resource_value
=
resource
,
resource_value
=
resource
,
use
=
'trade/sale'
,
use
=
'trade/sale'
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
resource
.
getQuantityUnit
()
,
base_contribution_list
=
[
'base_amount/invoicing/discounted'
,
base_contribution_list
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
'base_amount/invoicing/taxable'
],
)
)
...
@@ -828,7 +854,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -828,7 +854,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
batch_mode
=
1
)
batch_mode
=
1
)
delivery_line_1_bis
.
edit
(
delivery_line_1_bis
.
edit
(
price
=
0.0
,
price
=
0.0
,
resource
=
'service_module/slapos_instance_setup'
resource
=
'service_module/slapos_instance_setup'
,
quantity_unit
=
'unit/piece'
)
)
# Create second delivery
# Create second delivery
...
@@ -869,7 +896,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -869,7 +896,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
destination_section_value
=
destination
,
destination_section_value
=
destination
,
destination_project_value
=
project
,
destination_project_value
=
project
,
price_currency_value
=
currency
,
price_currency_value
=
currency
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
resource
.
getQuantityUnit
()
,
resource_value
=
resource
,
resource_value
=
resource
,
source_value
=
source
,
source_value
=
source
,
source_section_value
=
source
,
source_section_value
=
source
,
...
@@ -895,7 +922,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -895,7 +922,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
delivery
=
delivery_line_1_bis
.
getRelativeUrl
(),
delivery
=
delivery_line_1_bis
.
getRelativeUrl
(),
**
simulation_movement_kw
**
simulation_movement_kw
)
)
simulation_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
())
simulation_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
(),
quantity_unit
=
delivery_line_1_bis
.
getQuantityUnit
()
)
simulation_movement_2
=
applied_rule_2
.
newContent
(
simulation_movement_2
=
applied_rule_2
.
newContent
(
quantity
=
delivery_line_2
.
getQuantity
(),
quantity
=
delivery_line_2
.
getQuantity
(),
price
=
delivery_line_2
.
getPrice
(),
price
=
delivery_line_2
.
getPrice
(),
...
@@ -945,7 +975,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -945,7 +975,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
quantity
=
delivery_line_1_bis
.
getQuantity
(),
quantity
=
delivery_line_1_bis
.
getQuantity
(),
price
=
delivery_line_1_bis
.
getPrice
(),
price
=
delivery_line_1_bis
.
getPrice
(),
**
invoice_movement_kw
)
**
invoice_movement_kw
)
invoice_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
())
invoice_movement_1_bis
.
edit
(
resource
=
delivery_line_1_bis
.
getResource
(),
quantity_unit
=
delivery_line_1_bis
.
getQuantityUnit
()
)
invoice_rule_2
=
simulation_movement_2
.
newContent
(
invoice_rule_2
=
simulation_movement_2
.
newContent
(
portal_type
=
'Applied Rule'
,
portal_type
=
'Applied Rule'
,
...
@@ -977,8 +1010,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -977,8 +1010,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
invoice_line_1_bis
.
getParentValue
())
invoice_line_1_bis
.
getParentValue
())
line_kw
=
dict
(
line_portal_type
=
'Invoice Line'
,
line_kw
=
dict
(
line_portal_type
=
'Invoice Line'
,
cell_portal_type
=
'Invoice Cell'
,
cell_portal_type
=
'Invoice Cell'
)
has_date_on_line
=
True
)
self
.
checkDeliveryLine
(
invoice_movement_1
,
invoice_line_1
,
**
line_kw
)
self
.
checkDeliveryLine
(
invoice_movement_1
,
invoice_line_1
,
**
line_kw
)
self
.
checkDeliveryLine
(
invoice_movement_1_bis
,
invoice_line_1_bis
,
self
.
checkDeliveryLine
(
invoice_movement_1_bis
,
invoice_line_1_bis
,
**
line_kw
)
**
line_kw
)
...
@@ -1016,7 +1048,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1016,7 +1048,8 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
# Keep price different else this line will be merged with delivery_line_1_bis
# Keep price different else this line will be merged with delivery_line_1_bis
# on the invoice side
# on the invoice side
price
=
1.1
,
price
=
1.1
,
resource
=
'service_module/slapos_instance_setup'
resource
=
'service_module/slapos_instance_setup'
,
quantity_unit
=
'unit/piece'
)
)
simulation_movement_2_bis
=
applied_rule_2
.
newContent
(
simulation_movement_2_bis
=
applied_rule_2
.
newContent
(
quantity
=
delivery_line_2_bis
.
getQuantity
(),
quantity
=
delivery_line_2_bis
.
getQuantity
(),
...
@@ -1026,7 +1059,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1026,7 +1059,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
delivery
=
delivery_line_2_bis
.
getRelativeUrl
(),
delivery
=
delivery_line_2_bis
.
getRelativeUrl
(),
**
simulation_movement_kw
**
simulation_movement_kw
)
)
simulation_movement_2_bis
.
edit
(
resource
=
delivery_line_2_bis
.
getResource
())
simulation_movement_2_bis
.
edit
(
resource
=
delivery_line_2_bis
.
getResource
(),
quantity_unit
=
delivery_line_2_bis
.
getQuantityUnit
()
)
invoice_rule_2_bis
=
simulation_movement_2_bis
.
newContent
(
invoice_rule_2_bis
=
simulation_movement_2_bis
.
newContent
(
portal_type
=
'Applied Rule'
,
portal_type
=
'Applied Rule'
,
specialise
=
'portal_rules/slapos_invoice_simulation_rule'
)
specialise
=
'portal_rules/slapos_invoice_simulation_rule'
)
...
@@ -1036,7 +1072,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1036,7 +1072,10 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
quantity
=
delivery_line_2_bis
.
getQuantity
(),
quantity
=
delivery_line_2_bis
.
getQuantity
(),
price
=
delivery_line_2_bis
.
getPrice
(),
price
=
delivery_line_2_bis
.
getPrice
(),
**
invoice_movement_kw
)
**
invoice_movement_kw
)
invoice_movement_2_bis
.
edit
(
resource
=
delivery_line_2_bis
.
getResource
())
invoice_movement_2_bis
.
edit
(
resource
=
delivery_line_2_bis
.
getResource
(),
quantity_unit
=
delivery_line_2_bis
.
getQuantityUnit
()
)
self
.
tic
()
self
.
tic
()
# test the test
# test the test
delivery_2
.
updateCausalityState
(
solve_automatically
=
False
)
delivery_2
.
updateCausalityState
(
solve_automatically
=
False
)
...
@@ -1113,7 +1152,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1113,7 +1152,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
portal_type
=
'Invoice Line'
,
portal_type
=
'Invoice Line'
,
use
=
'trade/sale'
,
use
=
'trade/sale'
,
resource_value
=
resource
,
resource_value
=
resource
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
resource
.
getQuantityUnit
()
,
base_contribution
=
[
'base_amount/invoicing/discounted'
,
base_contribution
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
'base_amount/invoicing/taxable'
],
)
)
...
@@ -1184,7 +1223,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
...
@@ -1184,7 +1223,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
destination_decision_value
=
destination
,
destination_decision_value
=
destination
,
destination_project_value
=
project
,
destination_project_value
=
project
,
price_currency_value
=
currency
,
price_currency_value
=
currency
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
resource
.
getQuantityUnit
()
,
resource_value
=
resource
,
resource_value
=
resource
,
source_value
=
source
,
source_value
=
source
,
source_section_value
=
source
,
source_section_value
=
source
,
...
@@ -1644,7 +1683,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
...
@@ -1644,7 +1683,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
use
=
'trade/sale'
,
use
=
'trade/sale'
,
ledger
=
'automated'
,
ledger
=
'automated'
,
resource_value
=
resource
,
resource_value
=
resource
,
quantity_unit
=
'unit/piece'
,
quantity_unit
=
resource
.
getQuantityUnit
()
,
base_contribution
=
[
'base_amount/invoicing/discounted'
,
base_contribution
=
[
'base_amount/invoicing/discounted'
,
'base_amount/invoicing/taxable'
],
'base_amount/invoicing/taxable'
],
)
)
...
...
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