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
9f76a924
Commit
9f76a924
authored
Nov 23, 2023
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[5349] Suppression des services rattrapages déjà choisis lorsqu'un membre devient volant.
parent
eab9fccb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
admin.py
members/admin.py
+23
-22
No files found.
members/admin.py
View file @
9f76a924
...
@@ -597,8 +597,11 @@ def shift_subscription(request):
...
@@ -597,8 +597,11 @@ def shift_subscription(request):
if
'success'
in
credentials
and
credentials
[
'success'
]
is
True
and
credentials
[
'id'
]
==
partner_id
:
if
'success'
in
credentials
and
credentials
[
'success'
]
is
True
and
credentials
[
'id'
]
==
partner_id
:
is_allowed
=
True
is_allowed
=
True
if
is_allowed
is
True
:
if
is_allowed
is
True
:
api
=
OdooAPI
()
partner_id
=
int
(
data
[
"partner_id"
])
partner_id
=
int
(
data
[
"partner_id"
])
shift_type
=
data
[
"shift_type"
]
shift_type
=
data
[
"shift_type"
]
moving_from_std_to_ftop
=
False
if
shift_type
==
1
:
if
shift_type
==
1
:
# 1 = standard
# 1 = standard
shift_template_id
=
int
(
data
[
"shift_template_id"
])
shift_template_id
=
int
(
data
[
"shift_template_id"
])
...
@@ -610,13 +613,16 @@ def shift_subscription(request):
...
@@ -610,13 +613,16 @@ def shift_subscription(request):
# 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
()
c
=
[[
'id'
,
'='
,
partner_id
]]
f
=
[
'shift_type'
]
moving_from_std_to_ftop
=
api
.
search_read
(
'res.partner'
,
c
,
f
)[
0
][
'shift_type'
]
==
'standard'
else
:
else
:
# 3 = exempté
# 3 = exempté
# Get exemptions shift
# Get exemptions shift
shift_template_id
=
CagetteServices
.
get_exemptions_shift_id
()
shift_template_id
=
CagetteServices
.
get_exemptions_shift_id
()
m
=
CagetteMember
(
partner_id
)
m
=
CagetteMember
(
partner_id
)
api
=
OdooAPI
()
unsubscribe_first
=
data
[
"unsubscribe_first"
]
unsubscribe_first
=
data
[
"unsubscribe_first"
]
if
unsubscribe_first
is
True
:
if
unsubscribe_first
is
True
:
...
@@ -631,11 +637,11 @@ def shift_subscription(request):
...
@@ -631,11 +637,11 @@ def shift_subscription(request):
},
},
status
=
409
status
=
409
)
)
changing_shift
=
not
moving_from_std_to_ftop
res
[
"unsubscribe_member"
]
=
m
.
unsubscribe_member
(
changing_shift
)
res
[
"unsubscribe_member"
]
=
m
.
unsubscribe_member
(
changing_shift
=
True
)
if
moving_from_std_to_ftop
:
lower_makeup_count_to_zero_if_moving_from_std_to_ftop
(
partner_id
,
res
)
# https://redmine.coopdev.fr/issues/4715
lower_makeup_count_to_zero_if_moving_from_std_to_ftop
(
api
,
partner_id
,
shift_type
,
res
)
reg_id
=
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
...
@@ -657,23 +663,18 @@ def shift_subscription(request):
...
@@ -657,23 +663,18 @@ def shift_subscription(request):
return
response
return
response
def
lower_makeup_count_to_zero_if_moving_from_std_to_ftop
(
api
,
partner_id
,
shift_type
,
res
):
def
lower_makeup_count_to_zero_if_moving_from_std_to_ftop
(
partner_id
,
res
):
if
shift_type
==
2
:
members_data
=
[]
c
=
[[
'id'
,
'='
,
partner_id
]]
members_data
.
append
({
f
=
[
'shift_type'
]
'member_id'
:
partner_id
,
old_shift_type
=
api
.
search_read
(
'res.partner'
,
c
,
f
)[
0
][
'shift_type'
]
'member_shift_type'
:
'standard'
,
if
old_shift_type
==
'standard'
:
'target_makeups_nb'
:
0
,
members_data
=
[]
'description'
:
'reset automatique du compteur rattrapages suite changement créneau standard vers non standard'
members_data
.
append
({
})
'member_id'
:
partner_id
,
res
[
"res"
]
=
[]
'member_shift_type'
:
old_shift_type
,
update_members_makeups_core
(
members_data
,
res
)
'target_makeups_nb'
:
0
,
if
res
[
"res"
][
0
][
"update"
]:
'description'
:
'reset automatique du compteur rattrapages suite changement créneau standard vers non standard'
res
[
"makeups_to_do"
]
=
0
})
res
[
"res"
]
=
[]
update_members_makeups_core
(
members_data
,
res
)
if
res
[
"res"
][
0
][
"update"
]:
res
[
"makeups_to_do"
]
=
0
# --- Gestion des binômes
# --- Gestion des binômes
...
...
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