Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arnaud Fontaine
erp5
Commits
a32d6425
Commit
a32d6425
authored
Feb 01, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test & fix behaviour with movements with NULL price & 0 quantity
parent
8dddf306
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
4 deletions
+23
-4
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
...tem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
+2
-2
product/ERP5/bootstrap/erp5_core/bt/revision
product/ERP5/bootstrap/erp5_core/bt/revision
+1
-1
product/ERP5/tests/testInventoryAPI.py
product/ERP5/tests/testInventoryAPI.py
+20
-1
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
View file @
a32d6425
...
...
@@ -97,7 +97,7 @@ SELECT\n
<dtml-if
transformed_uid
>
* transformation.quantity
</dtml-if>
,
<dtml-var
precision
>
))\n
AS converted_quantity,\n
</dtml-if>
\n
SUM(ROUND(
<dtml-var
stock_table_id
>
.total_price,
<dtml-var
precision
>
)
) AS total_price\n
IFNULL(SUM(ROUND(
<dtml-var
stock_table_id
>
.total_price,
<dtml-var
precision
>
)), 0
) AS total_price\n
<dtml-else>
\n
SUM(
<dtml-var
stock_table_id
>
.quantity
<dtml-if
transformed_uid
>
* transformation.quantity
</dtml-if>
) AS inventory,\n
SUM(
<dtml-var
stock_table_id
>
.quantity
<dtml-if
transformed_uid
>
* transformation.quantity
</dtml-if>
) AS total_quantity,\n
...
...
@@ -107,7 +107,7 @@ SELECT\n
<dtml-if
transformed_uid
>
* transformation.quantity
</dtml-if>
), 12)\n
AS converted_quantity,\n
</dtml-if>
\n
SUM(
<dtml-var
stock_table_id
>
.total_price
) AS total_price\n
IFNULL(SUM(
<dtml-var
stock_table_id
>
.total_price), 0
) AS total_price\n
</dtml-if>
\n
<dtml-if
inventory_list
>
\n
,node.title AS node_title,\n
...
...
product/ERP5/bootstrap/erp5_core/bt/revision
View file @
a32d6425
41068
\ No newline at end of file
41069
\ No newline at end of file
product/ERP5/tests/testInventoryAPI.py
View file @
a32d6425
...
...
@@ -819,6 +819,15 @@ class TestInventoryList(InventoryAPITestCase):
# default is an empty list
self
.
assertEquals
(
0
,
len
(
inventory_list
))
def
testDefault0
(
self
):
getInventoryList
=
self
.
getSimulationTool
().
getInventoryList
self
.
_makeMovement
()
inventory_list
=
getInventoryList
(
section_uid
=
self
.
section
.
getUid
(),)
self
.
assertEquals
(
1
,
len
(
inventory_list
))
self
.
assertEquals
(
0
,
inventory_list
[
0
].
total_quantity
)
# The total price of grouped movements without price is 0
self
.
assertEquals
(
0
,
inventory_list
[
0
].
total_price
)
def
test_GroupByNode
(
self
):
getInventoryList
=
self
.
getSimulationTool
().
getInventoryList
self
.
_makeMovement
(
quantity
=
100
)
...
...
@@ -1395,6 +1404,16 @@ class TestMovementHistoryList(InventoryAPITestCase):
# default is an empty list
self
.
assertEquals
(
0
,
len
(
mvt_history_list
))
def
testDefault0
(
self
):
self
.
_makeMovement
()
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
mvt_history_list
=
getMovementHistoryList
(
section_uid
=
self
.
section
.
getUid
(),)
self
.
assertEquals
(
1
,
len
(
mvt_history_list
))
self
.
assertEquals
(
0
,
mvt_history_list
[
0
].
total_quantity
)
# If a movement have no price, None is returned
self
.
assertEquals
(
None
,
mvt_history_list
[
0
].
total_price
)
def
testMovementBothSides
(
self
):
"""Movement History List returns movement from both sides"""
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
...
...
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