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
Mikolaï Krol
erp5
Commits
a0dfdc15
Commit
a0dfdc15
authored
Jun 23, 2011
by
Tatuya Kamada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use NULL-safe equal instead of '!=' because mirror_section_uid can be NULL.
parent
b3fccb28
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
product/ERP5/Tool/SimulationTool.py
product/ERP5/Tool/SimulationTool.py
+1
-1
product/ERP5/tests/testInventoryAPI.py
product/ERP5/tests/testInventoryAPI.py
+27
-1
No files found.
product/ERP5/Tool/SimulationTool.py
View file @
a0dfdc15
...
@@ -1795,7 +1795,7 @@ class SimulationTool(BaseTool):
...
@@ -1795,7 +1795,7 @@ class SimulationTool(BaseTool):
if
'section_uid'
in
kw
:
if
'section_uid'
in
kw
:
# ignore internal movements
# ignore internal movements
sql_kw
[
'where_expression'
]
+=
' AND '
\
sql_kw
[
'where_expression'
]
+=
' AND '
\
'
stock.section_uid!=stock.mirror_section_uid
'
'
NOT(stock.section_uid<=>stock.mirror_section_uid)
'
result
=
self
.
Resource_zGetAssetPrice
(
result
=
self
.
Resource_zGetAssetPrice
(
valuation_method
=
valuation_method
,
valuation_method
=
valuation_method
,
...
...
product/ERP5/tests/testInventoryAPI.py
View file @
a0dfdc15
...
@@ -230,7 +230,7 @@ class InventoryAPITestCase(ERP5TypeTestCase):
...
@@ -230,7 +230,7 @@ class InventoryAPITestCase(ERP5TypeTestCase):
# }}}
# }}}
@
reindex
@
reindex
def
_makeMovement
(
self
,
**
kw
):
def
_makeMovement
(
self
,
is_internal
=
0
,
**
kw
):
"""Creates a movement.
"""Creates a movement.
"""
"""
mvt
=
self
.
folder
.
newContent
(
portal_type
=
'Dummy Movement'
)
mvt
=
self
.
folder
.
newContent
(
portal_type
=
'Dummy Movement'
)
...
@@ -238,6 +238,9 @@ class InventoryAPITestCase(ERP5TypeTestCase):
...
@@ -238,6 +238,9 @@ class InventoryAPITestCase(ERP5TypeTestCase):
kw
.
setdefault
(
'source_section_value'
,
self
.
mirror_section
)
kw
.
setdefault
(
'source_section_value'
,
self
.
mirror_section
)
kw
.
setdefault
(
'destination_value'
,
self
.
node
)
kw
.
setdefault
(
'destination_value'
,
self
.
node
)
kw
.
setdefault
(
'source_value'
,
self
.
mirror_node
)
kw
.
setdefault
(
'source_value'
,
self
.
mirror_node
)
if
is_internal
:
kw
[
'source_section_value'
]
=
None
kw
[
'source_value'
]
=
None
kw
.
setdefault
(
'resource_value'
,
self
.
resource
)
kw
.
setdefault
(
'resource_value'
,
self
.
resource
)
mvt
.
edit
(
**
kw
)
mvt
.
edit
(
**
kw
)
return
mvt
return
mvt
...
@@ -1228,6 +1231,29 @@ class TestInventoryList(InventoryAPITestCase):
...
@@ -1228,6 +1231,29 @@ class TestInventoryList(InventoryAPITestCase):
self
.
assertTrue
(
result
is
not
None
)
self
.
assertTrue
(
result
is
not
None
)
self
.
assertEquals
(
data
[
cur
][
'after'
][
'total_price'
],
round
(
result
))
self
.
assertEquals
(
data
[
cur
][
'after'
][
'total_price'
],
round
(
result
))
# check internal data
internal_data
=
{
'2010/12'
:
dict
(
movement_list
=
[
h
(
103
,
46350
)],
after
=
h
(
269
,
124434
)),
'2011/01'
:
dict
(
movement_list
=
[
h
(
22
,
8910
)],
after
=
h
(
291
,
133344
)),
}
for
month
,
value
in
internal_data
.
iteritems
():
for
mov
in
value
[
'movement_list'
]:
d
=
DateTime
(
'%s/15 15:00 UTC'
%
month
)
self
.
_makeMovement
(
is_internal
=
1
,
start_date
=
d
,
resource_uid
=
resource_uid
,
**
mov
)
for
cur
in
sorted
(
internal_data
):
to_date
=
DateTime
(
"%s/1"
%
cur
)
+
31
# check by section
result
=
self
.
getSimulationTool
().
getInventoryAssetPrice
(
valuation_method
=
"MonthlyWeightedAverage"
,
to_date
=
to_date
,
resource_uid
=
resource
.
getUid
(),
section_uid
=
self
.
section
.
getUid
())
self
.
assertTrue
(
result
is
not
None
)
self
.
assertEquals
(
internal_data
[
cur
][
'after'
][
'total_price'
],
round
(
result
))
class
TestMovementHistoryList
(
InventoryAPITestCase
):
class
TestMovementHistoryList
(
InventoryAPITestCase
):
"""Tests Movement history list methods.
"""Tests Movement history list methods.
"""
"""
...
...
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