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
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
18 deletions
+33
-18
admin.py
members/admin.py
+16
-12
models.py
members/models.py
+7
-3
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
+4
-1
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):
""" Administration des créneaux des membres """
template
=
loader
.
get_template
(
'members/admin/manage_regular_shifts.html'
)
committees_shift_id
=
CagetteServices
.
get_committees_shift_id
()
committees_shift_name
=
getattr
(
settings
,
'COMMITTEES_SHIFT_NAME'
,
"service des Comités"
)
context
=
{
'title'
:
'BDM - Créneaux'
,
'module'
:
'Membres'
,
...
...
@@ -357,6 +358,7 @@ def manage_regular_shifts(request):
'show_ftop_button'
:
getattr
(
settings
,
'BDM_SHOW_FTOP_BUTTON'
,
True
),
'has_committe_shift'
:
committees_shift_id
is
not
None
,
'committees_shift_id'
:
committees_shift_id
,
'committees_shift_name'
:
committees_shift_name
,
'ASSOCIATE_MEMBER_SHIFT'
:
getattr
(
settings
,
'ASSOCIATE_MEMBER_SHIFT'
,
''
)
}
return
HttpResponse
(
template
.
render
(
context
,
request
))
...
...
@@ -582,7 +584,6 @@ def shift_subscription(request):
# First try to get committees shift
shift_template_id
=
CagetteServices
.
get_committees_shift_id
()
# If None, no committees shift, get the first ftop shift
if
shift_template_id
is
None
:
shift_template_id
=
CagetteServices
.
get_first_ftop_shift_id
()
...
...
@@ -604,19 +605,22 @@ def shift_subscription(request):
)
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
api
=
OdooAPI
()
c
=
[[
'id'
,
'='
,
shift_template_id
]]
f
=
[
'id'
,
'name'
]
res
[
"shift_template"
]
=
api
.
search_read
(
'shift.template'
,
c
,
f
)[
0
]
c
=
[[
'id'
,
'='
,
partner_id
]]
f
=
[
'cooperative_state'
]
res
[
"cooperative_state"
]
=
api
.
search_read
(
'res.partner'
,
c
,
f
)[
0
][
'cooperative_state'
]
response
=
JsonResponse
(
res
)
if
reg_id
is
not
None
:
api
=
OdooAPI
()
c
=
[[
'id'
,
'='
,
shift_template_id
]]
f
=
[
'id'
,
'name'
]
res
[
"shift_template"
]
=
api
.
search_read
(
'shift.template'
,
c
,
f
)[
0
]
c
=
[[
'id'
,
'='
,
partner_id
]]
f
=
[
'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
)
else
:
response
=
JsonResponse
({
"message"
:
"Subscription failed"
},
status
=
500
)
else
:
response
=
JsonResponse
({
"message"
:
"Unauthorized"
},
status
=
403
)
...
...
members/models.py
View file @
1a6574de
...
...
@@ -317,7 +317,7 @@ class CagetteMember(models.Model):
[
invoice_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."""
# Get shift template ticket corresponding to given shift temp. id
sti
=
None
...
...
@@ -345,8 +345,12 @@ class CagetteMember(models.Model):
}
st_r_id
=
self
.
o_api
.
create
(
'shift.template.registration'
,
st_r_fields
)
except
:
st_r_id
=
None
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
return
st_r_id
...
...
members/static/js/admin/manage_regular_shifts.js
View file @
1a6574de
...
...
@@ -193,7 +193,7 @@ function set_subscription_area() {
$
(
document
).
on
(
"click"
,
"#shifts_calendar_area button[data-select='Volant']"
,
function
()
{
// Subscribe to comitee/ftop shift
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 ?`
;
openModal
(
...
...
@@ -281,7 +281,7 @@ $(document).ready(function() {
$
(
".page_content"
).
show
();
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
...
...
outils/config.md
View file @
1a6574de
...
...
@@ -354,6 +354,9 @@
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_ADD_ADMIN_MODE = True
...
...
outils/static/js/common.js
View file @
1a6574de
...
...
@@ -447,7 +447,10 @@ function shift_loc_selection() {
if
(
clicked
.
data
(
'select'
)
!=
'Volant'
)
{
retrieve_and_draw_shift_tempates
();
}
else
{
subscribe_shift
(
volant
);
//shift_templates[volant] is not always set (when call from bdm interface)
if
(
typeof
volant
!==
"undefined"
&&
typeof
shift_templates
[
volant
]
!==
"undefined"
)
{
subscribe_shift
(
volant
);
}
}
}
...
...
templates/members/admin/manage_regular_shifts.html
View file @
1a6574de
...
...
@@ -96,6 +96,7 @@
var
couchdb_dbname
=
'{{db}}'
;
var
couchdb_server
=
'{{couchdb_server}}'
+
couchdb_dbname
;
var
committees_shift_id
=
'{{committees_shift_id}}'
;
const
committees_shift_name
=
'{{committees_shift_name}}'
;
var
ASSOCIATE_MEMBER_SHIFT
=
'{{ASSOCIATE_MEMBER_SHIFT}}'
;
</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