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
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
Nikola Balog
erp5
Commits
8bd2a320
Commit
8bd2a320
authored
Jan 31, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
base: don't use cmp in QuantitySignMovementGroup
parent
26e83ef6
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 @
8bd2a320
...
...
@@ -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