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
3277594d
Commit
3277594d
authored
Jan 13, 2025
by
Yvon Kerdoncuff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#7320 : trigger error when trying to add makeup to an unsubscribed person
parent
b067f004
Pipeline
#4051
failed with stage
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletions
+10
-1
admin.py
members/admin.py
+4
-1
models.py
members/models.py
+6
-0
No files found.
members/admin.py
View file @
3277594d
...
@@ -412,7 +412,6 @@ def update_members_makeups(request):
...
@@ -412,7 +412,6 @@ def update_members_makeups(request):
makeup_change_count
=
target_makeups_nb
-
cs
.
get_member_makeups_to_do
(
cm
.
id
)
makeup_change_count
=
target_makeups_nb
-
cs
.
get_member_makeups_to_do
(
cm
.
id
)
points_target
=
cm
.
get_member_points
(
"standard"
)
-
makeup_change_count
points_target
=
cm
.
get_member_points
(
"standard"
)
-
makeup_change_count
if
points_target
<=
unsubscription_limit
:
if
points_target
<=
unsubscription_limit
:
error
=
[]
error
[
"error"
]
\
error
[
"error"
]
\
=
"L'ajout de rattrapage a été annulé car il provoquerait la désinscription d'un membre."
=
"L'ajout de rattrapage a été annulé car il provoquerait la désinscription d'un membre."
return
JsonResponse
(
error
,
status
=
400
)
return
JsonResponse
(
error
,
status
=
400
)
...
@@ -420,6 +419,10 @@ def update_members_makeups(request):
...
@@ -420,6 +419,10 @@ def update_members_makeups(request):
if
res_exempted
:
if
res_exempted
:
error
[
"error"
]
=
"L'opération de rattrapage a été annulée car le membre ciblé est exempté."
error
[
"error"
]
=
"L'opération de rattrapage a été annulée car le membre ciblé est exempté."
return
JsonResponse
(
error
,
status
=
400
)
return
JsonResponse
(
error
,
status
=
400
)
if
cm
.
has_state_unsubscribed_gone_or_associated
():
error
[
"error"
]
=
(
"L'opération de rattrapage a été annulée car le membre ciblé est désinscrit, parti ou"
"associé."
)
return
JsonResponse
(
error
,
status
=
400
)
# Save computed data in member_data. It will be useful to update makeups and points.
# Save computed data in member_data. It will be useful to update makeups and points.
members_data
[
member_data
[
"member_id"
]][
"points_diff"
]
=
-
makeup_change_count
members_data
[
member_data
[
"member_id"
]][
"points_diff"
]
=
-
makeup_change_count
...
...
members/models.py
View file @
3277594d
...
@@ -1158,6 +1158,12 @@ class CagetteMember(models.Model):
...
@@ -1158,6 +1158,12 @@ class CagetteMember(models.Model):
else
:
else
:
return
False
return
False
def
has_state_unsubscribed_gone_or_associated
(
self
):
c
=
[[
'id'
,
'='
,
self
.
id
]]
f
=
[
'cooperative_state'
]
state
=
self
.
o_api
.
search_read
(
"res.partner"
,
c
,
f
)[
0
][
"cooperative_state"
]
return
state
in
(
"unsubscribed"
,
"gone"
,
"associated"
)
class
CagetteMembers
(
models
.
Model
):
class
CagetteMembers
(
models
.
Model
):
"""Class to manage operations on all members or part of them."""
"""Class to manage operations on all members or part of them."""
...
...
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