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
52e4881c
Commit
52e4881c
authored
Nov 24, 2021
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1774: current extensions are being closed when coop is being unsubscribe
parent
540be0cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
ir_cron.xml
lacagette_addons/lacagette_membership/data/ir_cron.xml
+2
-2
res_partner.py
lacagette_addons/lacagette_membership/models/res_partner.py
+10
-3
No files found.
lacagette_addons/lacagette_membership/data/ir_cron.xml
View file @
52e4881c
...
...
@@ -21,8 +21,8 @@
<record
forcecreate=
"True"
id=
"cron_process_target_status"
model=
"ir.cron"
>
<field
name=
"name"
>
Process coop target status
</field>
<field
name=
"user_id"
ref=
"base.user_root"
/>
<field
name=
"interval_number"
>
1
</field>
<field
name=
"interval_type"
>
hour
s
</field>
<field
name=
"interval_number"
>
5
</field>
<field
name=
"interval_type"
>
minute
s
</field>
<field
name=
"numbercall"
>
-1
</field>
<field
name=
"doall"
eval=
"True"
/>
<field
name=
"model"
eval=
"'res.partner'"
/>
...
...
lacagette_addons/lacagette_membership/models/res_partner.py
View file @
52e4881c
...
...
@@ -45,7 +45,6 @@ class ResPartner(models.Model):
"""Method called by cron task"""
# final_ftop_point, target_status
conf
=
self
.
env
[
'ir.config_parameter'
]
absence_status
=
conf
.
get_param
(
"lacagette_membership.absence_status"
)
makeups_todo_after_unsubscribed
=
conf
.
get_param
(
"lacagette_membership.makeups_to_do_after_unsubscribed"
)
result
=
'done'
for
p
in
self
.
env
[
'res.partner'
]
\
...
...
@@ -66,16 +65,24 @@ class ResPartner(models.Model):
unlink model: "shift.template.registration"
to delete all future shifts linked to this coop.
"""
now
=
datetime
.
datetime
.
now
()
.
isoformat
()
for
streg
in
self
.
env
[
'shift.template.registration'
]
\
.
search
([(
'partner_id'
,
'='
,
p
.
id
)]):
streg
.
unlink
()
for
sreg
in
self
.
env
[
'shift.registration'
]
\
.
search
([(
'partner_id'
,
'='
,
p
.
id
),
(
'date_begin'
,
'>'
,
datetime
.
datetime
.
now
()
.
isoformat
()
)]):
(
'date_begin'
,
'>'
,
now
)]):
sreg
.
unlink
()
# Close extensions
for
ext
in
self
.
env
[
'shift.extension'
]
\
.
search
([(
'partner_id'
,
'='
,
p
.
id
),
(
'date_start'
,
'<='
,
now
),
(
'date_stop'
,
'>='
,
now
)]):
ext
.
update
({
'date_stop'
:
now
})
mail_template
=
self
.
env
.
ref
(
'coop_membership.unsubscribe_email'
)
if
mail_template
:
mail_template
.
send_mail
(
p
.
id
)
mail_template
.
send_mail
(
p
.
id
)
p
.
update
(
new_values
)
except
Exception
as
e
:
_logger
.
error
(
"run_process_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