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
2c65a595
Commit
2c65a595
authored
Apr 12, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Plain Diff
fix merge conflict
parents
6fc24383
67c384d5
Pipeline
#2102
passed with stage
in 1 minute 30 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
15 deletions
+67
-15
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
inscriptions.js
members/static/js/inscriptions.js
+18
-4
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 @
2c65a595
...
@@ -758,7 +758,13 @@ def delete_pair(request):
...
@@ -758,7 +758,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'
:
...
@@ -775,10 +781,14 @@ def delete_pair(request):
...
@@ -775,10 +781,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 @
2c65a595
...
@@ -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 @
2c65a595
...
@@ -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"
,
...
@@ -230,9 +236,10 @@ function confirmDeletion(childId) {
...
@@ -230,9 +236,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
);
}
}
...
...
members/static/js/inscriptions.js
View file @
2c65a595
...
@@ -230,9 +230,11 @@ function _really_save_new_coop(email, fname, lname, cap, pm, cn, bc, msex) {
...
@@ -230,9 +230,11 @@ function _really_save_new_coop(email, fname, lname, cap, pm, cn, bc, msex) {
function
store_new_coop
(
event
)
{
function
store_new_coop
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
var
errors
=
[],
var
errors
=
[],
bc
=
''
,
// barcode may not be present
bc
=
''
,
// barcode may not be present
msex
=
''
;
// sex may not be present
msex
=
''
,
// sex may not be present
active_asso_area
=
$
(
'#associate_area .choice_active'
);
// need to ckeck if associated data are available
// 1- Un coop avec le meme mail ne doit pas exister dans odoo (dans base intermediaire, le cas est géré par l'erreur à l'enregistrement)
// 1- Un coop avec le meme mail ne doit pas exister dans odoo (dans base intermediaire, le cas est géré par l'erreur à l'enregistrement)
let
email
=
$
(
'input[name="email"]'
).
val
()
let
email
=
$
(
'input[name="email"]'
).
val
()
.
trim
(),
.
trim
(),
...
@@ -257,6 +259,19 @@ function store_new_coop(event) {
...
@@ -257,6 +259,19 @@ function store_new_coop(event) {
}
}
}
}
if
(
active_asso_area
.
length
>
0
)
{
// If user click as if a "binôme" is beeing created, data about parent member must exist
let
associated_data_ok
=
false
;
if
(
(
$
(
active_asso_area
[
0
]).
attr
(
'id'
)
===
"new_member_choice"
&&
$
(
'#new_member_input'
).
val
().
trim
().
length
>
0
)
||
(
$
(
active_asso_area
[
0
]).
attr
(
'id'
)
===
"existing_member_choice"
&&
$
(
'#existing_member_choice_action .chosen_associate div.member'
).
length
>
0
)
)
{
associated_data_ok
=
true
;
}
if
(
associated_data_ok
===
false
)
errors
.
push
(
"Le membre 'titulaire' du binôme n'est pas défini"
);
}
$
.
ajax
({
url
:
'/members/exists/'
+
email
,
$
.
ajax
({
url
:
'/members/exists/'
+
email
,
dataType
:
'json'
dataType
:
'json'
})
})
...
@@ -294,8 +309,7 @@ function store_new_coop(event) {
...
@@ -294,8 +309,7 @@ function store_new_coop(event) {
}
}
}
}
});
});
}
}
...
@@ -670,7 +684,7 @@ function display_possible_members() {
...
@@ -670,7 +684,7 @@ function display_possible_members() {
if
(
member
.
id
==
$
(
this
).
attr
(
'member_id'
))
{
if
(
member
.
id
==
$
(
this
).
attr
(
'member_id'
))
{
selected_associate
=
member
;
selected_associate
=
member
;
var
member_button
=
'<div member_id="'
+
member
.
id
+
'"
>'
+
member
.
barcode_base
+
' - '
+
member
.
name
+
'</button
>'
;
var
member_button
=
'<div member_id="'
+
member
.
id
+
'"
class="member">'
+
member
.
barcode_base
+
' - '
+
member
.
name
+
'</div
>'
;
$
(
'.chosen_associate'
).
html
(
member_button
);
$
(
'.chosen_associate'
).
html
(
member_button
);
$
(
'.chosen_associate_area'
).
show
();
$
(
'.chosen_associate_area'
).
show
();
...
...
outils/static/css/common.css
View file @
2c65a595
...
@@ -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 @
2c65a595
...
@@ -16,14 +16,25 @@
...
@@ -16,14 +16,25 @@
{% 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"
>
...
...
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