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
e1c5eb54
Commit
e1c5eb54
authored
Jul 04, 2024
by
Odoo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajustements pour cron recompute members working and cooperative states
parent
e9df4002
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
4 deletions
+50
-4
channels.py
extra_addons/connector/jobrunner/channels.py
+1
-0
__openerp__.py
lacagette_addons/lacagette_membership/__openerp__.py
+2
-2
ir_cron.xml
lacagette_addons/lacagette_membership/data/ir_cron.xml
+14
-2
__init__.py
lacagette_addons/lacagette_membership/models/__init__.py
+1
-0
res_partner.py
lacagette_addons/lacagette_membership/models/res_partner.py
+32
-0
No files found.
extra_addons/connector/jobrunner/channels.py
View file @
e1c5eb54
...
...
@@ -557,6 +557,7 @@ class Channel(object):
:return: iterator of :py:class:`connector.jobrunner.ChannelJob`
"""
# enqueue jobs of children channels
for
child
in
self
.
children
.
values
():
for
job
in
child
.
get_jobs_to_run
(
now
):
...
...
lacagette_addons/lacagette_membership/__openerp__.py
View file @
e1c5eb54
...
...
@@ -11,12 +11,12 @@
"""
,
'author'
:
"fracolo/cooperatic"
,
'author'
:
"fracolo/cooperatic
/coopdev
"
,
'website'
:
"https://lacagette-coop.fr"
,
#
'category'
:
'Uncategorized'
,
'version'
:
'0.0.7.
2
'
,
'version'
:
'0.0.7.
3
'
,
# any module necessary for this one to work correctly
'depends'
:
[
'base'
,
'coop_membership'
,
'coop_shift'
],
...
...
lacagette_addons/lacagette_membership/data/ir_cron.xml
View file @
e1c5eb54
...
...
@@ -57,4 +57,17 @@
<field
name=
"active"
eval=
"False"
/>
<field
name=
"priority"
>
1
</field>
</record>
</odoo>
\ No newline at end of file
<record
forcecreate=
"True"
id=
"cron_recompute_working_and_cooperative_states"
model=
"ir.cron"
>
<field
name=
"name"
>
Partner: Recompute cooperative and working states (La Cagette)
</field>
<field
name=
"user_id"
ref=
"base.user_root"
/>
<field
name=
"interval_number"
>
1
</field>
<field
name=
"interval_type"
>
days
</field>
<field
name=
"numbercall"
>
-1
</field>
<field
name=
"doall"
eval=
"False"
/>
<field
name=
"model"
eval=
"'res.partner'"
/>
<field
name=
"function"
eval=
"'run_recompute_member_states'"
/>
<field
name=
"args"
eval=
"'()'"
/>
<field
name=
"active"
eval=
"False"
/>
<field
name=
"priority"
>
1
</field>
</record>
</odoo>
lacagette_addons/lacagette_membership/models/__init__.py
View file @
e1c5eb54
...
...
@@ -7,3 +7,4 @@ from . import shift_shift
from
.
import
member_state_change
from
.
import
shift_template
from
.
import
shift_template_registration_line
lacagette_addons/lacagette_membership/models/res_partner.py
View file @
e1c5eb54
# -*- coding: utf-8 -*-
from
openerp
import
_
,
api
,
models
,
fields
from
openerp.addons.connector.session
import
ConnectorSession
from
openerp.addons.connector.queue.job
import
job
import
datetime
import
logging
...
...
@@ -56,6 +58,28 @@ class ResPartner(models.Model):
if
potential_associated_record
:
partner
.
working_state
=
'associated'
@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
):
for
partner
in
self
:
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
:
if
partner
.
is_associated_people
:
# Associated People
partner
.
cooperative_state
=
partner
.
parent_id
.
cooperative_state
elif
partner
.
is_worker_member
:
# Type A Subscriptor
if
partner
.
is_unsubscribed
and
partner
.
working_state
not
in
[
'gone'
,
'associated'
]:
partner
.
cooperative_state
=
'unsubscribed'
elif
partner
.
is_unpayed
:
partner
.
cooperative_state
=
'unpayed'
else
:
partner
.
cooperative_state
=
partner
.
working_state
@api.multi
def
recompute_member_states
(
self
):
for
record
in
self
:
...
...
@@ -213,3 +237,11 @@ class ResPartner(models.Model):
self
.
_write_state_change
(
vals
[
'cooperative_state'
])
return
super
(
ResPartner
,
self
)
.
write
(
vals
)
@api.model
def
run_recompute_member_states
(
self
):
# Function Called by the CRON
filters
=
[(
'is_member'
,
'='
,
True
),
(
'active'
,
'='
,
True
)]
partners
=
self
.
search
(
filters
)
partners
.
recompute_member_states
()
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