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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
fe9b06e2
Commit
fe9b06e2
authored
Jan 31, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also catalog non accountable movements in stock table
parent
4f0931e7
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
50 additions
and
17 deletions
+50
-17
product/ERP5/Document/BalanceTransaction.py
product/ERP5/Document/BalanceTransaction.py
+3
-3
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
...tem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
+4
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml
...rtal_skins/erp5_core/Resource_zGetMovementHistoryList.xml
+4
-0
product/ERP5/bootstrap/erp5_core/bt/revision
product/ERP5/bootstrap/erp5_core/bt/revision
+1
-1
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_inventory_stock_list.xml
...alog/erp5_mysql_innodb/z_catalog_inventory_stock_list.xml
+2
-1
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_stock_list.xml
...portal_catalog/erp5_mysql_innodb/z_catalog_stock_list.xml
+8
-5
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_inventory_stock.xml
...al_catalog/erp5_mysql_innodb/z_create_inventory_stock.xml
+1
-0
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_stock.xml
...eItem/portal_catalog/erp5_mysql_innodb/z_create_stock.xml
+1
-0
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
+1
-1
product/ERP5/tests/testInventoryAPI.py
product/ERP5/tests/testInventoryAPI.py
+25
-5
No files found.
product/ERP5/Document/BalanceTransaction.py
View file @
fe9b06e2
...
...
@@ -395,8 +395,8 @@ class BalanceTransaction(AccountingTransaction, Inventory):
from
Products.ERP5Type.Document
import
newTempAccountingTransactionLine
# When have to reindex temp objects with quantity 0 in
# order to update stock if delta become 0, but but redefining
# is
Accountable
we do not insert 0 lines in stock
def
is
Accountable
(
self
):
# is
Movement
we do not insert 0 lines in stock
def
is
Movement
(
self
):
return
self
.
getProperty
(
'total_price'
,
0
)
!=
0
or
\
self
.
getProperty
(
'quantity'
,
0
)
!=
0
def
factory
(
*
args
,
**
kw
):
...
...
@@ -408,7 +408,7 @@ class BalanceTransaction(AccountingTransaction, Inventory):
if
destination_total_asset_price
is
not
None
:
kw
[
'destination_total_asset_price'
]
=
destination_total_asset_price
doc
.
_edit
(
*
args
,
**
kw
)
doc
.
is
Accountable
=
types
.
MethodType
(
isAccountable
,
doc
)
doc
.
is
Movement
=
types
.
MethodType
(
isMovement
,
doc
)
if
relative_url
:
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventoryList.xml
View file @
fe9b06e2
...
...
@@ -32,6 +32,7 @@ selection_report\r\n
ignore_variation\r\n
standardize\r\n
omit_simulation\r\n
only_accountable\r\n
section_filtered\r\n
omit_input\r\n
omit_output\r\n
...
...
@@ -197,7 +198,9 @@ WHERE\n
<dtml-if
omit_simulation
>
\n
AND catalog.portal_type != \'Simulation Movement\'\n
</dtml-if>
\n
\n
<dtml-if
only_accountable
>
\n
AND
<dtml-var
stock_table_id
>
.is_accountable\n
</dtml-if>
\n
<dtml-if
selection_domain
>
\n
AND
<dtml-var
"portal_selections.buildSQLExpressionFromDomainSelection(selection_domain,
join_table=
stock_table_id,
join_column=
\'node_uid\')"
>
\n
</dtml-if>
\n
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetMovementHistoryList.xml
View file @
fe9b06e2
...
...
@@ -427,6 +427,7 @@ selection_report\r\n
ignore_variation\r\n
standardize\r\n
omit_simulation\r\n
only_accountable\r\n
omit_input\r\n
omit_output\r\n
omit_asset_increase\r\n
...
...
@@ -540,6 +541,9 @@ WHERE\n
<dtml-if
omit_simulation
>
\n
AND catalog.portal_type != \'Simulation Movement\'\n
</dtml-if>
\n
<dtml-if
only_accountable
>
\n
AND stock.is_accountable\n
</dtml-if>
\n
\n
<dtml-if
omit_input
>
\n
AND ( ( stock.is_cancellation AND stock.quantity > 0 )\n
...
...
product/ERP5/bootstrap/erp5_core/bt/revision
View file @
fe9b06e2
41067
\ No newline at end of file
41068
\ No newline at end of file
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_inventory_stock_list.xml
View file @
fe9b06e2
...
...
@@ -128,8 +128,9 @@ VALUES\n
<dtml-sqlvar
expr=
"row_item[8]"
type=
"int"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[9]"
type=
"int"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[10]"
type=
"int"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[11]"
type=
"int"
>
,
\n
<dtml-sqlvar
expr=
"row_item[11]"
type=
"int"
>
,\n
<dtml-sqlvar
expr=
"row_item[12]"
type=
"float"
optional
>
,\n
1,
<dtml-comment>
only accountable
</dtml-comment>
\n
<dtml-sqlvar
expr=
"row_item[13]"
type=
"datetime"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[14]"
type=
"datetime"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[15]"
type=
"float"
optional
>
,\n
...
...
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_stock_list.xml
View file @
fe9b06e2
...
...
@@ -94,7 +94,7 @@ WHERE\n
\n
<dtml-let
row_list=
"[]"
uid_dict=
"{}"
>
\n
<dtml-in
prefix=
"loop"
expr=
"_.range(_.len(uid))"
>
\n
<dtml-if
"not(isInventoryMovement[loop_item])
and
isMovement[loop_item]
and
isAccountable[loop_item]
and
getResourceUid[loop_item]"
>
\n
<dtml-if
"not(isInventoryMovement[loop_item])
and
isMovement[loop_item]
and
getResourceUid[loop_item]"
>
\n
<dtml-if
"getDestinationUid[loop_item]"
>
\n
<dtml-call
expr=
"uid_dict.update({uid[loop_item]: uid_dict.get(uid[loop_item], -1) + 1})"
>
\n
<dtml-call
expr=
"row_list.append([\n
...
...
@@ -112,6 +112,7 @@ WHERE\n
getResourceUid[loop_item],\n
getInventoriatedQuantity[loop_item],\n
isCancellationAmount[loop_item],\n
isAccountable[loop_item],\n
getStopDate[loop_item], \n
getStartDate[loop_item], \n
getDestinationInventoriatedTotalAssetPrice[loop_item], \n
...
...
@@ -137,6 +138,7 @@ WHERE\n
getResourceUid[loop_item],\n
-(getInventoriatedQuantity[loop_item] or 0), \n
isCancellationAmount[loop_item],\n
isAccountable[loop_item],\n
getStartDate[loop_item], \n
getStopDate[loop_item],\n
getSourceInventoriatedTotalAssetPrice[loop_item], \n
...
...
@@ -168,13 +170,14 @@ VALUES\n
<dtml-sqlvar
expr=
"row_item[11]"
type=
"int"
>
, \n
<dtml-sqlvar
expr=
"row_item[12]"
type=
"float"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[13]"
type=
"int"
>
, \n
<dtml-sqlvar
expr=
"row_item[14]"
type=
"
datetime"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[14]"
type=
"
int"
>
,\n
<dtml-sqlvar
expr=
"row_item[15]"
type=
"datetime"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[16]"
type=
"
float
"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[17]"
type=
"
string
"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[16]"
type=
"
datetime
"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[17]"
type=
"
float
"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[18]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[19]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[20]"
type=
"string"
optional
>
\n
<dtml-sqlvar
expr=
"row_item[20]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"row_item[21]"
type=
"string"
optional
>
\n
)\n
<dtml-if
sequence-end
><dtml-else>
,
</dtml-if>
\n
</dtml-in>
\n
...
...
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_inventory_stock.xml
View file @
fe9b06e2
...
...
@@ -34,6 +34,7 @@
`mirror_node_uid` BIGINT UNSIGNED,\n
`resource_uid` BIGINT UNSIGNED,\n
`quantity` real ,\n
`is_accountable` BOOLEAN,\n
`date` datetime,\n
`mirror_date` datetime,\n
`total_price` real ,\n
...
...
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_stock.xml
View file @
fe9b06e2
...
...
@@ -71,6 +71,7 @@ CREATE TABLE `stock` (\n
`resource_uid` BIGINT UNSIGNED,\n
`quantity` real,\n
`is_cancellation` BOOLEAN,\n
`is_accountable` BOOLEAN,\n
`date` datetime,\n
`mirror_date` datetime,\n
`total_price` real ,\n
...
...
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/revision
View file @
fe9b06e2
239
\ No newline at end of file
243
\ No newline at end of file
product/ERP5/tests/testInventoryAPI.py
View file @
fe9b06e2
...
...
@@ -288,8 +288,8 @@ class TestInventory(InventoryAPITestCase):
def
test_SimulationMovementisAccountable
(
self
):
"""Test Simulation Movements are not accountable if related to a delivery.
"""
sim_mvt
=
self
.
_makeSimulationMovement
(
quantity
=
100
)
mvt
=
self
.
_makeMovement
(
quantity
=
100
)
sim_mvt
=
self
.
_makeSimulationMovement
(
quantity
=
2
)
mvt
=
self
.
_makeMovement
(
quantity
=
3
)
# simulation movement are accountable,
self
.
failUnless
(
sim_mvt
.
isAccountable
())
# unless connected to a delivery movement
...
...
@@ -297,7 +297,9 @@ class TestInventory(InventoryAPITestCase):
self
.
failIf
(
sim_mvt
.
isAccountable
())
# not accountable movement are not counted by getInventory
self
.
tic
()
# (after reindexing of course)
self
.
assertInventoryEquals
(
100
,
section_uid
=
self
.
section
.
getUid
())
self
.
assertInventoryEquals
(
3
,
section_uid
=
self
.
section
.
getUid
())
# unless you pass only_accountable=False
self
.
assertInventoryEquals
(
5
,
section_uid
=
self
.
section
.
getUid
(),
only_accountable
=
False
)
def
test_OmitSimulation
(
self
):
"""Test omit_simulation argument to getInventory.
...
...
@@ -1789,6 +1791,24 @@ class TestMovementHistoryList(InventoryAPITestCase):
self
.
assertEquals
(
1
,
len
(
movement_history_list
))
self
.
assertEquals
(
100
,
movement_history_list
[
0
].
quantity
)
def
test_OnlyAccountable
(
self
):
"""Test that only_accountable works with getMovementHistoryList"""
getMovementHistoryList
=
self
.
getSimulationTool
().
getMovementHistoryList
self
.
_makeMovement
(
quantity
=
2
)
self
.
_makeMovement
(
quantity
=
3
,
is_accountable
=
False
)
# by default, only accountable movements are returned
movement_history_list
=
getMovementHistoryList
(
section_uid
=
self
.
section
.
getUid
(),)
self
.
assertEquals
(
1
,
len
(
movement_history_list
))
self
.
assertEquals
(
2
,
movement_history_list
[
0
].
quantity
)
# unless only_accountable=False is passed
movement_history_list
=
getMovementHistoryList
(
section_uid
=
self
.
section
.
getUid
(),
only_accountable
=
False
)
self
.
assertEquals
(
2
,
len
(
movement_history_list
))
self
.
assertEquals
(
sorted
((
2
,
3
)),
sorted
(
brain
.
quantity
for
brain
in
movement_history_list
))
def
test_RunningTotalQuantity
(
self
):
"""Test that a running_total_quantity attribute is set on brains
"""
...
...
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