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):
...
@@ -61,21 +61,22 @@ class CagetteMember(models.Model):
image
=
res
[
0
][
'image_medium'
]
image
=
res
[
0
][
'image_medium'
]
return
image
return
image
# def update_member_points(self, status):
def
update_member_points
(
self
,
data
):
"""
# fields = {'name': reason,
ex:
# 'shift_id': False,
data = {
# 'type': stype,
'name': reason,
# 'partner_id': self.id,
'shift_id': False,
# 'point_qty': pts
'type': stype,
# }
'partner_id': self.id,
# return self.o_api.create('shift.counter.event', fields)
'point_qty': pts
}
# if status not in ["suspended", "delay", "up_to_date", "unsuscribed", "alert"]:
"""
# raise Exception("Bad status")
try
:
# f = { 'cooperative_state': "delay" }
return
self
.
o_api
.
create
(
'shift.counter.event'
,
data
)
# return self.o_api.update('res.partner', [self.id], f)
except
Exception
as
e
:
print
(
str
(
e
))
# # # BDM
# # # BDM
...
...
shifts/views.py
View file @
4d3070db
...
@@ -276,6 +276,7 @@ def request_delay(request):
...
@@ -276,6 +276,7 @@ def request_delay(request):
if
'verif_token'
in
request
.
POST
:
if
'verif_token'
in
request
.
POST
:
if
Verification
.
verif_token
(
request
.
POST
.
get
(
'verif_token'
),
int
(
request
.
POST
.
get
(
'idPartner'
)))
is
True
:
if
Verification
.
verif_token
(
request
.
POST
.
get
(
'verif_token'
),
int
(
request
.
POST
.
get
(
'idPartner'
)))
is
True
:
cs
=
CagetteShift
()
cs
=
CagetteShift
()
partner_id
=
int
(
request
.
POST
[
'idPartner'
])
use_new_members_space
=
getattr
(
settings
,
'USE_NEW_MEMBERS_SPACE'
,
False
)
use_new_members_space
=
getattr
(
settings
,
'USE_NEW_MEMBERS_SPACE'
,
False
)
if
use_new_members_space
is
True
:
if
use_new_members_space
is
True
:
...
@@ -285,7 +286,7 @@ def request_delay(request):
...
@@ -285,7 +286,7 @@ def request_delay(request):
return
JsonResponse
(
res
,
status
=
403
)
return
JsonResponse
(
res
,
status
=
403
)
data
=
{
data
=
{
"idPartner"
:
int
(
request
.
POST
[
'idPartner'
])
,
"idPartner"
:
partner_id
,
"start_date"
:
request
.
POST
[
'start_date'
]
"start_date"
:
request
.
POST
[
'start_date'
]
}
}
if
(
'extension_beginning'
in
request
.
POST
):
if
(
'extension_beginning'
in
request
.
POST
):
...
@@ -299,6 +300,30 @@ def request_delay(request):
...
@@ -299,6 +300,30 @@ def request_delay(request):
try
:
try
:
new_id
=
cs
.
create_delay
(
data
,
duration
)
new_id
=
cs
.
create_delay
(
data
,
duration
)
if
(
new_id
):
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
}
response
=
{
'result'
:
True
}
else
:
else
:
coop_logger
.
error
(
"request delay :
%
s,
%
s"
,
str
(
new_id
),
str
(
data
))
coop_logger
.
error
(
"request delay :
%
s,
%
s"
,
str
(
new_id
),
str
(
data
))
...
...
templates/members_space/index.html
View file @
4d3070db
...
@@ -57,9 +57,9 @@
...
@@ -57,9 +57,9 @@
<div
id=
"calendar_explaination_template"
>
<div
id=
"calendar_explaination_template"
>
<h4>
Légende du calendrier
</h4>
<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>
<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>
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.
<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>
<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