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
cf673b7e
Commit
cf673b7e
authored
Apr 27, 2024
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 500 error if a member has not a shif_template id set
parent
396a54e3
Pipeline
#3420
failed with stage
in 1 minute 7 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
models.py
members/models.py
+10
-8
No files found.
members/models.py
View file @
cf673b7e
...
@@ -389,7 +389,7 @@ class CagetteMember(models.Model):
...
@@ -389,7 +389,7 @@ class CagetteMember(models.Model):
res
=
{}
res
=
{}
# First, update couchdb data
# First, update couchdb data
c_db
=
CouchDB
(
arg_db
=
'member'
)
c_db
=
CouchDB
(
arg_db
=
'member'
)
shift_template
=
json
.
loads
(
post_data
[
'shift_template'
])
#
shift_template = json.loads(post_data['shift_template'])
received_data
=
{
'birthdate'
:
post_data
[
'birthdate'
],
received_data
=
{
'birthdate'
:
post_data
[
'birthdate'
],
'city'
:
post_data
[
'city'
],
'city'
:
post_data
[
'city'
],
'zip'
:
post_data
[
'zip'
],
'zip'
:
post_data
[
'zip'
],
...
@@ -573,11 +573,14 @@ class CagetteMember(models.Model):
...
@@ -573,11 +573,14 @@ class CagetteMember(models.Model):
# We add the associated member to the "associate" shift template so we can find them in Odoo
# We add the associated member to the "associate" shift template so we can find them in Odoo
elif
'is_associated_people'
not
in
post_data
or
'is_associated_people'
in
post_data
and
'parent_id'
not
in
post_data
:
elif
'is_associated_people'
not
in
post_data
or
'is_associated_people'
in
post_data
and
'parent_id'
not
in
post_data
:
# Create shift suscription if is not associated
# Create shift suscription if is not associated
shift_template
=
json
.
loads
(
post_data
[
'shift_template'
])
try
:
shift_t_id
=
shift_template
[
'data'
][
'id'
]
shift_template
=
json
.
loads
(
post_data
[
'shift_template'
])
stype
=
shift_template
[
'data'
][
'type'
]
shift_t_id
=
shift_template
[
'data'
][
'id'
]
res
[
'shift'
]
=
\
stype
=
shift_template
[
'data'
][
'type'
]
m
.
create_coop_shift_subscription
(
shift_t_id
,
stype
)
res
[
'shift'
]
=
\
m
.
create_coop_shift_subscription
(
shift_t_id
,
stype
)
except
Exception
as
no_shift_e
:
coop_logger
.
error
(
"Pas de créneau défini :
%
s
\n
%
s"
,
str
(
post_data
),
str
(
no_shift_e
))
# m.add_first_point(stype) # Not needed anymore
# m.add_first_point(stype) # Not needed anymore
# Update couchdb do with new data
# Update couchdb do with new data
...
@@ -1396,4 +1399,4 @@ class CagetteUser(models.Model):
...
@@ -1396,4 +1399,4 @@ class CagetteUser(models.Model):
return
answer
return
answer
from
shifts.models
import
CagetteShift
from
shifts.models
import
CagetteShift
\ No newline at end of file
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