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
1a6574de
Commit
1a6574de
authored
Oct 26, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow other name for commitee shift template (equivalent for Supercoop)
parent
e5d02715
Pipeline
#2466
passed with stage
in 1 minute 28 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
7 deletions
+22
-7
admin.py
members/admin.py
+7
-3
models.py
members/models.py
+6
-2
manage_regular_shifts.js
members/static/js/admin/manage_regular_shifts.js
+2
-2
config.md
outils/config.md
+3
-0
common.js
outils/static/js/common.js
+3
-0
manage_regular_shifts.html
templates/members/admin/manage_regular_shifts.html
+1
-0
No files found.
members/admin.py
View file @
1a6574de
...
@@ -346,6 +346,7 @@ def manage_regular_shifts(request):
...
@@ -346,6 +346,7 @@ def manage_regular_shifts(request):
""" Administration des créneaux des membres """
""" Administration des créneaux des membres """
template
=
loader
.
get_template
(
'members/admin/manage_regular_shifts.html'
)
template
=
loader
.
get_template
(
'members/admin/manage_regular_shifts.html'
)
committees_shift_id
=
CagetteServices
.
get_committees_shift_id
()
committees_shift_id
=
CagetteServices
.
get_committees_shift_id
()
committees_shift_name
=
getattr
(
settings
,
'COMMITTEES_SHIFT_NAME'
,
"service des Comités"
)
context
=
{
context
=
{
'title'
:
'BDM - Créneaux'
,
'title'
:
'BDM - Créneaux'
,
'module'
:
'Membres'
,
'module'
:
'Membres'
,
...
@@ -357,6 +358,7 @@ def manage_regular_shifts(request):
...
@@ -357,6 +358,7 @@ def manage_regular_shifts(request):
'show_ftop_button'
:
getattr
(
settings
,
'BDM_SHOW_FTOP_BUTTON'
,
True
),
'show_ftop_button'
:
getattr
(
settings
,
'BDM_SHOW_FTOP_BUTTON'
,
True
),
'has_committe_shift'
:
committees_shift_id
is
not
None
,
'has_committe_shift'
:
committees_shift_id
is
not
None
,
'committees_shift_id'
:
committees_shift_id
,
'committees_shift_id'
:
committees_shift_id
,
'committees_shift_name'
:
committees_shift_name
,
'ASSOCIATE_MEMBER_SHIFT'
:
getattr
(
settings
,
'ASSOCIATE_MEMBER_SHIFT'
,
''
)
'ASSOCIATE_MEMBER_SHIFT'
:
getattr
(
settings
,
'ASSOCIATE_MEMBER_SHIFT'
,
''
)
}
}
return
HttpResponse
(
template
.
render
(
context
,
request
))
return
HttpResponse
(
template
.
render
(
context
,
request
))
...
@@ -582,7 +584,6 @@ def shift_subscription(request):
...
@@ -582,7 +584,6 @@ def shift_subscription(request):
# First try to get committees shift
# First try to get committees shift
shift_template_id
=
CagetteServices
.
get_committees_shift_id
()
shift_template_id
=
CagetteServices
.
get_committees_shift_id
()
# If None, no committees shift, get the first ftop shift
# If None, no committees shift, get the first ftop shift
if
shift_template_id
is
None
:
if
shift_template_id
is
None
:
shift_template_id
=
CagetteServices
.
get_first_ftop_shift_id
()
shift_template_id
=
CagetteServices
.
get_first_ftop_shift_id
()
...
@@ -604,9 +605,10 @@ def shift_subscription(request):
...
@@ -604,9 +605,10 @@ def shift_subscription(request):
)
)
res
[
"unsubscribe_member"
]
=
m
.
unsubscribe_member
(
changing_shift
=
True
)
res
[
"unsubscribe_member"
]
=
m
.
unsubscribe_member
(
changing_shift
=
True
)
m
.
create_coop_shift_subscription
(
shift_template_id
,
shift_type
)
reg_id
=
m
.
create_coop_shift_subscription
(
shift_template_id
,
shift_type
)
# Return necessary data
# Return necessary data
if
reg_id
is
not
None
:
api
=
OdooAPI
()
api
=
OdooAPI
()
c
=
[[
'id'
,
'='
,
shift_template_id
]]
c
=
[[
'id'
,
'='
,
shift_template_id
]]
f
=
[
'id'
,
'name'
]
f
=
[
'id'
,
'name'
]
...
@@ -615,9 +617,11 @@ def shift_subscription(request):
...
@@ -615,9 +617,11 @@ def shift_subscription(request):
c
=
[[
'id'
,
'='
,
partner_id
]]
c
=
[[
'id'
,
'='
,
partner_id
]]
f
=
[
'cooperative_state'
]
f
=
[
'cooperative_state'
]
res
[
"cooperative_state"
]
=
api
.
search_read
(
'res.partner'
,
c
,
f
)[
0
][
'cooperative_state'
]
res
[
"cooperative_state"
]
=
api
.
search_read
(
'res.partner'
,
c
,
f
)[
0
][
'cooperative_state'
]
coop_logger
.
info
(
"Resultat shift_subscription :
%
s (données reçues =
%
s)"
,
str
(
res
),
str
(
data
))
response
=
JsonResponse
(
res
)
response
=
JsonResponse
(
res
)
else
:
else
:
response
=
JsonResponse
({
"message"
:
"Subscription failed"
},
status
=
500
)
else
:
response
=
JsonResponse
({
"message"
:
"Unauthorized"
},
status
=
403
)
response
=
JsonResponse
({
"message"
:
"Unauthorized"
},
status
=
403
)
return
response
return
response
...
...
members/models.py
View file @
1a6574de
...
@@ -317,7 +317,7 @@ class CagetteMember(models.Model):
...
@@ -317,7 +317,7 @@ class CagetteMember(models.Model):
[
invoice_id
])
[
invoice_id
])
return
[
invoice_id
,
invoice_line_id
]
return
[
invoice_id
,
invoice_line_id
]
def
create_coop_shift_subscription
(
self
,
shift_t_id
,
stype
):
def
create_coop_shift_subscription
(
self
,
shift_t_id
,
stype
,
call_nb
=
1
):
"""Store coop shift subscription."""
"""Store coop shift subscription."""
# Get shift template ticket corresponding to given shift temp. id
# Get shift template ticket corresponding to given shift temp. id
sti
=
None
sti
=
None
...
@@ -345,7 +345,11 @@ class CagetteMember(models.Model):
...
@@ -345,7 +345,11 @@ class CagetteMember(models.Model):
}
}
st_r_id
=
self
.
o_api
.
create
(
'shift.template.registration'
,
st_r_id
=
self
.
o_api
.
create
(
'shift.template.registration'
,
st_r_fields
)
st_r_fields
)
except
:
except
Exception
as
ex
:
if
'seules les inscriptions ABCD sont possibles'
in
str
(
ex
)
and
call_nb
<
2
:
return
self
.
create_coop_shift_subscription
(
shift_t_id
,
1
,
call_nb
+
1
)
else
:
coop_logger
.
error
(
"Error while creating shift.template.registration :
%
s, (fields =
%
s)"
,
str
(
ex
),
str
(
st_r_fields
))
st_r_id
=
None
st_r_id
=
None
return
st_r_id
return
st_r_id
...
...
members/static/js/admin/manage_regular_shifts.js
View file @
1a6574de
...
@@ -193,7 +193,7 @@ function set_subscription_area() {
...
@@ -193,7 +193,7 @@ function set_subscription_area() {
$
(
document
).
on
(
"click"
,
"#shifts_calendar_area button[data-select='Volant']"
,
function
()
{
$
(
document
).
on
(
"click"
,
"#shifts_calendar_area button[data-select='Volant']"
,
function
()
{
// Subscribe to comitee/ftop shift
// Subscribe to comitee/ftop shift
msg
=
(
has_committe_shift
===
"True"
)
msg
=
(
has_committe_shift
===
"True"
)
?
`Inscrire
${
selected_member
.
name
}
au
service des Comités
?`
?
`Inscrire
${
selected_member
.
name
}
au
${
committees_shift_name
}
?`
:
`Inscrire
${
selected_member
.
name
}
en Volant ?`
;
:
`Inscrire
${
selected_member
.
name
}
en Volant ?`
;
openModal
(
openModal
(
...
@@ -281,7 +281,7 @@ $(document).ready(function() {
...
@@ -281,7 +281,7 @@ $(document).ready(function() {
$
(
".page_content"
).
show
();
$
(
".page_content"
).
show
();
if
(
has_committe_shift
===
"True"
)
{
if
(
has_committe_shift
===
"True"
)
{
$
(
"#shifts_calendar_area button[data-select='Volant']"
).
text
(
"Comités"
);
$
(
"#shifts_calendar_area button[data-select='Volant']"
).
text
(
committees_shift_name
);
}
}
// Set action to search for the member
// Set action to search for the member
...
...
outils/config.md
View file @
1a6574de
...
@@ -354,6 +354,9 @@
...
@@ -354,6 +354,9 @@
By default 1. Extension type id (from shift_extension_type table) used to create extension
By default 1. Extension type id (from shift_extension_type table) used to create extension
-
COMMITTEES_SHIFT_NAME = 'Coolisses'
By default "service des Comités"
### Reception
### Reception
-
RECEPTION_ADD_ADMIN_MODE = True
-
RECEPTION_ADD_ADMIN_MODE = True
...
...
outils/static/js/common.js
View file @
1a6574de
...
@@ -447,8 +447,11 @@ function shift_loc_selection() {
...
@@ -447,8 +447,11 @@ function shift_loc_selection() {
if
(
clicked
.
data
(
'select'
)
!=
'Volant'
)
{
if
(
clicked
.
data
(
'select'
)
!=
'Volant'
)
{
retrieve_and_draw_shift_tempates
();
retrieve_and_draw_shift_tempates
();
}
else
{
}
else
{
//shift_templates[volant] is not always set (when call from bdm interface)
if
(
typeof
volant
!==
"undefined"
&&
typeof
shift_templates
[
volant
]
!==
"undefined"
)
{
subscribe_shift
(
volant
);
subscribe_shift
(
volant
);
}
}
}
}
}
...
...
templates/members/admin/manage_regular_shifts.html
View file @
1a6574de
...
@@ -96,6 +96,7 @@
...
@@ -96,6 +96,7 @@
var
couchdb_dbname
=
'{{db}}'
;
var
couchdb_dbname
=
'{{db}}'
;
var
couchdb_server
=
'{{couchdb_server}}'
+
couchdb_dbname
;
var
couchdb_server
=
'{{couchdb_server}}'
+
couchdb_dbname
;
var
committees_shift_id
=
'{{committees_shift_id}}'
;
var
committees_shift_id
=
'{{committees_shift_id}}'
;
const
committees_shift_name
=
'{{committees_shift_name}}'
;
var
ASSOCIATE_MEMBER_SHIFT
=
'{{ASSOCIATE_MEMBER_SHIFT}}'
;
var
ASSOCIATE_MEMBER_SHIFT
=
'{{ASSOCIATE_MEMBER_SHIFT}}'
;
</script>
</script>
<script
src=
'{% static "js/common.js" %}?v=1651853225'
></script>
<script
src=
'{% static "js/common.js" %}?v=1651853225'
></script>
...
...
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