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
5b449b09
Commit
5b449b09
authored
Feb 08, 2022
by
Etienne Freiss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make old envelop visible
parent
d378cd28
Pipeline
#1770
failed with stage
in 1 minute 39 seconds
Changes
5
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
4 deletions
+28
-4
models.py
envelops/models.py
+5
-1
envelops.js
envelops/static/js/envelops.js
+0
-0
views.py
envelops/views.py
+3
-3
couchdb.py
members/management/commands/couchdb.py
+8
-0
index.html
templates/envelops/index.html
+12
-0
No files found.
envelops/models.py
View file @
5b449b09
...
@@ -111,6 +111,10 @@ class CagetteEnvelops(models.Model):
...
@@ -111,6 +111,10 @@ class CagetteEnvelops(models.Model):
def
delete_envelop
(
self
,
envelop
):
def
delete_envelop
(
self
,
envelop
):
return
self
.
c_db
.
delete
(
envelop
)
return
self
.
c_db
.
delete
(
envelop
)
def
archive_envelop
(
self
,
envelop
):
envelop
[
'archive'
]
=
True
return
self
.
c_db
.
dbc
.
update
([
envelop
])
def
generate_envelop_display_id
(
self
):
def
generate_envelop_display_id
(
self
):
"""Generate a unique incremental id to display"""
"""Generate a unique incremental id to display"""
c_db
=
CouchDB
(
arg_db
=
'envelops'
)
c_db
=
CouchDB
(
arg_db
=
'envelops'
)
...
@@ -172,7 +176,7 @@ class CagetteEnvelops(models.Model):
...
@@ -172,7 +176,7 @@ class CagetteEnvelops(models.Model):
else
:
else
:
# Get the oldest check envelops, limited by the number of checks
# Get the oldest check envelops, limited by the number of checks
docs
=
[]
docs
=
[]
for
item
in
c_db
.
dbc
.
view
(
'index/by_type'
,
key
=
'ch'
,
include_docs
=
True
,
limit
=
payment_data
[
'checks_nb'
]):
for
item
in
c_db
.
dbc
.
view
(
'index/by_type
_not_archive
'
,
key
=
'ch'
,
include_docs
=
True
,
limit
=
payment_data
[
'checks_nb'
]):
docs
.
append
(
item
.
doc
)
docs
.
append
(
item
.
doc
)
# If only 1 check to save
# If only 1 check to save
...
...
envelops/static/js/envelops.js
View file @
5b449b09
This diff is collapsed.
Click to expand it.
envelops/views.py
View file @
5b449b09
...
@@ -27,7 +27,7 @@ def archive_envelop(request):
...
@@ -27,7 +27,7 @@ def archive_envelop(request):
res_envelop
=
""
res_envelop
=
""
envelop
=
json
.
loads
(
request
.
body
.
decode
())
envelop
=
json
.
loads
(
request
.
body
.
decode
())
# save each partner payment
# save each partner payment
for
partner_id
in
envelop
[
'envelop_content'
]:
for
partner_id
in
envelop
[
'envelop_content'
]:
# If payment_id in payment details: payment already saved. Skip saving.
# If payment_id in payment details: payment already saved. Skip saving.
...
@@ -75,8 +75,8 @@ def archive_envelop(request):
...
@@ -75,8 +75,8 @@ def archive_envelop(request):
coop_logger
.
error
(
"Cannot attach payment error message to member :
%
s"
,
str
(
e
))
coop_logger
.
error
(
"Cannot attach payment error message to member :
%
s"
,
str
(
e
))
try
:
try
:
#
Delet
e envelop from couchdb
#
archiv
e envelop from couchdb
res_envelop
=
m
.
delet
e_envelop
(
envelop
)
res_envelop
=
m
.
archiv
e_envelop
(
envelop
)
except
Exception
as
e
:
except
Exception
as
e
:
res_envelop
=
"error"
res_envelop
=
"error"
...
...
members/management/commands/couchdb.py
View file @
5b449b09
...
@@ -53,9 +53,17 @@ class Command(BaseCommand):
...
@@ -53,9 +53,17 @@ class Command(BaseCommand):
byTypeMapFunction
=
'''function(doc) {
byTypeMapFunction
=
'''function(doc) {
emit(doc.type);
emit(doc.type);
}'''
}'''
byTypeNotArchiveMapFunction
=
'''function(doc) {
if(doc.archive != true){
emit(doc.type);
}
}'''
views
=
{
views
=
{
"by_type"
:
{
"by_type"
:
{
"map"
:
byTypeMapFunction
"map"
:
byTypeMapFunction
},
"by_type_not_archive"
:
{
"map"
:
byTypeNotArchiveMapFunction
}
}
}
}
self
.
createView
(
dbConn
,
"index"
,
views
)
self
.
createView
(
dbConn
,
"index"
,
views
)
...
...
templates/envelops/index.html
View file @
5b449b09
...
@@ -39,6 +39,18 @@
...
@@ -39,6 +39,18 @@
</div>
</div>
</section>
</section>
<section
id=
"archive_cash"
>
<h2
class=
"txtcenter"
>
Enveloppes de liquide archivées
</h2>
<div
id=
"archive_cash_envelops"
class=
"flex-container flex-column-reverse"
>
</div>
</section>
<section
id=
"archive_ch"
>
<h2
class=
"txtcenter"
>
Enveloppes de chèques archivées
</h2>
<div
id=
"archive_ch_envelops"
class=
"flex-container flex-column-reverse"
>
</div>
</section>
</section>
</section>
<div
id=
"templates"
style=
"display:none;"
>
<div
id=
"templates"
style=
"display:none;"
>
...
...
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