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
4e179f7a
Commit
4e179f7a
authored
Jan 31, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*: use key instead of cmp to sort
parent
562249eb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
66 deletions
+25
-66
bt5/erp5_calendar/SkinTemplateItem/portal_skins/erp5_calendar/PersonModule_getLeaveRequestReportLineList.py
...p5_calendar/PersonModule_getLeaveRequestReportLineList.py
+1
-4
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.BusinessConfiguration.py
.../portal_components/document.erp5.BusinessConfiguration.py
+3
-3
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingTransactionModule_getNetSalaryReportSectionLineList.py
...ingTransactionModule_getNetSalaryReportSectionLineList.py
+4
-10
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingTransactionModule_getPaySheetLineReportSectionLineList.py
...TransactionModule_getPaySheetLineReportSectionLineList.py
+8
-13
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getMovementList.py
...skins/erp5_payroll/PaySheetTransaction_getMovementList.py
+6
-32
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderStatList.py
...m/portal_skins/erp5_trade/OrderModule_getOrderStatList.py
+3
-4
No files found.
bt5/erp5_calendar/SkinTemplateItem/portal_skins/erp5_calendar/PersonModule_getLeaveRequestReportLineList.py
View file @
4e179f7a
...
...
@@ -68,10 +68,7 @@ for person in person_value_list:
total
=
person_total
,
**
result_dict
))
result_list
.
sort
(
lambda
a
,
b
:
cmp
(
a
.
person_career_reference
or
a
.
person_title
,
b
.
person_career_reference
or
b
.
person_title
))
result_list
.
sort
(
key
=
lambda
r
:
(
r
.
person_career_reference
or
''
,
r
.
person_title
or
''
))
request
.
set
(
'total_time'
,
total_time
)
request
.
set
(
'total_time_per_resource'
,
total_time_per_resource
)
...
...
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.BusinessConfiguration.py
View file @
4e179f7a
...
...
@@ -553,12 +553,12 @@ class BusinessConfiguration(Item):
"immediateReindexObject"
])
# build
configuration_save_list
=
self
.
contentValues
(
portal_type
=
'Configuration Save'
)
configuration_save_list
.
sort
(
lambda
x
,
y
:
cmp
(
x
.
getIntIndex
(
x
.
getIntId
()),
y
.
getIntIndex
(
y
.
getIntId
())))
configuration_save_list
.
sort
(
key
=
lambda
x
:
(
x
.
getIntIndex
(
x
.
getIntId
())
or
0
))
for
configuration_save
in
configuration_save_list
:
# XXX: check which items are configure-able
configuration_item_list
=
configuration_save
.
contentValues
()
configuration_item_list
.
sort
(
lambda
x
,
y
:
cmp
(
x
.
getIntId
(),
y
.
getIntId
()))
configuration_item_list
.
sort
(
key
=
lambda
x
:
(
x
.
getIntId
()
or
0
))
for
configurator_item
in
configuration_item_list
:
configurator_item
.
activate
(
**
kw
).
fixConsistency
(
filter
=
{
"constraint_type"
:
"configuration"
})
...
...
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingTransactionModule_getNetSalaryReportSectionLineList.py
View file @
4e179f7a
...
...
@@ -58,13 +58,7 @@ for inventory in portal.portal_simulation.getInventoryList(
request
.
set
(
'total_price'
,
total_price
)
def
sort_method
(
a
,
b
):
employee_career_reference_diff
=
cmp
(
a
.
employee_career_reference
,
b
.
employee_career_reference
)
if
employee_career_reference_diff
:
return
employee_career_reference_diff
return
cmp
(
a
.
employee_title
,
b
.
employee_title
)
object_list
.
sort
(
sort_method
)
return
object_list
return
sorted
(
object_list
,
key
=
lambda
o
:
(
o
.
employee_career_reference
or
''
,
o
.
employee_title
)
)
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/AccountingTransactionModule_getPaySheetLineReportSectionLineList.py
View file @
4e179f7a
...
...
@@ -38,10 +38,10 @@ inventory_param_dict = {
}
employee_param_dict
=
inventory_param_dict
.
copy
()
employee_param_dict
[
'contribution_share_uid'
]
=
context
.
portal_categories
.
contribution_share
.
employee
.
getUid
()
employee_param_dict
[
'contribution_share_uid'
]
=
portal
.
portal_categories
.
contribution_share
.
employee
.
getUid
()
employer_param_dict
=
inventory_param_dict
.
copy
()
employer_param_dict
[
'contribution_share_uid'
]
=
context
.
portal_categories
.
contribution_share
.
employer
.
getUid
()
employer_param_dict
[
'contribution_share_uid'
]
=
portal
.
portal_categories
.
contribution_share
.
employer
.
getUid
()
if
request
.
get
(
'mirror_section'
):
mirror_section
=
request
[
'mirror_section'
]
...
...
@@ -116,17 +116,12 @@ sorted_inventory_list = []
sorted_inventory_list
=
inventory_list
.
values
()
# sort by salary range, and add intermediate sums if needed
def
sort_method
(
a
,
b
):
salary_range_diff
=
cmp
(
a
.
salary_range
,
b
.
salary_range
)
if
salary_range_diff
:
return
salary_range_diff
employee_career_reference_diff
=
cmp
(
a
.
employee_career_reference
,
b
.
employee_career_reference
)
if
employee_career_reference_diff
:
return
employee_career_reference_diff
return
cmp
(
a
.
employee_title
,
b
.
employee_title
)
sorted_inventory_list
.
sort
(
sort_method
)
sorted_inventory_list
.
sort
(
key
=
lambda
i
:
(
i
.
salary_range
or
''
,
i
.
employee_career_reference
or
''
,
i
.
employee_title
or
''
,
))
i
=
0
intermediate_base_total
=
0
...
...
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getMovementList.py
View file @
4e179f7a
...
...
@@ -120,38 +120,12 @@ for paysheet_line in paysheet_line_list:
if
'no_slice'
in
object_dict
:
line_list
.
append
(
paysheet_line
.
asContext
(
**
object_dict
[
'no_slice'
]))
# sort results
def
sortByTitleAscending
(
x
,
y
):
return
cmp
(
x
.
getTitle
(),
y
.
getTitle
())
def
sortByTitleDescending
(
x
,
y
):
return
cmp
(
y
.
getTitle
(),
x
.
getTitle
())
def
sortByIntIndexAscending
(
x
,
y
):
return
cmp
(
x
.
getIntIndex
(),
y
.
getIntIndex
())
def
sortByIntIndexDescending
(
x
,
y
):
return
cmp
(
y
.
getIntIndex
(),
x
.
getIntIndex
())
sortByDefaultSortMethod
=
sortByIntIndexAscending
reverse
=
False
sort_key
=
lambda
l
:
(
l
.
getIntIndex
()
or
0
)
if
'sort_on'
in
kw
:
sort_on
=
kw
[
'sort_on'
]
if
sort_on
[
0
][
0
]
==
'title'
and
sort_on
[
0
][
1
]
==
'ascending'
:
line_list
.
sort
(
sortByTitleAscending
)
elif
sort_on
[
0
][
0
]
==
'title'
and
sort_on
[
0
][
1
]
==
'descending'
:
line_list
.
sort
(
sortByTitleDescending
)
elif
sort_on
[
0
][
0
]
==
'int_index'
and
sort_on
[
0
][
1
]
==
'ascending'
:
line_list
.
sort
(
sortByIntIndexAscending
)
elif
sort_on
[
0
][
0
]
==
'int_index'
and
sort_on
[
0
][
1
]
==
'descending'
:
line_list
.
sort
(
sortByIntIndexDescending
)
else
:
line_list
.
sort
(
sortByDefaultSortMethod
)
else
:
line_list
.
sort
(
sortByDefaultSortMethod
)
reverse
=
sort_on
[
0
][
1
]
==
'descending'
if
sort_on
[
0
][
0
]
==
'title'
:
sort_key
=
lambda
l
:
(
l
.
getTitle
()
or
''
)
return
line_list
return
sorted
(
line_list
,
key
=
sort_key
,
reverse
=
reverse
)
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/OrderModule_getOrderStatList.py
View file @
4e179f7a
...
...
@@ -57,8 +57,6 @@ if active_process_path:
else
:
raise
ValueError
(
"No active process found to process report"
)
def
sortProduct
(
a
,
b
):
return
cmp
(
a
[
'product'
],
b
[
'product'
])
period_counter_dict
=
{}
line_list
=
[]
...
...
@@ -132,7 +130,7 @@ if len(client_dict):
product_lines_list
.
append
(
obj
)
# sort product list
product_lines_list
.
sort
(
sortProduct
)
product_lines_list
.
sort
(
key
=
lambda
p
:
p
[
'product'
]
)
extend
(
product_lines_list
)
else
:
# products
...
...
@@ -169,7 +167,8 @@ else:
period_counter_dict
[
'total amount'
]
=
line_total_amount
append
(
obj
)
line_list
.
sort
(
sortProduct
)
line_list
.
sort
(
key
=
lambda
p
:
p
[
'product'
])
obj
=
Object
(
uid
=
"new_"
)
obj
[
"client"
]
=
'Total'
...
...
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