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
b8648c03
Commit
b8648c03
authored
Dec 04, 2024
by
François COLOMBIER
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adaptations suite correctifs v9
parent
d0b7d9b1
Pipeline
#3979
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
admin.py
members/admin.py
+7
-10
models.py
shifts/models.py
+11
-3
No files found.
members/admin.py
View file @
b8648c03
...
@@ -854,8 +854,8 @@ def create_pair(request):
...
@@ -854,8 +854,8 @@ def create_pair(request):
if
child_makeups
+
parent_makeups
<=
2
:
if
child_makeups
+
parent_makeups
<=
2
:
# on transfert les rattrapages sur le parent
# on transfert les rattrapages sur le parent
# Comme on annule les services du suppléant,
on ajoute en makeup_to_do du titulaire les rattrapages choisis ou non du suppléant
# Comme on annule les services du suppléant,
les makeup_to_do du titulaire seront affectés par la modification du compteur
api
.
update
(
"res.partner"
,
[
parent_id
],
{
"makeups_to_do"
:
parent
[
'makeups_to_do'
]
+
child_makeups
})
# On annule les rattrapages du child
# On annule les rattrapages du child
api
.
update
(
'res.partner'
,
[
child_id
],
{
"makeups_to_do"
:
0
})
api
.
update
(
'res.partner'
,
[
child_id
],
{
"makeups_to_do"
:
0
})
...
@@ -866,15 +866,14 @@ def create_pair(request):
...
@@ -866,15 +866,14 @@ def create_pair(request):
"type"
:
child
[
'shift_type'
],
"type"
:
child
[
'shift_type'
],
"partner_id"
:
child_id
,
"partner_id"
:
child_id
,
"point_qty"
:
1
})
"point_qty"
:
1
})
# on retire les points au titulaire
# on retire les points au titulaire
, les rattrages sont automatiquement ajoutés
api
.
create
(
'shift.counter.event'
,
{
"name"
:
'passage en binôme'
,
api
.
create
(
'shift.counter.event'
,
{
"name"
:
'passage en binôme'
,
"shift_id"
:
False
,
"shift_id"
:
False
,
"type"
:
parent
[
'shift_type'
],
"type"
:
parent
[
'shift_type'
],
"partner_id"
:
parent_id
,
"partner_id"
:
parent_id
,
"point_qty"
:
-
1
})
"point_qty"
:
-
1
})
elif
child_makeups
+
parent_makeups
>
2
:
elif
child_makeups
+
parent_makeups
>
2
:
# on annule les rattrapages du suppléant et on met 2 rattrapages sur le titulaire
# on annule les rattrapages du suppléant et les rattrapages du titulaire seront ajustés par les modifications de compteur
api
.
update
(
'res.partner'
,
[
parent_id
],
{
"makeups_to_do"
:
2
})
api
.
update
(
'res.partner'
,
[
child_id
],
{
"makeups_to_do"
:
0
})
api
.
update
(
'res.partner'
,
[
child_id
],
{
"makeups_to_do"
:
0
})
for
makeup
in
range
(
child_makeups
):
for
makeup
in
range
(
child_makeups
):
# reset du compteur du suppléant
# reset du compteur du suppléant
...
@@ -883,18 +882,16 @@ def create_pair(request):
...
@@ -883,18 +882,16 @@ def create_pair(request):
"type"
:
child
[
'shift_type'
],
"type"
:
child
[
'shift_type'
],
"partner_id"
:
child_id
,
"partner_id"
:
child_id
,
"point_qty"
:
1
})
"point_qty"
:
1
})
for
i
in
range
(
(
parent_makeups
+
child_makeups
)
-
2
):
for
i
in
range
(
abs
(
parent_makeups
-
2
)
):
# màj du compteur du titulaire
# màj du compteur du titulaire
api
.
create
(
'shift.counter.event'
,
{
"name"
:
"passage en binôme"
,
api
.
create
(
'shift.counter.event'
,
{
"name"
:
"passage en binôme"
,
"shift_id"
:
False
,
"shift_id"
:
False
,
"type"
:
parent
[
'shift_type'
],
"type"
:
parent
[
'shift_type'
],
"partner_id"
:
parent_id
,
"partner_id"
:
parent_id
,
"point_qty"
:
-
1
})
"point_qty"
:
-
1
})
# No more useful since status is fully managed by lacagette_addons modules
# api.execute('res.partner', 'run_process_target_status', [])
try
:
api
.
execute
(
'res.partner'
,
'run_process_target_status'
,
[])
except
:
pass
m
=
CagetteMember
(
child_id
)
.
unsubscribe_member
()
m
=
CagetteMember
(
child_id
)
.
unsubscribe_member
()
# update child base account state
# update child base account state
...
...
shifts/models.py
View file @
b8648c03
...
@@ -859,9 +859,17 @@ class CagetteServices(models.Model):
...
@@ -859,9 +859,17 @@ 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
:
try
:
individual_update_result
[
str
(
mysregid
)]
=
api
.
update
(
'shift.registration'
,
[
mysregid
],
f
)
except
Exception
as
e
:
coop_logger
.
error
(
"Error on updating shift.registration ids
%
s :
%
s"
,
str
(
mysregid
),
str
(
e
))
update_shift_reg_result
[
'update'
]
=
individual_update_result
# With new way of overriding awesomefoodcoop status management, the following line is no more useful
# update_shift_reg_result['process_status_res'] = api.execute('res.partner','run_process_target_status', [])
# change shift state by triggering button_done method for all related shifts
# change shift state by triggering button_done method for all related shifts
if
len
(
canceled_reg_ids
)
>
0
:
if
len
(
canceled_reg_ids
)
>
0
:
f
=
{
'state'
:
'cancel'
,
'date_closed'
:
now
.
isoformat
()}
f
=
{
'state'
:
'cancel'
,
'date_closed'
:
now
.
isoformat
()}
...
...
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