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
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
123 additions
and
21 deletions
+123
-21
models.py
envelops/models.py
+5
-1
envelops.js
envelops/static/js/envelops.js
+96
-18
views.py
envelops/views.py
+2
-2
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):
def
delete_envelop
(
self
,
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
):
"""Generate a unique incremental id to display"""
c_db
=
CouchDB
(
arg_db
=
'envelops'
)
...
...
@@ -172,7 +176,7 @@ class CagetteEnvelops(models.Model):
else
:
# Get the oldest check envelops, limited by the number of checks
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
)
# 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
...
...
@@ -75,8 +75,8 @@ def archive_envelop(request):
coop_logger
.
error
(
"Cannot attach payment error message to member :
%
s"
,
str
(
e
))
try
:
#
Delet
e envelop from couchdb
res_envelop
=
m
.
delet
e_envelop
(
envelop
)
#
archiv
e envelop from couchdb
res_envelop
=
m
.
archiv
e_envelop
(
envelop
)
except
Exception
as
e
:
res_envelop
=
"error"
...
...
members/management/commands/couchdb.py
View file @
5b449b09
...
...
@@ -53,9 +53,17 @@ class Command(BaseCommand):
byTypeMapFunction
=
'''function(doc) {
emit(doc.type);
}'''
byTypeNotArchiveMapFunction
=
'''function(doc) {
if(doc.archive != true){
emit(doc.type);
}
}'''
views
=
{
"by_type"
:
{
"map"
:
byTypeMapFunction
},
"by_type_not_archive"
:
{
"map"
:
byTypeNotArchiveMapFunction
}
}
self
.
createView
(
dbConn
,
"index"
,
views
)
...
...
templates/envelops/index.html
View file @
5b449b09
...
...
@@ -39,6 +39,18 @@
</div>
</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>
<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