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):
if
'success'
in
credentials
and
credentials
[
'success'
]
is
True
and
credentials
[
'id'
]
==
partner_id
:
is_allowed
=
True
if
is_allowed
is
True
:
api
=
OdooAPI
()
partner_id
=
int
(
data
[
"partner_id"
])
shift_type
=
data
[
"shift_type"
]
moving_from_std_to_ftop
=
False
if
shift_type
==
1
:
# 1 = standard
shift_template_id
=
int
(
data
[
"shift_template_id"
])
...
...
@@ -610,13 +613,16 @@ def shift_subscription(request):
# 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
()
c
=
[[
'id'
,
'='
,
partner_id
]]
f
=
[
'shift_type'
]
moving_from_std_to_ftop
=
api
.
search_read
(
'res.partner'
,
c
,
f
)[
0
][
'shift_type'
]
==
'standard'
else
:
# 3 = exempté
# Get exemptions shift
shift_template_id
=
CagetteServices
.
get_exemptions_shift_id
()
m
=
CagetteMember
(
partner_id
)
api
=
OdooAPI
()
unsubscribe_first
=
data
[
"unsubscribe_first"
]
if
unsubscribe_first
is
True
:
...
...
@@ -631,11 +637,11 @@ def shift_subscription(request):
},
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
)
# https://redmine.coopdev.fr/issues/4715
lower_makeup_count_to_zero_if_moving_from_std_to_ftop
(
api
,
partner_id
,
shift_type
,
res
)
if
moving_from_std_to_ftop
:
lower_makeup_count_to_zero_if_moving_from_std_to_ftop
(
partner_id
,
res
)
reg_id
=
m
.
create_coop_shift_subscription
(
shift_template_id
,
shift_type
)
# Return necessary data
...
...
@@ -657,23 +663,18 @@ def shift_subscription(request):
return
response
def
lower_makeup_count_to_zero_if_moving_from_std_to_ftop
(
api
,
partner_id
,
shift_type
,
res
):
if
shift_type
==
2
:
c
=
[[
'id'
,
'='
,
partner_id
]]
f
=
[
'shift_type'
]
old_shift_type
=
api
.
search_read
(
'res.partner'
,
c
,
f
)[
0
][
'shift_type'
]
if
old_shift_type
==
'standard'
:
members_data
=
[]
members_data
.
append
({
'member_id'
:
partner_id
,
'member_shift_type'
:
old_shift_type
,
'target_makeups_nb'
:
0
,
'description'
:
'reset automatique du compteur rattrapages suite changement créneau standard vers non standard'
})
res
[
"res"
]
=
[]
update_members_makeups_core
(
members_data
,
res
)
if
res
[
"res"
][
0
][
"update"
]:
res
[
"makeups_to_do"
]
=
0
def
lower_makeup_count_to_zero_if_moving_from_std_to_ftop
(
partner_id
,
res
):
members_data
=
[]
members_data
.
append
({
'member_id'
:
partner_id
,
'member_shift_type'
:
'standard'
,
'target_makeups_nb'
:
0
,
'description'
:
'reset automatique du compteur rattrapages suite changement créneau standard vers non standard'
})
res
[
"res"
]
=
[]
update_members_makeups_core
(
members_data
,
res
)
if
res
[
"res"
][
0
][
"update"
]:
res
[
"makeups_to_do"
]
=
0
# --- 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