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
a8cc5d42
Commit
a8cc5d42
authored
Sep 29, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix makeups errors
parent
edafd2a3
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
14 deletions
+48
-14
models.py
members/models.py
+16
-0
models.py
members_space/models.py
+4
-3
members-space-home.js
members_space/static/js/members-space-home.js
+2
-1
members-space-my-shifts.js
members_space/static/js/members-space-my-shifts.js
+2
-1
members-space-shifts-exchange.js
members_space/static/js/members-space-shifts-exchange.js
+10
-0
views.py
members_space/views.py
+3
-1
views.py
shifts/views.py
+11
-0
index.html
templates/members_space/index.html
+0
-8
No files found.
members/models.py
View file @
a8cc5d42
...
@@ -61,6 +61,22 @@ class CagetteMember(models.Model):
...
@@ -61,6 +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):
# 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)
@staticmethod
@staticmethod
def
retrieve_data_according_keys
(
keys
,
full
=
False
):
def
retrieve_data_according_keys
(
keys
,
full
=
False
):
api
=
OdooAPI
()
api
=
OdooAPI
()
...
...
members_space/models.py
View file @
a8cc5d42
...
@@ -11,12 +11,13 @@ class CagetteMembersSpace(models.Model):
...
@@ -11,12 +11,13 @@ class CagetteMembersSpace(models.Model):
"""Init with odoo id."""
"""Init with odoo id."""
self
.
o_api
=
OdooAPI
()
self
.
o_api
=
OdooAPI
()
def
get_points_history
(
self
,
partner_id
,
limit
,
offset
,
date_from
):
def
get_points_history
(
self
,
partner_id
,
limit
,
offset
,
date_from
,
shift_type
):
""" Get partner points history with related shift registration if needed """
""" Get partner points history with related shift registration if needed """
cond
=
[
cond
=
[
[
'partner_id'
,
'='
,
partner_id
],
[
'partner_id'
,
'='
,
partner_id
],
[
'type'
,
'='
,
'ftop'
],
[
'type'
,
'='
,
shift_type
],
[
'create_date'
,
'>'
,
date_from
]
[
'create_date'
,
'>'
,
date_from
],
[
'point_qty'
,
'!='
,
0
]
]
]
f
=
[
'create_date'
,
'create_uid'
,
'shift_id'
,
'name'
,
'point_qty'
]
f
=
[
'create_date'
,
'create_uid'
,
'shift_id'
,
'name'
,
'point_qty'
]
...
...
members_space/static/js/members-space-home.js
View file @
a8cc5d42
...
@@ -30,7 +30,8 @@ function request_delay() {
...
@@ -30,7 +30,8 @@ function request_delay() {
verif_token
:
partner_data
.
verif_token
,
verif_token
:
partner_data
.
verif_token
,
idPartner
:
partner_data
.
partner_id
,
idPartner
:
partner_data
.
partner_id
,
start_date
:
delay_start
,
start_date
:
delay_start
,
duration
:
diff_days
duration
:
diff_days
,
shift_type
:
(
partner_data
.
in_ftop_team
===
"True"
)
?
"ftop"
:
"standard"
},
},
success
:
function
()
{
success
:
function
()
{
partner_data
.
cooperative_state
=
'delay'
;
partner_data
.
cooperative_state
=
'delay'
;
...
...
members_space/static/js/members-space-my-shifts.js
View file @
a8cc5d42
...
@@ -14,7 +14,8 @@ function load_partner_history(offset = 0) {
...
@@ -14,7 +14,8 @@ function load_partner_history(offset = 0) {
partner_id
:
partner_data
.
concerned_partner_id
,
partner_id
:
partner_data
.
concerned_partner_id
,
verif_token
:
partner_data
.
verif_token
,
verif_token
:
partner_data
.
verif_token
,
limit
:
history_items_limit
,
limit
:
history_items_limit
,
offset
:
offset
offset
:
offset
,
shift_type
:
(
partner_data
.
in_ftop_team
===
"True"
)
?
"ftop"
:
"standard"
},
},
dataType
:
"json"
,
dataType
:
"json"
,
traditional
:
true
,
traditional
:
true
,
...
...
members_space/static/js/members-space-shifts-exchange.js
View file @
a8cc5d42
...
@@ -271,6 +271,16 @@ function init_calendar_page() {
...
@@ -271,6 +271,16 @@ function init_calendar_page() {
);
);
}
else
if
(
can_select_makeup
())
{
}
else
if
(
can_select_makeup
())
{
/* choose a makeup service */
/* choose a makeup service */
// Check if selected new shift is in less than 6 months
if
(
partner_data
.
date_delay_stop
!==
'False'
)
{
date_partner_delay_stop
=
new
Date
(
partner_data
.
date_delay_stop
);
if
(
datetime_new_shift
>
date_partner_delay_stop
)
{
let
msg
=
`Vous avez jusqu'au
${
date_partner_delay_stop
.
toLocaleDateString
(
"fr-fr"
,
date_options
)}
`
+
`pour sélectionner un rattrapage (soit une période de 6 mois depuis votre absence).`
;
alert
(
msg
);
return
;
}
}
let
modal_template
=
$
(
"#modal_add_shift_template"
);
let
modal_template
=
$
(
"#modal_add_shift_template"
);
modal_template
.
find
(
".date_new_shift"
).
text
(
new_shift_date
);
modal_template
.
find
(
".date_new_shift"
).
text
(
new_shift_date
);
...
...
members_space/views.py
View file @
a8cc5d42
...
@@ -160,7 +160,8 @@ def get_points_history(request):
...
@@ -160,7 +160,8 @@ def get_points_history(request):
limit
=
int
(
request
.
GET
.
get
(
'limit'
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
))
offset
=
int
(
request
.
GET
.
get
(
'offset'
))
offset
=
int
(
request
.
GET
.
get
(
'offset'
))
shift_type
=
request
.
GET
.
get
(
'shift_type'
)
date_from
=
getattr
(
settings
,
'START_DATE_FOR_POINTS_HISTORY'
,
'2018-01-01'
)
date_from
=
getattr
(
settings
,
'START_DATE_FOR_POINTS_HISTORY'
,
'2018-01-01'
)
res
[
"data"
]
=
m
.
get_points_history
(
partner_id
,
limit
,
offset
,
date_from
)
res
[
"data"
]
=
m
.
get_points_history
(
partner_id
,
limit
,
offset
,
date_from
,
shift_type
)
return
JsonResponse
(
res
)
return
JsonResponse
(
res
)
\ No newline at end of file
shifts/views.py
View file @
a8cc5d42
...
@@ -3,6 +3,7 @@ from outils.for_view_imports import *
...
@@ -3,6 +3,7 @@ from outils.for_view_imports import *
from
outils.common
import
Verification
from
outils.common
import
Verification
from
shifts.models
import
CagetteShift
from
shifts.models
import
CagetteShift
from
members.models
import
CagetteMember
# working_state = ['up_to_date', 'alert', 'exempted', 'delay', 'suspended']
# working_state = ['up_to_date', 'alert', 'exempted', 'delay', 'suspended']
state_shift_allowed
=
[
"up_to_date"
,
"alert"
,
"delay"
]
state_shift_allowed
=
[
"up_to_date"
,
"alert"
,
"delay"
]
...
@@ -289,6 +290,16 @@ def request_delay(request):
...
@@ -289,6 +290,16 @@ 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
:
if
(
'shift_type'
in
request
.
POST
):
shift_type
=
request
.
POST
[
'shift_type'
]
# This is a hack to ensure that the coop goes in delay state when a delay is created
cm
=
CagetteMember
(
int
(
request
.
POST
[
'idPartner'
]))
res_addpt
=
cm
.
add_pts
(
shift_type
,
0
,
"[fo] passage en délai"
)
except
Exception
as
e
:
coop_logger
.
error
(
"force_delay_status :
%
s,
%
s"
,
str
(
e
),
str
(
data
))
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 @
a8cc5d42
...
@@ -62,16 +62,8 @@
...
@@ -62,16 +62,8 @@
"partner_id"
:
"{{partnerData.id}}"
,
"partner_id"
:
"{{partnerData.id}}"
,
"name"
:
"{{partnerData.display_name}}"
,
"name"
:
"{{partnerData.display_name}}"
,
"in_ftop_team"
:
"{{partnerData.in_ftop_team}}"
,
"in_ftop_team"
:
"{{partnerData.in_ftop_team}}"
,
"final_standard_point"
:
"{{partnerData.final_standard_point}}"
,
"final_ftop_point"
:
"{{partnerData.final_ftop_point}}"
,
"date_delay_stop"
:
"{{partnerData.date_delay_stop}}"
,
"date_delay_stop"
:
"{{partnerData.date_delay_stop}}"
,
"date_alert_stop"
:
"{{partnerData.date_alert_stop}}"
,
"cooperative_state"
:
"{{partnerData.cooperative_state}}"
,
"cooperative_state"
:
"{{partnerData.cooperative_state}}"
,
"is_leave"
:
"{{partnerData.is_leave}}"
,
"leave_start_date"
:
"{{partnerData.leave_start_date}}"
,
"leave_stop_date"
:
"{{partnerData.leave_stop_date}}"
,
"next_regular_shift_date"
:
"{{partnerData.next_regular_shift_date}}"
,
"regular_shift_name"
:
"{{partnerData.regular_shift_name}}"
,
"verif_token"
:
"{{partnerData.verif_token}}"
,
"verif_token"
:
"{{partnerData.verif_token}}"
,
"makeups_to_do"
:
"{{partnerData.makeups_to_do}}"
,
"makeups_to_do"
:
"{{partnerData.makeups_to_do}}"
,
"barcode_base"
:
"{{partnerData.barcode_base}}"
,
"barcode_base"
:
"{{partnerData.barcode_base}}"
,
...
...
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