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
141
Merge Requests
141
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
29e8ce81
Commit
29e8ce81
authored
Jan 31, 2024
by
Jérome Perrin
Committed by
Arnaud Fontaine
Jul 05, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
base: don't use cmp in QuantitySignMovementGroup
parent
b25c6f91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.QuantitySignMovementGroup.py
...tal_components/document.erp5.QuantitySignMovementGroup.py
+9
-2
No files found.
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.QuantitySignMovementGroup.py
View file @
29e8ce81
...
...
@@ -48,6 +48,13 @@ whether this is really required.
from
erp5.component.document.MovementGroup
import
MovementGroup
def
_getSign
(
quantity
):
if
quantity
==
0
:
return
0
return
1
if
quantity
>
0
else
-
1
class
QuantitySignMovementGroup
(
MovementGroup
):
"""
The purpose of MovementGroup is to define how movements are grouped,
...
...
@@ -59,7 +66,7 @@ class QuantitySignMovementGroup(MovementGroup):
def
_getPropertyDict
(
self
,
movement
,
**
kw
):
property_dict
=
{}
quantity
=
movement
.
getQuantity
()
property_dict
[
'quantity_sign'
]
=
cmp
(
quantity
,
0
)
property_dict
[
'quantity_sign'
]
=
_getSign
(
quantity
)
return
property_dict
def
_separate
(
self
,
movement_list
,
**
kw
):
...
...
@@ -68,7 +75,7 @@ class QuantitySignMovementGroup(MovementGroup):
tmp_list
=
[[],
[],
[]]
# -1:minus, 0:zero, 1:plus
for
movement
in
movement_list
:
tmp_list
[
cmp
(
movement
.
getQuantity
(),
0
)].
append
(
movement
)
tmp_list
[
_getSign
(
movement
.
getQuantity
()
)].
append
(
movement
)
if
len
(
tmp_list
[
1
]):
if
len
(
tmp_list
[
-
1
]):
return
[
...
...
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