Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
3c00ed51
Commit
3c00ed51
authored
Feb 28, 2022
by
Thibault Grandjean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
retrieve member info
parent
b22feabf
Pipeline
#1851
passed with stage
in 1 minute 30 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
2 deletions
+55
-2
admin.py
members/admin.py
+53
-2
urls.py
members/urls.py
+2
-0
No files found.
members/admin.py
View file @
3c00ed51
...
...
@@ -405,4 +405,56 @@ def delete_shift_registration(request):
else
:
res
[
"message"
]
=
"Unauthorized"
response
=
JsonResponse
(
res
,
status
=
403
)
return
response
\ No newline at end of file
return
response
# Gestion des binômes
def
get_member_info
(
request
,
member_id
):
"""Retrieve information about a member."""
res
=
{}
is_connected_user
=
CagetteUser
.
are_credentials_ok
(
request
)
if
is_connected_user
:
api
=
OdooAPI
()
fields
=
[
'id'
,
'sex'
,
'cooperative_state'
,
'email'
,
'street'
,
'street2'
,
'zip'
,
'city'
,
'current_template_name'
,
'shift_type'
,
'parent_id'
,
'is_associated_people'
,
]
member
=
api
.
search_read
(
'res.partner'
,
[[
'id'
,
'='
,
member_id
]],
fields
)
# get incomming shifts
fields
=
[
"date_begin"
,
"date_end"
,
"final_standard_point"
,
"shift_id"
,
"shift_type"
,
"partner_id"
,
"id"
,
]
cond
=
[
[
"partner_id.id"
,
"="
,
member_id
],
[
"state"
,
"="
,
"open"
],
[
"date_begin"
,
">"
,
datetime
.
datetime
.
now
()
.
isoformat
()],
]
shifts
=
api
.
search_read
(
'shift.registration'
,
cond
,
fields
,
order
=
"date_begin ASC"
)
if
member
:
res
[
'member'
]
=
member
[
0
]
res
[
'member'
][
'incoming_shifts'
]
=
shifts
response
=
JsonResponse
(
res
)
else
:
response
=
JsonResponse
({
"message"
:
"Not found"
},
status
=
404
)
else
:
res
[
'message'
]
=
"Unauthorized"
response
=
JsonResponse
(
res
,
status
=
403
)
print
(
response
.
content
)
return
response
members/urls.py
View file @
3c00ed51
...
...
@@ -61,4 +61,6 @@ urlpatterns = [
url
(
r'^get_makeups_members$'
,
admin
.
get_makeups_members
),
url
(
r'^update_members_makeups$'
,
admin
.
update_members_makeups
),
url
(
r'^delete_shift_registration$'
,
admin
.
delete_shift_registration
),
url
(
r'^get_member_info/(\d+)$'
,
admin
.
get_member_info
),
]
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