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
2ec97ba3
Commit
2ec97ba3
authored
Sep 25, 2024
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modifications shifts.record_absences car certains enregistrements de presences soulevait une erreur
parent
e5cd3108
Pipeline
#3778
failed with stage
in 44 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
14 deletions
+22
-14
models.py
shifts/models.py
+22
-14
No files found.
shifts/models.py
View file @
2ec97ba3
...
@@ -773,20 +773,28 @@ class CagetteServices(models.Model):
...
@@ -773,20 +773,28 @@ class CagetteServices(models.Model):
canceled_reg_ids
.
append
(
int
(
r
[
'id'
]))
canceled_reg_ids
.
append
(
int
(
r
[
'id'
]))
# coop_logger.info("Traitement absences shift_registration ids %s", ids)
# coop_logger.info("Traitement absences shift_registration ids %s", ids)
f
=
{
'state'
:
absence_status
,
'date_closed'
:
now
.
isoformat
()}
f
=
{
'state'
:
absence_status
,
'date_closed'
:
now
.
isoformat
()}
update_shift_reg_result
=
{
'update'
:
api
.
update
(
'shift.registration'
,
ids
,
f
),
'reg_shift'
:
res
,
'errors'
:
[]}
update_shift_reg_result
=
{
'update'
:
False
,
'reg_shift'
:
res
,
'errors'
:
[]}
if
update_shift_reg_result
[
'update'
]
is
True
:
individual_update_result
=
{}
update_shift_reg_result
[
'process_status_res'
]
=
api
.
execute
(
'res.partner'
,
'run_process_target_status'
,
[])
for
mysregid
in
ids
:
# change shift state by triggering button_done method for all related shifts
try
:
if
len
(
canceled_reg_ids
)
>
0
:
individual_update_result
[
str
(
mysregid
)]
=
api
.
update
(
'shift.registration'
,
[
mysregid
],
f
)
f
=
{
'state'
:
'cancel'
,
'date_closed'
:
now
.
isoformat
()}
except
Exception
as
e
:
api
.
update
(
'shift.registration'
,
canceled_reg_ids
,
f
)
coop_logger
.
error
(
"Error on updating shift.registration ids
%
s :
%
s"
,
str
(
mysregid
),
str
(
e
))
for
sid
in
shift_ids
:
update_shift_reg_result
[
'update'
]
=
individual_update_result
try
:
api
.
execute
(
'shift.shift'
,
'button_done'
,
sid
)
# With new way of overriding awesomefoodcoop status management, the following line is no more useful
except
Exception
as
e
:
# update_shift_reg_result['process_status_res'] = api.execute('res.partner','run_process_target_status', [])
marshal_none_error
=
'cannot marshal None unless allow_none is enabled'
# change shift state by triggering button_done method for all related shifts
if
not
(
marshal_none_error
in
str
(
e
)):
if
len
(
canceled_reg_ids
)
>
0
:
update_shift_reg_result
[
'errors'
]
.
append
({
'shift_id'
:
sid
,
'msg'
:
str
(
e
)})
f
=
{
'state'
:
'cancel'
,
'date_closed'
:
now
.
isoformat
()}
api
.
update
(
'shift.registration'
,
canceled_reg_ids
,
f
)
for
sid
in
shift_ids
:
try
:
api
.
execute
(
'shift.shift'
,
'button_done'
,
sid
)
except
Exception
as
e
:
marshal_none_error
=
'cannot marshal None unless allow_none is enabled'
if
not
(
marshal_none_error
in
str
(
e
)):
update_shift_reg_result
[
'errors'
]
.
append
({
'shift_id'
:
sid
,
'msg'
:
str
(
e
)})
return
update_shift_reg_result
return
update_shift_reg_result
...
...
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