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
1b055b5c
Commit
1b055b5c
authored
Nov 27, 2024
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dérivé de #7054 : modifications pour préserver l'historique des services à la désincription
parent
2bb6880e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
shift_counter_event.py
...addons/lacagette_membership/models/shift_counter_event.py
+5
-3
shift_template_registration.py
...acagette_membership/models/shift_template_registration.py
+5
-0
No files found.
lacagette_addons/lacagette_membership/models/shift_counter_event.py
View file @
1b055b5c
...
...
@@ -42,7 +42,7 @@ class ShiftCounterEvent(models.Model):
if
res_partner
:
p
=
res_partner
[
0
]
if
p
.
final_standard_point
==
suspension_limit
and
p
.
shift_type
!=
"ftop"
:
_logger
.
info
(
"Le nombre de points est la limite pour être suspendu, et membre ABCD, on va chercher à ajuster les points"
)
_logger
.
debug
(
"Le nombre de points est la limite pour être suspendu, et membre ABCD, on va chercher à ajuster les points"
)
cond
=
[
[
'name'
,
'='
,
p
[
"name"
]],
[
'shift_type'
,
'='
,
'standard'
],
...
...
@@ -76,7 +76,7 @@ class ShiftCounterEvent(models.Model):
'working_state'
:
'unsubscribed'
,
'cooperative_state'
:
'unsubscribed'
}
# Get points difference to set points to unsubscribe_limit - 1
_logger
.
info
(
"unsubscribe_partner : current_points =
%
s"
,
str
(
current_points
))
_logger
.
debug
(
"unsubscribe_partner : partner =
%
s, current_points =
%
s"
,
partner
.
display_name
,
str
(
current_points
))
target_points
=
unsubscribe_limit
+
1
points_diff
=
abs
(
current_points
-
target_points
)
if
points_diff
!=
0
:
...
...
@@ -101,10 +101,12 @@ class ShiftCounterEvent(models.Model):
"""
now
=
datetime
.
datetime
.
now
()
.
isoformat
()
for
streg
in
self
.
env
[
'shift.template.registration'
]
.
search
([(
'partner_id'
,
'='
,
partner
.
id
)]):
_logger
.
debug
(
"unlink shift.template.registration =
%
s"
,
str
(
streg
))
streg
.
unlink
()
for
sreg
in
self
.
env
[
'shift.registration'
]
\
.
search
([(
'partner_id'
,
'='
,
partner
.
id
),
(
'date_begin'
,
'>'
,
now
)]):
_logger
.
debug
(
"unling shift_registration =
%
s"
,
str
(
sreg
))
sreg
.
unlink
()
# Close extensions
...
...
@@ -160,7 +162,7 @@ class ShiftCounterEvent(models.Model):
to_consider_vals
=
vals
# TODO : Reimplement this adjustments
if
res_partner
:
partner
=
res_partner
[
0
]
_logger
.
info
(
"partner = :
%
s, makeups_to_do :
%
s"
,
str
(
partner
),
str
(
partner
.
makeups_to_do
))
_logger
.
debug
(
"partner = :
%
s, makeups_to_do :
%
s"
,
str
(
partner
),
str
(
partner
.
makeups_to_do
))
if
to_consider_vals
[
'type'
]
!=
partner
.
shift_type
:
_logger
.
error
(
"Counter shift type is not corresponding to partner shift_type :
%
s"
,
str
(
to_consider_vals
))
return
None
...
...
lacagette_addons/lacagette_membership/models/shift_template_registration.py
View file @
1b055b5c
...
...
@@ -21,8 +21,13 @@ class ShiftTemplateRegistration(models.Model):
@api.multi
def
unlink
(
self
):
partners_to_update
=
[]
partner_ids
=
[]
for
reg
in
self
:
partners_to_update
.
append
(
reg
.
partner_id
)
partner_ids
.
append
(
int
(
reg
.
partner_id
.
id
))
# remove tmpl_reg_line_id for all shift_registrations to prevent them to be deleted (keep shift history)
self
.
env
[
'shift.registration'
]
.
search
([(
'partner_id'
,
'in'
,
partner_ids
)])
\
.
write
({
'tmpl_reg_line_id'
:
False
})
super_res
=
super
(
ShiftTemplateRegistration
,
self
)
.
unlink
()
for
p
in
partners_to_update
:
p
.
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