Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
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
2
Merge Requests
2
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
third-party
Commits
0c5db861
Commit
0c5db861
authored
Aug 14, 2023
by
François C.
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_cooperatic' into meal-voucher-and-label-printer-software-bug
parents
7d9d385a
de580bd6
Pipeline
#2892
failed with stage
in 1 minute 4 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
24 deletions
+55
-24
admin.py
members/admin.py
+39
-16
reception_produits.js
reception/static/js/reception_produits.js
+6
-5
models.py
shifts/models.py
+9
-2
faq.html
templates/members_space/supercafoutch/faq.html
+1
-1
No files found.
members/admin.py
View file @
0c5db861
...
...
@@ -552,6 +552,13 @@ def delete_shift_template_registration(request):
if
permanent_unsuscribe
is
True
:
res
[
"set_done"
]
=
cm
.
set_cooperative_state
(
"gone"
)
if
res
[
"set_done"
]:
""" Delete pair(s?) of partner if it is a parent to improve statistics (#4810) """
api
=
OdooAPI
()
associated_members
=
api
.
search_read
(
'res.partner'
,
[[
'parent_id'
,
'='
,
partner_id
]],
[
'id'
])
for
am
in
associated_members
:
data
=
{
"child"
:
{
"id"
:
am
[
"id"
]},
"gone"
:
[
"parent"
,
"child"
]}
delete_pair_core
(
data
)
except
Exception
as
e
:
res
[
"error"
]
=
str
(
e
)
...
...
@@ -895,26 +902,42 @@ def delete_pair(request):
return
HttpResponse
(
template
.
render
(
context
,
request
))
elif
request
.
method
==
'POST'
:
if
CagetteUser
.
are_credentials_ok
(
request
):
api
=
OdooAPI
()
data
=
json
.
loads
(
request
.
body
.
decode
())
child_id
=
int
(
data
[
'child'
][
'id'
])
child
=
api
.
search_read
(
'res.partner'
,
[[
'id'
,
'='
,
child_id
]],
[
'email'
,
'id'
,
'parent_id'
])[
0
]
child_accounts
=
api
.
search_read
(
'res.partner'
,
[[
'email'
,
'='
,
child
[
'email'
]]],
[
'id'
,
'email'
])
prev_child
=
[
x
[
'id'
]
for
x
in
child_accounts
if
x
[
'id'
]
!=
child_id
]
parent
=
api
.
search_read
(
'res.partner'
,
[[
'id'
,
'='
,
child
[
'parent_id'
][
0
]]],
[
'cooperative_state'
])[
0
]
api
.
update
(
'res.partner'
,
[
child_id
],
{
"parent_id"
:
False
,
"is_associated_people"
:
False
,
"active"
:
False
,
"is_former_associated_people"
:
True
})
child_update_fields
=
{
'cooperative_state'
:
"unsubscribed"
,
"is_former_associated_people"
:
True
}
if
'gone'
in
data
and
'child'
in
data
[
'gone'
]:
child_update_fields
[
'cooperative_state'
]
=
"gone"
for
id
in
prev_child
:
api
.
update
(
"res.partner"
,
[
id
],
child_update_fields
)
if
'gone'
in
data
and
'parent'
in
data
[
'gone'
]:
api
.
update
(
"res.partner"
,
[
parent
[
'id'
]],
{
'cooperative_state'
:
"gone"
,
"is_former_associated_people"
:
True
})
delete_pair_core
(
data
)
response
=
JsonResponse
({
"message"
:
"Succesfuly unpaired members"
},
status
=
200
)
else
:
response
=
JsonResponse
({
"message"
:
"Unauthorized"
},
status
=
403
)
return
response
else
:
return
JsonResponse
({
"message"
:
"Method Not Allowed"
},
status
=
405
)
def
delete_pair_core
(
data
):
"""
Core of delete_pair
argument example :
{
"child": {
"id": "1620"
},
"gone": [
"parent",
"child"
]
}
"""
api
=
OdooAPI
()
child_id
=
int
(
data
[
'child'
][
'id'
])
child
=
api
.
search_read
(
'res.partner'
,
[[
'id'
,
'='
,
child_id
]],
[
'email'
,
'id'
,
'parent_id'
])[
0
]
child_accounts
=
api
.
search_read
(
'res.partner'
,
[[
'email'
,
'='
,
child
[
'email'
]]],
[
'id'
,
'email'
])
prev_child
=
[
x
[
'id'
]
for
x
in
child_accounts
if
x
[
'id'
]
!=
child_id
]
parent
=
api
.
search_read
(
'res.partner'
,
[[
'id'
,
'='
,
child
[
'parent_id'
][
0
]]],
[
'cooperative_state'
])[
0
]
api
.
update
(
'res.partner'
,
[
child_id
],
{
"parent_id"
:
False
,
"is_associated_people"
:
False
,
"active"
:
False
,
"is_former_associated_people"
:
True
})
child_update_fields
=
{
'cooperative_state'
:
"unsubscribed"
,
"is_former_associated_people"
:
True
}
if
'gone'
in
data
and
'child'
in
data
[
'gone'
]:
child_update_fields
[
'cooperative_state'
]
=
"gone"
for
id
in
prev_child
:
api
.
update
(
"res.partner"
,
[
id
],
child_update_fields
)
if
'gone'
in
data
and
'parent'
in
data
[
'gone'
]:
api
.
update
(
"res.partner"
,
[
parent
[
'id'
]],
{
'cooperative_state'
:
"gone"
,
"is_former_associated_people"
:
True
})
reception/static/js/reception_produits.js
View file @
0c5db861
...
...
@@ -1270,7 +1270,7 @@ function editProductInfo (productToEdit, value = null, batch = false) {
// Check if the product is already in the 'updated' list
var
index
=
searchUpdatedProduct
();
var
firstUpdate
=
false
;
var
isValid
=
false
;
var
isValid
=
false
;
// "valid" == no change from initial value
let
newValue
=
value
;
var
addition
=
false
;
...
...
@@ -1349,7 +1349,8 @@ function editProductInfo (productToEdit, value = null, batch = false) {
firstUpdate
=
(
index
==
-
1
);
//first update
if
(
productToEdit
.
product_qty
!=
newValue
)
{
if
(
firstUpdate
)
{
// If no old_qty in productToEdit, product qty wasn't edited before
if
(
productToEdit
.
old_qty
===
undefined
)
{
productToEdit
.
old_qty
=
productToEdit
.
product_qty
;
}
else
{
//if it is not the first update AND newValue is equal to the validation qty then the product is valid (qty not changed)
...
...
@@ -1418,9 +1419,7 @@ function editProductInfo (productToEdit, value = null, batch = false) {
// If the product info has been updated and for the first time
if
(
firstUpdate
)
{
updatedProducts
.
push
(
productToEdit
);
//if product is validated thru edition -> add to valid_products
//if product is validated thru edition without change -> add to valid_products
if
(
isValid
)
{
// Create 'valid_products' list in order if not exists
if
(
!
orders
[
productToEdit
.
id_po
][
'valid_products'
])
{
...
...
@@ -1428,6 +1427,8 @@ function editProductInfo (productToEdit, value = null, batch = false) {
}
orders
[
productToEdit
.
id_po
][
'valid_products'
].
push
(
productToEdit
[
'id'
]);
}
else
{
updatedProducts
.
push
(
productToEdit
);
// Create 'updated_products' list in order if not exists
if
(
!
orders
[
productToEdit
.
id_po
][
'updated_products'
])
{
orders
[
productToEdit
.
id_po
][
'updated_products'
]
=
[];
...
...
shifts/models.py
View file @
0c5db861
...
...
@@ -306,13 +306,20 @@ class CagetteShift(models.Model):
cond
=
[[
'partner_id'
,
'='
,
int
(
data
[
'idPartner'
])],
[
'shift_id'
,
'='
,
int
(
data
[
'idShift'
])],
[
'state'
,
'='
,
'cancel'
]]
fields
=
[
'id'
]
fields
=
[
'id'
,
'origin'
]
try
:
canceled_res
=
self
.
o_api
.
search_read
(
'shift.registration'
,
cond
,
fields
,
1
)
if
(
len
(
canceled_res
)
==
1
):
shift_res
=
canceled_res
[
0
]
fieldsDatas
=
{
"related_shift_state"
:
'open'
,
"state"
:
'open'
}
"state"
:
'open'
,
"is_makeup"
:
data
[
'is_makeup'
],
"origin"
:
canceled_res
[
0
][
'origin'
]
+
' reopened from memberspace'
}
"""In case shift to reopen is a makeup, we want the counter to be incremented once shift is done
That is why template_created must be set to false
However if shift to reopen is not a makeup, counter should not be incremented so template_created should not be changed."""
if
data
[
"is_makeup"
]:
fieldsDatas
[
"template_created"
]
=
False
response
=
self
.
o_api
.
update
(
'shift.registration'
,
[
shift_res
[
'id'
]],
fieldsDatas
)
except
Exception
as
e
:
coop_logger
.
error
(
"Reopen shift :
%
s"
,
str
(
e
))
...
...
templates/members_space/supercafoutch/faq.html
View file @
0c5db861
...
...
@@ -47,7 +47,7 @@
temporaire, n’oublie pas de recontacter le Bureau des Membres à ton retour pour te
réinscrire sur un créneau.
</p>
</div>
<div
class=
"grp_text"
><h3><b>
Je m'absente plus longtemps pour une autre raison (plus de
4 semaine
s)
</b></h3>
<div
class=
"grp_text"
><h3><b>
Je m'absente plus longtemps pour une autre raison (plus de
2 moi
s)
</b></h3>
<p
class=
"attached-unblocked"
>
Envoie un mail au Bureau des Membres
<a
href=
"mailto:bdm@supercafoutch.fr?subject=Incapacité à faire mes services pour cause d'absence prolongée"
>
bdm@supercafoutch.fr
</a>
...
...
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