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
67c384d5
Commit
67c384d5
authored
Apr 12, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#2836 : Can set status as 'gone' for members who are unassociated (via members/admin interface)
parent
bc637211
Pipeline
#2099
passed with stage
in 1 minute 27 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
11 deletions
+49
-11
admin.py
members/admin.py
+14
-4
manage_attached.css
members/static/css/admin/manage_attached.css
+5
-0
manage_attached.js
members/static/js/admin/manage_attached.js
+10
-3
common.css
outils/static/css/common.css
+5
-0
manage_attached_delete_pair.html
templates/members/admin/manage_attached_delete_pair.html
+15
-4
No files found.
members/admin.py
View file @
67c384d5
...
@@ -710,7 +710,13 @@ def delete_pair(request):
...
@@ -710,7 +710,13 @@ def delete_pair(request):
POST:
POST:
payload example:
payload example:
{
{
"child": {"id": 3075}
"child": {
"id": "1620"
},
"gone": [
"parent",
"child"
]
}
}
"""
"""
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
...
@@ -727,10 +733,14 @@ def delete_pair(request):
...
@@ -727,10 +733,14 @@ def delete_pair(request):
child_accounts
=
api
.
search_read
(
'res.partner'
,
[[
'email'
,
'='
,
child
[
'email'
]]],
[
'id'
,
'email'
])
child_accounts
=
api
.
search_read
(
'res.partner'
,
[[
'email'
,
'='
,
child
[
'email'
]]],
[
'id'
,
'email'
])
prev_child
=
[
x
[
'id'
]
for
x
in
child_accounts
if
x
[
'id'
]
!=
child_id
]
prev_child
=
[
x
[
'id'
]
for
x
in
child_accounts
if
x
[
'id'
]
!=
child_id
]
parent
=
api
.
search_read
(
'res.partner'
,
[[
'id'
,
'='
,
child
[
'parent_id'
][
0
]]],
[
'cooperative_state'
])[
0
]
parent
=
api
.
search_read
(
'res.partner'
,
[[
'id'
,
'='
,
child
[
'parent_id'
][
0
]]],
[
'cooperative_state'
])[
0
]
api
.
update
(
'res.partner'
,
[
child_id
],
{
"parent_id"
:
False
,
"is_associated_people"
:
False
})
api
.
update
(
'res.partner'
,
[
child_id
],
{
"parent_id"
:
False
,
"is_associated_people"
:
False
,
"active"
:
False
,
"is_former_associated_people"
:
True
})
api
.
delete
(
'res.partner'
,
[
child_id
])
child_update_fields
=
{
'cooperative_state'
:
"unsubscribed"
,
"is_former_associated_people"
:
True
}
if
'gone'
in
data
and
'child'
in
data
[
'gone'
]:
child_update_fields
[
'cooperative_state'
]
=
"gone"
for
id
in
prev_child
:
for
id
in
prev_child
:
api
.
update
(
"res.partner"
,
[
id
],
{
'cooperative_state'
:
"unsubscribed"
})
api
.
update
(
"res.partner"
,
[
id
],
child_update_fields
)
if
'gone'
in
data
and
'parent'
in
data
[
'gone'
]:
api
.
update
(
"res.partner"
,
[
parent
[
'id'
]],
{
'cooperative_state'
:
"gone"
,
"is_former_associated_people"
:
True
})
response
=
JsonResponse
({
"message"
:
"Succesfuly unpaired members"
},
status
=
200
)
response
=
JsonResponse
({
"message"
:
"Succesfuly unpaired members"
},
status
=
200
)
...
...
members/static/css/admin/manage_attached.css
View file @
67c384d5
...
@@ -116,3 +116,7 @@
...
@@ -116,3 +116,7 @@
.spinner
{
.spinner
{
height
:
40px
;
height
:
40px
;
}
}
/* Modale */
.attached-members
.member
div
{
width
:
50px
;
display
:
inline-block
;}
.attached-members
.member
div
.name
{
width
:
80%
;}
\ No newline at end of file
members/static/js/admin/manage_attached.js
View file @
67c384d5
...
@@ -195,8 +195,14 @@ function display_attached_members() {
...
@@ -195,8 +195,14 @@ function display_attached_members() {
}
}
function
delete_pair
(
childId
)
{
function
delete_pair
(
childId
,
gone_checked
)
{
var
payload
=
{
"child"
:
{
"id"
:
childId
}};
var
payload
=
{
"child"
:
{
"id"
:
childId
},
"gone"
:
[]};
if
(
gone_checked
.
length
>
0
)
{
$
.
each
(
gone_checked
,
function
(
i
,
e
)
{
const
elts
=
$
(
e
).
attr
(
'name'
).
split
(
"_"
)
payload
[
'gone'
].
push
(
elts
[
0
])
});
}
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
...
@@ -229,9 +235,10 @@ function confirmDeletion(childId) {
...
@@ -229,9 +235,10 @@ function confirmDeletion(childId) {
modalContent
=
modalContent
.
html
();
modalContent
=
modalContent
.
html
();
openModal
(
modalContent
,
()
=>
{
openModal
(
modalContent
,
()
=>
{
if
(
is_time_to
(
'delete_pair'
))
{
if
(
is_time_to
(
'delete_pair'
))
{
const
gone_checked
=
$
(
'input.after_unattached_state:checked'
);
closeModal
();
closeModal
();
openModal
();
openModal
();
delete_pair
(
childId
)
delete_pair
(
childId
,
gone_checked
)
}
}
},
'Valider'
,
false
);
},
'Valider'
,
false
);
}
}
...
...
outils/static/css/common.css
View file @
67c384d5
...
@@ -29,6 +29,11 @@ footer { position: fixed;
...
@@ -29,6 +29,11 @@ footer { position: fixed;
z-index
:
10
;
z-index
:
10
;
}
}
.warning_instruction
{
font-weight
:
bold
;
font-style
:
italic
;
color
:
blue
;
}
#deconnect
,
#password_change
{
float
:
right
;
margin-left
:
5px
;}
#deconnect
,
#password_change
{
float
:
right
;
margin-left
:
5px
;}
/* The Overlay (background) */
/* The Overlay (background) */
...
...
templates/members/admin/manage_attached_delete_pair.html
View file @
67c384d5
...
@@ -16,15 +16,26 @@
...
@@ -16,15 +16,26 @@
{% block content %}
{% block content %}
<div
id=
"template"
style=
"display:None;"
>
<div
id=
"template"
style=
"display:None;"
>
<div
id=
"confirmModal"
>
<div
id=
"confirmModal"
>
<div
class=
"mconfirm"
>
<h3>
Le binôme est sur le point d'être désolidarisé
</h3>
<h3>
Le binôme est sur le point d'être désolidarisé
</h3>
<br
/>
<br
/>
<p>
Êtes-vous sur de vouloir désolidariser
<b><span
id=
"parentName"
></span></b>
et
<div>
<b><span
id=
"childName"
></span></b>
Êtes-vous sur de vouloir désolidariser
<div
class=
"attached-members"
>
<div
class=
"member"
>
<div
class=
"name"
><strong><span
id=
"parentName"
></span></strong>
(titulaire)
</div>
<div><input
type=
"checkbox"
name=
"parent_gone"
class=
"after_unattached_state"
/></div>
</div>
<div
class=
"member"
>
<div
class=
"name"
><strong><span
id=
"childName"
></span></strong></div>
<div><input
type=
"checkbox"
name=
"child_gone"
class=
"after_unattached_state"
/></div>
</div>
</div>
</div>
<p
class=
"warning_instruction"
>
Dans le cas d'une désolidarisation liée à une démission de la coopérative,
<br/>
cochez le membre que vous souhaitez mettre en statut "Parti·e"
</p>
</p>
<hr/>
<hr/>
</div>
</div>
</div>
</div>
</div>
<div
class=
"page_body"
>
<div
class=
"page_body"
>
<div
id=
"back_to_admin_index"
>
<div
id=
"back_to_admin_index"
>
...
...
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