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
4d3070db
Commit
4d3070db
authored
Nov 19, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
force status update after delay creation
parent
0825e1e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
18 deletions
+44
-18
models.py
members/models.py
+16
-15
views.py
shifts/views.py
+26
-1
index.html
templates/members_space/index.html
+2
-2
No files found.
members/models.py
View file @
4d3070db
...
...
@@ -61,21 +61,22 @@ class CagetteMember(models.Model):
image
=
res
[
0
][
'image_medium'
]
return
image
# def update_member_points(self, status):
# fields = {'name': reason,
# 'shift_id': False,
# 'type': stype,
# 'partner_id': self.id,
# 'point_qty': pts
# }
# return self.o_api.create('shift.counter.event', fields)
# if status not in ["suspended", "delay", "up_to_date", "unsuscribed", "alert"]:
# raise Exception("Bad status")
# f = { 'cooperative_state': "delay" }
# return self.o_api.update('res.partner', [self.id], f)
def
update_member_points
(
self
,
data
):
"""
ex:
data = {
'name': reason,
'shift_id': False,
'type': stype,
'partner_id': self.id,
'point_qty': pts
}
"""
try
:
return
self
.
o_api
.
create
(
'shift.counter.event'
,
data
)
except
Exception
as
e
:
print
(
str
(
e
))
# # # BDM
...
...
shifts/views.py
View file @
4d3070db
...
...
@@ -276,6 +276,7 @@ def request_delay(request):
if
'verif_token'
in
request
.
POST
:
if
Verification
.
verif_token
(
request
.
POST
.
get
(
'verif_token'
),
int
(
request
.
POST
.
get
(
'idPartner'
)))
is
True
:
cs
=
CagetteShift
()
partner_id
=
int
(
request
.
POST
[
'idPartner'
])
use_new_members_space
=
getattr
(
settings
,
'USE_NEW_MEMBERS_SPACE'
,
False
)
if
use_new_members_space
is
True
:
...
...
@@ -285,7 +286,7 @@ def request_delay(request):
return
JsonResponse
(
res
,
status
=
403
)
data
=
{
"idPartner"
:
int
(
request
.
POST
[
'idPartner'
])
,
"idPartner"
:
partner_id
,
"start_date"
:
request
.
POST
[
'start_date'
]
}
if
(
'extension_beginning'
in
request
.
POST
):
...
...
@@ -299,6 +300,30 @@ def request_delay(request):
try
:
new_id
=
cs
.
create_delay
(
data
,
duration
)
if
(
new_id
):
try
:
cm
=
CagetteMember
(
partner_id
)
# Add 0 pt to counter so odoo updates member status
data
=
{
'name'
:
"Forcer l'entrée en délai"
,
'shift_id'
:
False
,
'type'
:
"standard"
,
'partner_id'
:
partner_id
,
'point_qty'
:
0
}
cm
.
update_member_points
(
data
)
data
=
{
'name'
:
"Forcer l'entrée en délai"
,
'shift_id'
:
False
,
'type'
:
"ftop"
,
'partner_id'
:
partner_id
,
'point_qty'
:
0
}
cm
.
update_member_points
(
data
)
except
Exception
as
e
:
print
(
str
(
e
))
response
=
{
'result'
:
True
}
else
:
coop_logger
.
error
(
"request delay :
%
s,
%
s"
,
str
(
new_id
),
str
(
data
))
...
...
templates/members_space/index.html
View file @
4d3070db
...
...
@@ -57,9 +57,9 @@
<div
id=
"calendar_explaination_template"
>
<h4>
Légende du calendrier
</h4>
<a
class=
"example-event fc-daygrid-event fc-daygrid-block-event fc-h-event fc-event fc-event-start fc-event-end fc-event-future shift_booked"
><div
class=
"fc-event-main"
><div
class=
"fc-event-main-frame"
><div
class=
"fc-event-time"
>
06:00
</div><div
class=
"fc-event-title-container"
><div
class=
"fc-event-title fc-sticky"
>
-
-
9/12
</div></div></div></div></a>
<a
class=
"example-event fc-daygrid-event fc-daygrid-block-event fc-h-event fc-event fc-event-start fc-event-end fc-event-future shift_booked"
><div
class=
"fc-event-main"
><div
class=
"fc-event-main-frame"
><div
class=
"fc-event-time"
>
06:00
</div><div
class=
"fc-event-title-container"
><div
class=
"fc-event-title fc-sticky"
>
- 9/12
</div></div></div></div></a>
<p>
Un service colorié en noir : je suis déjà inscrit.e à ce service.
</p>
<a
class=
"example-event fc-daygrid-event fc-daygrid-block-event fc-h-event fc-event fc-event-start fc-event-end fc-event-future shift_less_alf"
><div
class=
"fc-event-main"
><div
class=
"fc-event-main-frame"
><div
class=
"fc-event-time"
>
10:45
</div><div
class=
"fc-event-title-container"
><div
class=
"fc-event-title fc-sticky"
>
-
-
3/12
</div></div></div></div></a>
<a
class=
"example-event fc-daygrid-event fc-daygrid-block-event fc-h-event fc-event fc-event-start fc-event-end fc-event-future shift_less_alf"
><div
class=
"fc-event-main"
><div
class=
"fc-event-main-frame"
><div
class=
"fc-event-time"
>
10:45
</div><div
class=
"fc-event-title-container"
><div
class=
"fc-event-title fc-sticky"
>
- 3/12
</div></div></div></div></a>
<p>
Un service colorié en bleu : je peux m'inscrire à ce service.
</p>
<p>
3/12
<i
class=
"arrow_explanation_numbers fas fa-arrow-right"
></i>
il y a déjà 3 places réservées à ce service sur 12 disponibles.
<b>
Plus le chiffre de gauche est petit, plus on a besoin de coopérateurs.rices à ce service !
</b></p>
...
...
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