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
7fb3c6f4
Commit
7fb3c6f4
authored
Mar 10, 2022
by
Thibault Grandjean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete pair
parent
f103fb03
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
admin.py
members/admin.py
+4
-5
No files found.
members/admin.py
View file @
7fb3c6f4
...
...
@@ -555,7 +555,7 @@ def delete_pair(request):
POST:
payload example:
{
"
parent
": {"id": 3075}
"
child
": {"id": 3075}
}
"""
if
request
.
method
==
'GET'
:
...
...
@@ -567,11 +567,10 @@ def delete_pair(request):
if
CagetteUser
.
are_credentials_ok
(
request
):
api
=
OdooAPI
()
data
=
json
.
loads
(
request
.
body
.
decode
())
parent_id
=
data
[
'parent'
][
'id'
]
# get attached account
child
=
api
.
search_read
(
'res.partner'
,
[[
'parent_id'
,
'='
,
parent_id
]],
[
'id'
])[
0
]
api
.
delete
(
'res.partner'
,
[
child
[
'id'
]])
child_id
=
data
[
'child'
][
'id'
]
api
.
update
(
'res.partner'
,
[
int
(
child_id
)],
{
"parent_id"
:
False
,
"is_associated_people"
:
False
})
response
=
JsonResponse
({
"message"
:
"Succesfuly unpaired members"
},
status
=
200
)
else
:
response
=
JsonResponse
({
"message"
:
"Unauthorized"
},
status
=
403
)
return
response
...
...
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