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
38988e61
Commit
38988e61
authored
Sep 29, 2021
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctifs usage des status 'forcés' et délai (réinit. rattrapages dûs)
parent
56244ea4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
ir_config_parameter_data.xml
...ns/lacagette_membership/data/ir_config_parameter_data.xml
+2
-5
res_partner.py
lacagette_addons/lacagette_membership/models/res_partner.py
+6
-2
shift_counter_event.py
...addons/lacagette_membership/models/shift_counter_event.py
+3
-1
No files found.
lacagette_addons/lacagette_membership/data/ir_config_parameter_data.xml
View file @
38988e61
<?xml version="1.0"?>
<?xml version="1.0"?>
<odoo
noupdate=
"0"
>
<odoo
noupdate=
"0"
>
<record
id=
"makeups_to_do_if_missed_id"
model=
"ir.config_parameter"
>
<field
name=
"key"
>
lacagette_membership.makeups_to_do_on_shift_missed
</field>
<field
name=
"value"
>
2
</field>
</record>
<record
id=
"points_limit_to_get_suspended"
model=
"ir.config_parameter"
>
<record
id=
"points_limit_to_get_suspended"
model=
"ir.config_parameter"
>
<field
name=
"key"
>
lacagette_membership.points_limit_to_get_suspended
</field>
<field
name=
"key"
>
lacagette_membership.points_limit_to_get_suspended
</field>
<field
name=
"value"
>
-2
</field>
<field
name=
"value"
>
-2
</field>
...
@@ -12,7 +9,7 @@
...
@@ -12,7 +9,7 @@
<field
name=
"key"
>
lacagette_membership.points_limit_to_get_unsubscribed
</field>
<field
name=
"key"
>
lacagette_membership.points_limit_to_get_unsubscribed
</field>
<field
name=
"value"
>
-3
</field>
<field
name=
"value"
>
-3
</field>
</record>
</record>
<record
id=
"
makeups_to_do_if_missed_id
"
model=
"ir.config_parameter"
>
<record
id=
"
absence_status
"
model=
"ir.config_parameter"
>
<field
name=
"key"
>
lacagette_membership.absence_status
</field>
<field
name=
"key"
>
lacagette_membership.absence_status
</field>
<field
name=
"value"
>
excused
</field>
<field
name=
"value"
>
excused
</field>
</record>
</record>
...
...
lacagette_addons/lacagette_membership/models/res_partner.py
View file @
38988e61
...
@@ -26,13 +26,16 @@ class ResPartner(models.Model):
...
@@ -26,13 +26,16 @@ class ResPartner(models.Model):
def
run_process_target_status
(
self
):
def
run_process_target_status
(
self
):
"""Method called by cron task"""
"""Method called by cron task"""
# final_ftop_point, target_status
# final_ftop_point, target_status
conf
=
self
.
env
[
'ir.config_parameter'
]
absence_status
=
conf
.
get_param
(
"lacagette_membership.absence_status"
)
for
p
in
self
.
env
[
'res.partner'
]
\
for
p
in
self
.
env
[
'res.partner'
]
\
.
search
([(
'target_status'
,
'!='
,
""
)]):
.
search
([(
'target_status'
,
'!='
,
""
)]):
new_values
=
{
'target_status'
:
""
,
"date_alert_stop"
:
False
}
new_values
=
{
'target_status'
:
""
,
"date_alert_stop"
:
False
}
if
p
.
final_ftop_point
<
0
:
if
p
.
final_ftop_point
<
0
:
new_values
[
'cooperative_state'
]
=
p
.
target_status
new_values
[
'cooperative_state'
]
=
p
.
target_status
if
new_values
[
'cooperative_state'
]
==
"unsubscribed"
:
if
new_values
[
'cooperative_state'
]
==
"unsubscribed"
:
new_values
[
'makeups_to_do'
]
=
2
if
absence_status
==
'absent'
else
1
"""
"""
unlink model: "shift.template.registration"
unlink model: "shift.template.registration"
to delete all future shifts linked to this coop.
to delete all future shifts linked to this coop.
...
@@ -40,6 +43,7 @@ class ResPartner(models.Model):
...
@@ -40,6 +43,7 @@ class ResPartner(models.Model):
for
streg
in
self
.
env
[
'shift.template.registration'
]
\
for
streg
in
self
.
env
[
'shift.template.registration'
]
\
.
search
([(
'partner_id'
,
'='
,
p
.
id
)]):
.
search
([(
'partner_id'
,
'='
,
p
.
id
)]):
streg
.
unlink
()
streg
.
unlink
()
p
.
update
(
new_values
)
p
.
update
(
new_values
)
#@api.onchange('cooperativestate') : could be used only if it is called from client
#@api.onchange('cooperativestate') : could be used only if it is called from client
...
@@ -50,7 +54,7 @@ class ResPartner(models.Model):
...
@@ -50,7 +54,7 @@ class ResPartner(models.Model):
SELECT s.id
SELECT s.id
FROM shift_extension as s
FROM shift_extension as s
WHERE s.date_stop > now()
WHERE s.date_stop > now()
AND partner_id IN (SELECT id FROM res_partner WHERE cooperative_state
='up_to_date
')
AND partner_id IN (SELECT id FROM res_partner WHERE cooperative_state
in ('up_to_date', 'unsubscribed
')
"""
"""
self
.
env
.
cr
.
execute
(
sql
)
self
.
env
.
cr
.
execute
(
sql
)
extension_ids
=
self
.
env
.
cr
.
fetchall
()
extension_ids
=
self
.
env
.
cr
.
fetchall
()
...
...
lacagette_addons/lacagette_membership/models/shift_counter_event.py
View file @
38988e61
...
@@ -21,7 +21,9 @@ class ShiftCounterEvent(models.Model):
...
@@ -21,7 +21,9 @@ class ShiftCounterEvent(models.Model):
points_after_removal
=
points_before_removing_points
+
vals
[
'point_qty'
]
points_after_removal
=
points_before_removing_points
+
vals
[
'point_qty'
]
_logger
.
info
(
"points_after_removal =
%
s"
,
str
(
points_after_removal
))
_logger
.
info
(
"points_after_removal =
%
s"
,
str
(
points_after_removal
))
if
points_after_removal
<=
suspension_limit
or
points_after_removal
<=
unsubscribe_limit
:
if
points_after_removal
<=
suspension_limit
or
points_after_removal
<=
unsubscribe_limit
:
if
points_after_removal
<=
suspension_limit
:
if
(
points_after_removal
<=
suspension_limit
and
res_partner
[
0
]
.
cooperative_state
!=
'delay'
):
target_status
=
'suspended'
target_status
=
'suspended'
if
points_after_removal
<=
unsubscribe_limit
:
if
points_after_removal
<=
unsubscribe_limit
:
target_status
=
'unsubscribed'
target_status
=
'unsubscribed'
...
...
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