Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
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
Jérome Perrin
erp5
Commits
4df3f14f
Commit
4df3f14f
authored
Jan 09, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test that movement.getPrice sets the price locally
parent
9b37d2e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
product/ERP5/tests/testResource.py
product/ERP5/tests/testResource.py
+50
-0
No files found.
product/ERP5/tests/testResource.py
View file @
4df3f14f
...
...
@@ -904,6 +904,56 @@ class TestResource(ERP5TypeTestCase):
# The following test tests Movement.getPrice, which is based on the movement
# context.
def
testGetPriceSetPrice
(
self
):
resource
=
self
.
portal
.
getDefaultModule
(
self
.
product_portal_type
)
\
.
newContent
(
portal_type
=
self
.
product_portal_type
)
supply_line
=
resource
.
newContent
(
portal_type
=
self
.
sale_supply_line_portal_type
)
supply_line
.
setBasePrice
(
1000
)
self
.
tic
()
sale_order
=
self
.
portal
.
getDefaultModule
(
"Sale Order"
).
newContent
(
portal_type
=
'Sale Order'
,)
sale_order_line
=
sale_order
.
newContent
(
portal_type
=
self
.
sale_order_line_portal_type
,
resource_value
=
resource
,
quantity
=
5
)
self
.
assertEqual
(
1000
,
sale_order_line
.
getPrice
())
# price has been looked up and copied
self
.
assertTrue
(
sale_order_line
.
hasPrice
())
# if we force price, then our forced price is used
sale_order_line
.
setPrice
(
123
)
self
.
assertEqual
(
123
,
sale_order_line
.
getPrice
())
# if we reset price,
sale_order_line
.
setPrice
(
None
)
# it is looked up again
self
.
assertEqual
(
1000
,
sale_order_line
.
getPrice
())
self
.
assertTrue
(
sale_order_line
.
hasPrice
())
def
testGetPriceMovementOnly
(
self
):
resource
=
self
.
portal
.
getDefaultModule
(
self
.
product_portal_type
)
\
.
newContent
(
portal_type
=
self
.
product_portal_type
)
supply_line
=
resource
.
newContent
(
portal_type
=
self
.
sale_supply_line_portal_type
)
supply_line
.
setBasePrice
(
1000
)
self
.
tic
()
sale_order
=
self
.
portal
.
getDefaultModule
(
"Sale Order"
).
newContent
(
portal_type
=
'Sale Order'
,)
sale_order_line
=
sale_order
.
newContent
(
portal_type
=
self
.
sale_order_line_portal_type
,
resource_value
=
resource
,
quantity
=
5
)
sub_sale_order_line
=
sale_order_line
.
newContent
(
portal_type
=
self
.
sale_order_line_portal_type
,
quantity
=
2
)
# when we have hierarchical order lines, only leaves are movements.
self
.
assertTrue
(
sub_sale_order_line
.
isMovement
())
self
.
assertFalse
(
sale_order_line
.
isMovement
())
# Only movements get a price automatically.:
self
.
assertEqual
(
1000
,
sub_sale_order_line
.
getPrice
())
self
.
assertEqual
(
None
,
sale_order_line
.
getPrice
())
def
test_12_getInternalVsPurchaseVsSalePrice
(
self
,
quiet
=
quiet
,
run
=
run_all_test
):
"""
Test the pricing model with internal, purchase and sale supply
...
...
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