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
6c4c7353
Commit
6c4c7353
authored
Sep 12, 2024
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Surchage complète des champs cooperative_state et working_state dans module Cagette
parent
ab06aeca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
14 deletions
+56
-14
res_partner.py
intercoop_addons/coop_membership/models/res_partner.py
+5
-7
res_partner.py
intercoop_addons/coop_shift/model/res_partner.py
+1
-3
__openerp__.py
lacagette_addons/lacagette_membership/__openerp__.py
+1
-1
res_partner.py
lacagette_addons/lacagette_membership/models/res_partner.py
+49
-3
No files found.
intercoop_addons/coop_membership/models/res_partner.py
View file @
6c4c7353
...
...
@@ -16,6 +16,7 @@ from openerp import SUPERUSER_ID
from
lxml
import
etree
from
openerp.osv.orm
import
setup_modifiers
EXTRA_COOPERATIVE_STATE_SELECTION
=
[
(
'not_concerned'
,
'Not Concerned'
),
(
'unsubscribed'
,
'Unsubscribed'
),
...
...
@@ -27,15 +28,13 @@ EXTRA_COOPERATIVE_STATE_SELECTION = [
(
'delay'
,
'Delay'
),
(
'blocked'
,
'Blocked'
),
(
'unpayed'
,
'Unpayed'
),
(
'gone'
,
'Gone'
),
# Used by LaCagette and followers
(
'associated'
,
'Associated'
)
# Used by LaCagette and followers
]
class
ResPartner
(
models
.
Model
):
_inherit
=
'res.partner'
COOPERATIVE_STATE_CUSTOMER
=
[
'up_to_date'
,
'alert'
,
'delay'
,
'exempted'
,
'unsubscribed'
,
'gone'
,
'associated'
]
COOPERATIVE_STATE_CUSTOMER
=
[
'up_to_date'
,
'alert'
,
'delay'
,
'exempted'
]
SEX_SELECTION
=
[
(
'm'
,
'male'
),
...
...
@@ -329,9 +328,7 @@ class ResPartner(models.Model):
@api.multi
def
_compute_cooperative_state
(
self
):
for
partner
in
self
:
if
partner
.
working_state
in
[
'gone'
,
'associated'
]:
partner
.
cooperative_state
=
partner
.
working_state
elif
partner
.
is_associated_people
:
if
partner
.
is_associated_people
:
# Associated People
partner
.
cooperative_state
=
partner
.
parent_id
.
cooperative_state
elif
partner
.
is_worker_member
:
...
...
@@ -350,7 +347,7 @@ class ResPartner(models.Model):
def
_compute_customer
(
self
):
for
partner
in
self
:
partner
.
customer
=
\
partner
.
cooperative_state
in
[
'up_to_date'
,
'alert'
,
'delay'
,
'exempted'
]
partner
.
cooperative_state
in
self
.
COOPERATIVE_STATE_CUSTOMER
@api.depends
(
'child_ids'
)
@api.multi
...
...
@@ -695,3 +692,4 @@ class ResPartner(models.Model):
str
(
tpl_reg_line_fr_partner_tree_id
))
res
[
'arch'
]
=
etree
.
tostring
(
doc
)
return
res
intercoop_addons/coop_shift/model/res_partner.py
View file @
6c4c7353
...
...
@@ -30,6 +30,7 @@ from openerp.exceptions import ValidationError
from
.date_tools
import
conflict_period
class
ResPartner
(
models
.
Model
):
_inherit
=
'res.partner'
...
...
@@ -45,11 +46,8 @@ class ResPartner(models.Model):
(
'up_to_date'
,
'Up to date'
),
(
'alert'
,
'Alert'
),
(
'suspended'
,
'Suspended'
),
(
'unsubscribed'
,
'Unsubscribed'
),
(
'delay'
,
'Delay'
),
(
'blocked'
,
'Blocked'
),
(
'gone'
,
'Gone'
),
# Used by La Cagette and followers
(
'associated'
,
'Associated'
)
# Used by La Cagette and followers
]
# Columns Section
...
...
lacagette_addons/lacagette_membership/__openerp__.py
View file @
6c4c7353
...
...
@@ -16,7 +16,7 @@
#
'category'
:
'Uncategorized'
,
'version'
:
'0.0.7.
3
'
,
'version'
:
'0.0.7.
4
'
,
# any module necessary for this one to work correctly
'depends'
:
[
'base'
,
'coop_membership'
,
'coop_shift'
],
...
...
lacagette_addons/lacagette_membership/models/res_partner.py
View file @
6c4c7353
...
...
@@ -28,6 +28,18 @@ EXTRA_COOPERATIVE_STATE_SELECTION = [
(
'associated'
,
'Associated'
)
]
WORKING_STATE_SELECTION
=
[
(
'exempted'
,
'Exempted'
),
(
'vacation'
,
'On Vacation'
),
(
'up_to_date'
,
'Up to date'
),
(
'alert'
,
'Alert'
),
(
'suspended'
,
'Suspended'
),
(
'delay'
,
'Delay'
),
(
'blocked'
,
'Blocked'
),
(
'gone'
,
'Gone'
),
(
'associated'
,
'Associated'
)
]
class
ResPartner
(
models
.
Model
):
_inherit
=
'res.partner'
...
...
@@ -39,15 +51,29 @@ class ResPartner(models.Model):
target_status
=
fields
.
Selection
(
selection
=
TARGET_STATUS_SELECTION
,
default
=
''
)
# override cooperative_state and working_state with own compute methods, in order to unsure their stored values
cooperative_state
=
fields
.
Selection
(
selection
=
EXTRA_COOPERATIVE_STATE_SELECTION
,
default
=
'not_concerned'
)
selection
=
EXTRA_COOPERATIVE_STATE_SELECTION
,
default
=
'not_concerned'
,
store
=
True
,
compute
=
'_compute_lacagette_cooperative_state'
)
working_state
=
fields
.
Selection
(
selection
=
WORKING_STATE_SELECTION
,
string
=
'Working State'
,
store
=
True
,
compute
=
'_compute_lacagette_working_state'
,
help
=
"This state depends on the"
" shifts realized by the partner."
)
extra_shift_done
=
fields
.
Integer
(
"Number of shift done with both of the associate"
,
default
=
0
)
@api.multi
def
_compute_lacagette_working_state
(
self
):
_logger
.
debug
(
"Dans _compute_lacagette_working_state"
)
for
partner
in
self
:
_logger
.
debug
(
"partner_id =
%
s, cooperative_state =
%
s"
,
str
(
partner
.
id
),
str
(
partner
.
cooperative_state
))
if
partner
.
is_associated_people
is
True
:
partner
.
working_state
=
partner
.
parent_id
.
cooperative_state
else
:
...
...
@@ -57,14 +83,22 @@ class ResPartner(models.Model):
potential_associated_record
=
self
.
env
[
'res.partner'
]
.
search
([(
'email'
,
'='
,
self
.
email
),
(
'is_associated_people'
,
'='
,
True
)])
if
potential_associated_record
:
partner
.
working_state
=
'associated'
# Not sure, it is useful, but _compute_working_state is overriden, calling our own method
@api.multi
def
_compute_working_state
(
self
):
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
def
_compute_cooperative_state
(
self
):
def
_compute_lacagette_cooperative_state
(
self
):
_logger
.
debug
(
"Dans _compute_lacagette_cooperative_state"
)
for
partner
in
self
:
# _logger.debug("Partner = %s", str(partner.read()))
_logger
.
debug
(
"partner_id =
%
s, working_state =
%
s"
,
str
(
partner
.
id
),
str
(
partner
.
working_state
))
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'
else
:
...
...
@@ -80,6 +114,18 @@ class ResPartner(models.Model):
else
:
partner
.
cooperative_state
=
partner
.
working_state
# Not sure, it is useful, but _compute_cooperative_state is overriden, calling our own method
@api.depends
(
'working_state'
,
'is_unpayed'
,
'is_unsubscribed'
,
'is_worker_member'
,
'is_associated_people'
,
'parent_id.cooperative_state'
)
@api.multi
def
_compute_cooperative_state
(
self
):
self
.
_compute_lacagette_cooperative_state
()
@api.multi
def
recompute_member_states
(
self
):
for
record
in
self
:
...
...
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