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
5d5cd2a4
Commit
5d5cd2a4
authored
Sep 19, 2024
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix exempted status case when computing working_state
parent
200bd451
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
10 deletions
+31
-10
res_partner.py
lacagette_addons/lacagette_membership/models/res_partner.py
+31
-10
No files found.
lacagette_addons/lacagette_membership/models/res_partner.py
View file @
5d5cd2a4
...
@@ -78,16 +78,31 @@ class ResPartner(models.Model):
...
@@ -78,16 +78,31 @@ class ResPartner(models.Model):
for
partner
in
self
:
for
partner
in
self
:
_logger
.
debug
(
"partner_id =
%
s, cooperative_state =
%
s"
,
str
(
partner
.
id
),
str
(
partner
.
cooperative_state
))
_logger
.
debug
(
"partner_id =
%
s, cooperative_state =
%
s"
,
str
(
partner
.
id
),
str
(
partner
.
cooperative_state
))
state
=
'up_to_date'
state
=
'up_to_date'
if
partner
.
is_associated_people
is
True
:
if
partner
.
leave_ids
:
state
=
partner
.
parent_id
.
cooperative_state
is_exempted
=
partner
.
leave_ids
.
filtered
(
else
:
lambda
l
:
l
.
state
==
'done'
and
l
.
start_date
<=
current_datetime
and
l
.
stop_date
>=
if
partner
.
cooperative_state
in
[
'gone'
,
'associated'
]:
current_datetime
and
l
.
partner_state
==
'exempted'
)
state
=
partner
.
cooperative_state
_logger
.
debug
(
"is_exempted =
%
s"
,
str
(
is_exempted
))
if
is_exempted
:
_logger
.
debug
(
"On met le statut exempté"
)
state
=
'exempted'
#for l in list(partner.leave_ids):
# if l.stop_date > current_datetime and l.partner_state == 'exempted':
# state = 'exempted'
# fulldata = l.read()
# _logger.debug("for l in partner.leave_ids")
# _logger.debug(str(fulldata))
if
state
!=
'exempted'
:
if
partner
.
is_associated_people
is
True
:
state
=
partner
.
parent_id
.
cooperative_state
else
:
else
:
potential_associated_record
=
self
.
env
[
'res.partner'
]
.
search
([(
'email'
,
'='
,
self
.
email
),
(
'is_associated_people'
,
'='
,
True
)])
if
partner
.
cooperative_state
in
[
'gone'
,
'associated'
]:
if
potential_associated_record
:
state
=
partner
.
cooperative_state
else
:
potential_associated_record
=
self
.
env
[
'res.partner'
]
.
search
([(
'email'
,
'='
,
self
.
email
),
(
'is_associated_people'
,
'='
,
True
)])
if
potential_associated_record
:
state
=
'associated'
state
=
'associated'
else
:
else
:
if
partner
.
is_unsubscribed
is
False
:
if
partner
.
is_unsubscribed
is
False
:
points
=
0
points
=
0
if
partner
.
shift_type
==
'standard'
:
if
partner
.
shift_type
==
'standard'
:
...
@@ -277,9 +292,15 @@ class ResPartner(models.Model):
...
@@ -277,9 +292,15 @@ class ResPartner(models.Model):
def
set_special_state
(
self
,
cr
,
uid
,
partner
,
context
=
None
):
def
set_special_state
(
self
,
cr
,
uid
,
partner
,
context
=
None
):
new_state
=
partner
[
'state'
]
if
partner
[
'state'
]
==
'cancel_special'
:
if
partner
[
'state'
]
==
'cancel_special'
:
partner
[
'state'
]
=
'unsubscribed'
new_state
=
'unsubscribed'
return
self
.
write
(
cr
,
uid
,
[
partner
[
'id'
]],
{
'cooperative_state'
:
partner
[
'state'
],
'working_state'
:
partner
[
'state'
]}
,
context
=
context
)
write_result
=
self
.
write
(
cr
,
uid
,
[
partner
[
'id'
]],
{
'cooperative_state'
:
new_state
,
'working_state'
:
new_state
}
,
context
=
context
)
if
new_state
==
'unsubscribed'
:
member
=
self
.
pool
.
get
(
'res.partner'
)
.
browse
(
cr
,
uid
,
partner
[
'id'
],
context
)
return
member
.
recompute_member_states
()
else
:
return
write_result
def
_write_state_change
(
self
,
state
):
def
_write_state_change
(
self
,
state
):
data
=
{
'member_id'
:
self
.
id
,
'state'
:
state
}
data
=
{
'member_id'
:
self
.
id
,
'state'
:
state
}
...
...
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