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
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
amrani
erp5
Commits
b47ca74c
Commit
b47ca74c
authored
Aug 22, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Describe expected behaviour of getBaseUnitPrice
At least this is the behaviour expected in my understand
parent
ed422ffb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
product/ERP5/tests/testSupply.py
product/ERP5/tests/testSupply.py
+45
-0
No files found.
product/ERP5/tests/testSupply.py
View file @
b47ca74c
...
@@ -319,6 +319,51 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
...
@@ -319,6 +319,51 @@ class TestSaleSupply(TestSupplyMixin, SubcontentReindexingWrapper,
self
.
assertEqual
(
len
(
self
.
portal
.
portal_catalog
(
uid
=
supply_cell
.
getUid
(),
destination_reference
=
'orange'
)),
0
)
self
.
assertEqual
(
len
(
self
.
portal
.
portal_catalog
(
uid
=
supply_cell
.
getUid
(),
destination_reference
=
'orange'
)),
0
)
self
.
assertEqual
(
len
(
self
.
portal
.
portal_catalog
(
uid
=
supply_cell
.
getUid
(),
destination_reference
=
'banana'
)),
1
)
self
.
assertEqual
(
len
(
self
.
portal
.
portal_catalog
(
uid
=
supply_cell
.
getUid
(),
destination_reference
=
'banana'
)),
1
)
def
test_getBaseUnitPrice
(
self
):
currency
=
self
.
portal
.
currency_module
.
newContent
(
portal_type
=
'Currency'
,
base_unit_quantity
=
0.01
)
product
=
self
.
portal
.
product_module
.
newContent
(
portal_type
=
"Product"
,
title
=
self
.
id
())
supply
=
self
.
_makeSupply
()
supply_line
=
self
.
_makeSupplyLine
(
supply
,
resource_value
=
product
)
another_supply_line
=
self
.
_makeSupplyLine
(
supply
,
resource_value
=
product
)
# A new supply line has no no base unit price
self
.
assertEqual
(
None
,
supply_line
.
getBaseUnitPrice
())
movement
=
self
.
portal
.
sale_order_module
.
newContent
(
portal_type
=
'Sale Order'
,
).
newContent
(
portal_type
=
'Sale Order Line'
,
resource_value
=
product
)
# A new movement has no no base unit price
self
.
assertEqual
(
None
,
movement
.
getBaseUnitPrice
())
# When a price currency is set, the price precision uses the precision from
# price currency
movement
.
setPriceCurrencyValue
(
currency
)
self
.
tic
()
self
.
assertEqual
(
None
,
movement
.
getBaseUnitPrice
())
self
.
assertEqual
(
2
,
movement
.
getPricePrecision
())
# If base unit price is set on an applicable supply line, then the base
# unit price of this movement will use the one from the supply line
supply_line
.
setBaseUnitPrice
(
0.001
)
self
.
assertEqual
(
3
,
supply_line
.
getPricePrecision
())
self
.
tic
()
self
.
assertEqual
(
0.001
,
movement
.
getBaseUnitPrice
())
self
.
assertEqual
(
3
,
movement
.
getPricePrecision
())
# Base unit pice have been copied on the movement
self
.
assertTrue
(
movement
.
hasBaseUnitPrice
())
# Supply lines does not lookup base unit price from other supply lines
self
.
assertEqual
(
None
,
another_supply_line
.
getBaseUnitPrice
())
class
TestPurchaseSupply
(
TestSaleSupply
):
class
TestPurchaseSupply
(
TestSaleSupply
):
"""
"""
...
...
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