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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
erp5
Commits
38f68c1f
Commit
38f68c1f
authored
Feb 05, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite InventoryLine/Cell.getTotalInventory to get rid of InventoryLine_zGetTotal
parent
bd44aa55
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
90 deletions
+2
-90
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/InventoryLine_zGetTotal.xml
...eItem/portal_skins/erp5_trade/InventoryLine_zGetTotal.xml
+0
-76
product/ERP5/Document/InventoryCell.py
product/ERP5/Document/InventoryCell.py
+2
-7
product/ERP5/Document/InventoryLine.py
product/ERP5/Document/InventoryLine.py
+0
-7
No files found.
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/InventoryLine_zGetTotal.xml
deleted
100644 → 0
View file @
bd44aa55
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"SQL"
module=
"Products.ZSQLMethods.SQL"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
allow_simple_one_argument_traversal
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string>
uid
</string>
</value>
</item>
<item>
<key>
<string>
cache_time_
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
class_file_
</string>
</key>
<value>
<string>
ZSQLCatalog.zsqlbrain
</string>
</value>
</item>
<item>
<key>
<string>
class_name_
</string>
</key>
<value>
<string>
ZSQLBrain
</string>
</value>
</item>
<item>
<key>
<string>
connection_hook
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
connection_id
</string>
</key>
<value>
<string>
erp5_sql_connection
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
InventoryLine_zGetTotal
</string>
</value>
</item>
<item>
<key>
<string>
max_cache_
</string>
</key>
<value>
<int>
100
</int>
</value>
</item>
<item>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
SELECT \n
\tSUM(inventory) AS total_inventory, \n
\tSUM(inventory * price) AS total_price, \n
\tAVG(price) AS average_price\n
FROM\n
catalog, movement\n
WHERE \n
\tcatalog.parent_uid = <dtml-sqlvar uid type="int">
\n
AND\t\n
\tcatalog.uid = movement.uid\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/Document/InventoryCell.py
View file @
38f68c1f
...
@@ -66,14 +66,9 @@ class InventoryCell(DeliveryCell):
...
@@ -66,14 +66,9 @@ class InventoryCell(DeliveryCell):
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTotalInventory'
)
def
getTotalInventory
(
self
):
def
getTotalInventory
(
self
):
"""
"""
Returns the inventory
if no cell or the total inventory if cells
Returns the inventory
, as cells are not supposed to contain more cells.
"""
"""
if
not
self
.
hasCellContent
():
return
self
.
getInventory
()
return
self
.
getInventory
()
else
:
# Use MySQL
aggregate
=
self
.
InventoryLine_zGetTotal
()[
0
]
return
aggregate
.
total_inventory
or
0.0
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getQuantity'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getQuantity'
)
def
getQuantity
(
self
):
def
getQuantity
(
self
):
...
...
product/ERP5/Document/InventoryLine.py
View file @
38f68c1f
...
@@ -70,13 +70,6 @@ class InventoryLine(DeliveryLine):
...
@@ -70,13 +70,6 @@ class InventoryLine(DeliveryLine):
if
not
self
.
hasCellContent
():
if
not
self
.
hasCellContent
():
return
self
.
getInventory
()
return
self
.
getInventory
()
else
:
else
:
# Use MySQL
# There is no inventory column in mysql any more,
# is it required to add it again. It is only
# usefull for the user interface
# aggregate = self.InventoryLine_zGetTotal()[0]
# return aggregate.total_inventory or 0.0
total_quantity
=
0.0
total_quantity
=
0.0
for
cell
in
self
.
getCellValueList
(
base_id
=
'movement'
):
for
cell
in
self
.
getCellValueList
(
base_id
=
'movement'
):
if
cell
.
getInventory
()
is
not
None
:
if
cell
.
getInventory
()
is
not
None
:
...
...
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