Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
1abc4bac
Commit
1abc4bac
authored
May 23, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amount_generator: simplify AggregatedAmountList
multiplyQuantity() is dead code since commit
74838d44
parent
4db1663c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
29 deletions
+11
-29
product/ERP5/AggregatedAmountList.py
product/ERP5/AggregatedAmountList.py
+11
-29
No files found.
product/ERP5/AggregatedAmountList.py
View file @
1abc4bac
...
@@ -28,10 +28,8 @@
...
@@ -28,10 +28,8 @@
##############################################################################
##############################################################################
import
zope.interface
import
zope.interface
from
AccessControl
import
allow_class
from
Products.ERP5Type
import
interfaces
from
Products.ERP5Type
import
interfaces
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.PythonScripts.Utility
import
allow_class
from
AccessControl
import
ClassSecurityInfo
class
AggregatedAmountList
(
list
):
class
AggregatedAmountList
(
list
):
"""
"""
...
@@ -40,42 +38,26 @@ class AggregatedAmountList(list):
...
@@ -40,42 +38,26 @@ class AggregatedAmountList(list):
"""
"""
zope
.
interface
.
implements
(
interfaces
.
IAmountList
)
zope
.
interface
.
implements
(
interfaces
.
IAmountList
)
meta_type
=
"AggregatedAmountList"
security
=
ClassSecurityInfo
()
# security.declareObjectPublic()
security
.
declarePublic
(
'getTotalPrice'
)
def
getTotalPrice
(
self
):
def
getTotalPrice
(
self
):
"""
"""
Return total base price
Return total base price
"""
"""
result
=
sum
(
filter
(
lambda
y
:
y
is
not
None
,
result
=
0
map
(
lambda
x
:
x
.
getTotalPrice
(),
self
)))
for
amount
in
self
:
total_price
=
amount
.
getTotalPrice
()
if
total_price
:
result
+=
total_price
return
result
return
result
security
.
declarePublic
(
'getTotalDuration'
)
def
getTotalDuration
(
self
):
def
getTotalDuration
(
self
):
"""
"""
Return total duration
Return total duration
"""
"""
result
=
sum
(
filter
(
lambda
y
:
y
is
not
None
,
result
=
0
map
(
lambda
x
:
x
.
getDuration
(),
self
)))
for
amount
in
self
:
duration
=
amount
.
getDuration
()
if
duration
:
result
+=
duration
return
result
return
result
def
multiplyQuantity
(
self
,
context
=
None
):
"""
Take into account the quantity of the
context. Change the quantity of each element.
"""
quantity
=
None
if
context
is
not
None
:
if
context
.
getQuantity
()
is
not
None
:
quantity
=
context
.
getQuantity
()
if
quantity
is
not
None
:
for
x
in
self
:
previous_quantity
=
x
.
getQuantity
()
if
previous_quantity
is
not
None
:
x
.
edit
(
quantity
=
context
.
getQuantity
()
*
previous_quantity
)
InitializeClass
(
AggregatedAmountList
)
allow_class
(
AggregatedAmountList
)
allow_class
(
AggregatedAmountList
)
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