Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
odoo
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
0
Merge Requests
0
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
odoo
Commits
1c919eba
Commit
1c919eba
authored
Jan 20, 2025
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modifications pour recalcul statut suite choix rattrapage dans espace membre
parent
8634d413
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
res_partner.py
lacagette_addons/lacagette_membership/models/res_partner.py
+18
-5
shift_registration.py
..._addons/lacagette_membership/models/shift_registration.py
+10
-0
No files found.
lacagette_addons/lacagette_membership/models/res_partner.py
View file @
1c919eba
...
@@ -74,6 +74,18 @@ class ResPartner(models.Model):
...
@@ -74,6 +74,18 @@ class ResPartner(models.Model):
"Number of shift done with both of the associate"
,
"Number of shift done with both of the associate"
,
default
=
0
)
default
=
0
)
def
_is_in_delay
(
self
):
"""Necessary because date_delay_stop may not have been computed yet"""
answer
=
False
max_date
=
False
for
extension
in
self
.
sudo
()
.
extension_ids
:
if
extension
.
date_start
<=
fields
.
Datetime
.
now
()
and
\
extension
.
date_stop
>
fields
.
Datetime
.
now
():
max_date
=
max
(
max_date
,
extension
.
date_stop
)
if
max_date
and
max_date
>
fields
.
Datetime
.
now
():
answer
=
True
_logger
.
debug
(
"
%
s est en délai ? Réponse =
%
s"
,
str
(
self
.
id
),
str
(
answer
))
return
answer
@api.multi
@api.multi
def
_compute_lacagette_working_state
(
self
):
def
_compute_lacagette_working_state
(
self
):
...
@@ -121,14 +133,11 @@ class ResPartner(models.Model):
...
@@ -121,14 +133,11 @@ class ResPartner(models.Model):
state
=
'unsubscribed'
state
=
'unsubscribed'
self
.
env
[
'shift.counter.event'
]
.
unsubscribe_partner
(
partner
,
unsubscribe_limit
,
points
)
self
.
env
[
'shift.counter.event'
]
.
unsubscribe_partner
(
partner
,
unsubscribe_limit
,
points
)
else
:
else
:
if
partner
.
date_alert_stop
:
if
partner
.
makeups_to_do
==
0
and
partner
.
_is_in_delay
():
if
partner
.
makeups_to_do
==
0
and
partner
.
date_delay_stop
and
partner
.
date_delay_stop
>
current_datetime
:
state
=
'delay'
state
=
'delay'
else
:
else
:
state
=
'suspended'
state
=
'suspended'
else
:
else
:
state
=
'suspended'
else
:
state
=
'unsubscribed'
state
=
'unsubscribed'
partner
.
working_state
=
state
partner
.
working_state
=
state
...
@@ -178,10 +187,14 @@ class ResPartner(models.Model):
...
@@ -178,10 +187,14 @@ class ResPartner(models.Model):
@api.multi
@api.multi
def
recompute_member_states
(
self
):
def
recompute_member_states
(
self
,
params
=
''
):
for
record
in
self
:
for
record
in
self
:
record
.
_compute_lacagette_working_state
()
record
.
_compute_lacagette_working_state
()
record
.
_compute_cooperative_state
()
record
.
_compute_cooperative_state
()
associated_binome
=
self
.
env
[
'res.partner'
]
.
search
([(
'parent_id'
,
'='
,
record
.
id
),
(
'is_associated_people'
,
'='
,
True
)])
if
associated_binome
:
for
assoc_people
in
associated_binome
:
assoc_people
.
recompute_member_states
()
@api.model
@api.model
def
run_process_target_status
(
self
):
def
run_process_target_status
(
self
):
...
...
lacagette_addons/lacagette_membership/models/shift_registration.py
View file @
1c919eba
...
@@ -43,3 +43,13 @@ class ShiftRegistration(models.Model):
...
@@ -43,3 +43,13 @@ class ShiftRegistration(models.Model):
to_add
+=
1
to_add
+=
1
s
.
partner_id
.
update
({
'makeups_to_add'
:
to_add
})
s
.
partner_id
.
update
({
'makeups_to_add'
:
to_add
})
return
super
(
ShiftRegistration
,
self
)
.
write
(
vals
)
return
super
(
ShiftRegistration
,
self
)
.
write
(
vals
)
@api.model
def
create
(
self
,
vals
):
_logger
.
debug
(
"Create shift_registration Vals recues creation =
%
s"
,
str
(
vals
))
res
=
super
(
ShiftRegistration
,
self
)
.
create
(
vals
)
if
'is_makeup'
in
vals
and
vals
[
'is_makeup'
]
is
True
:
member
=
self
.
env
[
'res.partner'
]
.
search
([(
'id'
,
'='
,
vals
[
'partner_id'
])])
member
.
write
({
'makeups_to_do'
:
member
.
makeups_to_do
-
1
})
member
.
recompute_member_states
()
return
res
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