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
200bd451
Commit
200bd451
authored
Sep 17, 2024
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6833--Rectificatifs pour gestion des changements de statuts (surcharge modules awesomefoodcoops)
parent
13c541f0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
21 deletions
+50
-21
__openerp__.py
lacagette_addons/lacagette_membership/__openerp__.py
+1
-1
res_partner.py
lacagette_addons/lacagette_membership/models/res_partner.py
+43
-18
shift_counter_event.py
...addons/lacagette_membership/models/shift_counter_event.py
+6
-2
No files found.
lacagette_addons/lacagette_membership/__openerp__.py
View file @
200bd451
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#
#
'category'
:
'Uncategorized'
,
'category'
:
'Uncategorized'
,
'version'
:
'0.0.7.
4
'
,
'version'
:
'0.0.7.
5
'
,
# any module necessary for this one to work correctly
# any module necessary for this one to work correctly
'depends'
:
[
'base'
,
'coop_membership'
,
'coop_shift'
],
'depends'
:
[
'base'
,
'coop_membership'
,
'coop_shift'
],
...
...
lacagette_addons/lacagette_membership/models/res_partner.py
View file @
200bd451
...
@@ -37,7 +37,8 @@ WORKING_STATE_SELECTION = [
...
@@ -37,7 +37,8 @@ WORKING_STATE_SELECTION = [
(
'delay'
,
'Delay'
),
(
'delay'
,
'Delay'
),
(
'blocked'
,
'Blocked'
),
(
'blocked'
,
'Blocked'
),
(
'gone'
,
'Gone'
),
(
'gone'
,
'Gone'
),
(
'associated'
,
'Associated'
)
(
'associated'
,
'Associated'
),
(
'unsubscribed'
,
'Unsubscribed'
)
]
]
class
ResPartner
(
models
.
Model
):
class
ResPartner
(
models
.
Model
):
...
@@ -68,55 +69,79 @@ class ResPartner(models.Model):
...
@@ -68,55 +69,79 @@ class ResPartner(models.Model):
extra_shift_done
=
fields
.
Integer
(
extra_shift_done
=
fields
.
Integer
(
"Number of shift done with both of the associate"
,
"Number of shift done with both of the associate"
,
default
=
0
)
default
=
0
)
@api.multi
@api.multi
def
_compute_lacagette_working_state
(
self
):
def
_compute_lacagette_working_state
(
self
):
_logger
.
debug
(
"Dans _compute_lacagette_working_state"
)
_logger
.
debug
(
"Dans _compute_lacagette_working_state"
)
current_datetime
=
fields
.
Datetime
.
now
()
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'
if
partner
.
is_associated_people
is
True
:
if
partner
.
is_associated_people
is
True
:
partner
.
working_
state
=
partner
.
parent_id
.
cooperative_state
state
=
partner
.
parent_id
.
cooperative_state
else
:
else
:
if
partner
.
cooperative_state
in
[
'gone'
,
'associated'
]:
if
partner
.
cooperative_state
in
[
'gone'
,
'associated'
]:
partner
.
working_
state
=
partner
.
cooperative_state
state
=
partner
.
cooperative_state
else
:
else
:
potential_associated_record
=
self
.
env
[
'res.partner'
]
.
search
([(
'email'
,
'='
,
self
.
email
),
(
'is_associated_people'
,
'='
,
True
)])
potential_associated_record
=
self
.
env
[
'res.partner'
]
.
search
([(
'email'
,
'='
,
self
.
email
),
(
'is_associated_people'
,
'='
,
True
)])
if
potential_associated_record
:
if
potential_associated_record
:
partner
.
working_state
=
'associated'
state
=
'associated'
else
:
# Not sure, it is useful, but _compute_working_state is overriden, calling our own method
if
partner
.
is_unsubscribed
is
False
:
points
=
0
if
partner
.
shift_type
==
'standard'
:
points
=
partner
.
final_standard_point
else
:
points
=
partner
.
final_ftop_point
if
points
<
0
:
if
partner
.
date_alert_stop
:
if
partner
.
date_delay_stop
>
current_datetime
:
state
=
'delay'
else
:
state
=
'suspended'
else
:
state
=
'suspended'
else
:
state
=
'unsubscribed'
partner
.
working_state
=
state
# Overriding by calling our own method (which is mentionned in field declaration)
@api.depends
(
'is_blocked'
,
'final_standard_point'
,
'final_ftop_point'
,
'shift_type'
,
'date_alert_stop'
,
'date_delay_stop'
,
'leave_ids.state'
)
@api.multi
@api.multi
def
_compute_working_state
(
self
):
def
_compute_working_state
(
self
):
self
.
_compute_lacagette_working_state
()
self
.
_compute_lacagette_working_state
()
@api.depends
(
'working_state'
,
'is_unpayed'
,
'is_unsubscribed'
,
'is_worker_member'
,
'is_associated_people'
,
'parent_id.cooperative_state'
)
@api.multi
@api.multi
def
_compute_lacagette_cooperative_state
(
self
):
def
_compute_lacagette_cooperative_state
(
self
):
_logger
.
debug
(
"Dans _compute_lacagette_cooperative_state"
)
_logger
.
debug
(
"Dans _compute_lacagette_cooperative_state"
)
for
partner
in
self
:
for
partner
in
self
:
# _logger.debug("Partner = %s", str(partner.read()))
# _logger.debug("Partner = %s", str(partner.read()))
_logger
.
debug
(
"partner_id =
%
s, working_state =
%
s"
,
str
(
partner
.
id
),
str
(
partner
.
working_state
))
_logger
.
debug
(
"partner_id =
%
s, working_state =
%
s"
,
str
(
partner
.
id
),
str
(
partner
.
working_state
))
state
=
'up_to_date'
if
partner
.
is_member
is
False
and
partner
.
is_associated_people
is
False
and
partner
.
is_worker_member
is
False
:
if
partner
.
is_member
is
False
and
partner
.
is_associated_people
is
False
and
partner
.
is_worker_member
is
False
:
partner
.
cooperative_state
=
'not_concerned'
state
=
'not_concerned'
else
:
else
:
if
partner
.
is_associated_people
:
if
partner
.
is_associated_people
:
# Associated People
# Associated People
partner
.
cooperative_
state
=
partner
.
parent_id
.
cooperative_state
state
=
partner
.
parent_id
.
cooperative_state
elif
partner
.
is_
worker_
member
:
elif
partner
.
is_member
:
# Type A Subscriptor
# Type A Subscriptor
if
partner
.
is_unsubscribed
and
partner
.
working_state
not
in
[
'gone'
,
'associated'
]:
if
partner
.
is_unsubscribed
and
partner
.
working_state
not
in
[
'gone'
,
'associated'
]:
partner
.
cooperative_
state
=
'unsubscribed'
state
=
'unsubscribed'
elif
partner
.
is_unpayed
:
elif
partner
.
is_unpayed
:
partner
.
cooperative_state
=
'unpayed'
state
=
'unpayed'
elif
partner
.
working_state
:
state
=
partner
.
working_state
else
:
else
:
partner
.
cooperative_state
=
partner
.
working_state
partner
.
working_state
=
state
partner
.
cooperative_state
=
state
_logger
.
debug
(
"A l'issue du traitement partner_id =
%
s, working_state =
%
s, cooperative_state =
%
s"
,
str
(
partner
.
id
),
str
(
partner
.
working_state
),
str
(
partner
.
cooperative_state
))
#
Not sure, it is useful, but _compute_cooperative_state is overriden, calling our own method
#
Overriding by calling our own method (which is mentionned in field declaration)
@api.depends
(
@api.depends
(
'working_state'
,
'is_unpayed'
,
'is_unsubscribed'
,
'working_state'
,
'is_unpayed'
,
'is_unsubscribed'
,
'is_worker_member'
,
'is_associated_people'
,
'is_worker_member'
,
'is_associated_people'
,
...
...
lacagette_addons/lacagette_membership/models/shift_counter_event.py
View file @
200bd451
...
@@ -84,8 +84,12 @@ class ShiftCounterEvent(models.Model):
...
@@ -84,8 +84,12 @@ class ShiftCounterEvent(models.Model):
if
points_after_removal
<=
unsubscribe_limit
:
if
points_after_removal
<=
unsubscribe_limit
:
target_status
=
'unsubscribed'
target_status
=
'unsubscribed'
if
target_status
is
not
None
:
if
target_status
is
not
None
:
p
.
update
({
'target_status'
:
target_status
,
p
.
update
({
'working_state'
:
target_status
,
'cooperative_state'
:
target_status
})
'current_cooperative_state'
:
p
.
cooperative_state
})
# p.update({'target_status': target_status,
# 'current_cooperative_state': p.cooperative_state})
elif
points_after_removal
>=
0
:
p
.
update
({
'working_state'
:
'up_to_date'
,
'cooperative_state'
:
'up_to_date'
})
except
Exception
as
e
:
except
Exception
as
e
:
# don't block process if an error occurs here
# don't block process if an error occurs here
_logger
.
error
(
"Error during _update_partner_target_status :
%
s"
,
str
(
e
))
_logger
.
error
(
"Error during _update_partner_target_status :
%
s"
,
str
(
e
))
...
...
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