Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
I
invoice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
2
Merge Requests
2
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kb
invoice
Commits
a9b0eb85
Commit
a9b0eb85
authored
Sep 10, 2019
by
Patrick Kimber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
List of invoice issues
https://www.kbsoftware.co.uk/crm/ticket/4121/
parent
79a70abc
Pipeline
#81359677
passed with stage
in 5 minutes and 40 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
2 deletions
+81
-2
invoice/models.py
invoice/models.py
+11
-0
invoice/tests/test_invoice_issue.py
invoice/tests/test_invoice_issue.py
+68
-0
invoice/views.py
invoice/views.py
+2
-2
No files found.
invoice/models.py
View file @
a9b0eb85
...
...
@@ -633,6 +633,17 @@ class InvoiceIssueManager(models.Manager):
invoice_issue_line
.
save
()
return
invoice_issue_line
def
issues
(
self
,
invoice_date
=
None
):
if
invoice_date
is
None
:
qs
=
self
.
model
.
objects
.
all
()
else
:
qs
=
self
.
model
.
objects
.
filter
(
invoice__invoice_date
=
invoice_date
)
return
qs
def
issues_outstanding
(
self
,
invoice_date
=
None
):
qs
=
self
.
issues
(
invoice_date
)
return
qs
.
exclude
(
confirmed
=
True
)
class
InvoiceIssue
(
models
.
Model
):
"""Invoices issues.
...
...
invoice/tests/test_invoice_issue.py
View file @
a9b0eb85
...
...
@@ -51,6 +51,74 @@ def test_init_invoice_issue_two_issues_for_one_invoice():
assert
2
==
InvoiceIssueLine
.
objects
.
count
()
@
pytest
.
mark
.
parametrize
(
"invoice_date,expect"
,
[
(
date
(
2019
,
1
,
31
),
[
"A"
]),
(
date
(
2019
,
7
,
20
),
[
"B"
,
"C"
]),
(
None
,
[
"A"
,
"B"
,
"C"
]),
],
)
@
pytest
.
mark
.
django_db
def
test_issues
(
invoice_date
,
expect
):
issue_a
=
InvoiceIssue
.
objects
.
init_invoice_issue
(
InvoiceFactory
(
invoice_date
=
date
(
2019
,
1
,
31
)),
"A"
)
issue_a
.
invoice_issue
.
comment
=
"A"
issue_a
.
invoice_issue
.
save
()
# b
issue_b
=
InvoiceIssue
.
objects
.
init_invoice_issue
(
InvoiceFactory
(
invoice_date
=
date
(
2019
,
7
,
20
)),
"B"
)
issue_b
.
invoice_issue
.
comment
=
"B"
issue_b
.
invoice_issue
.
save
()
# c
issue_c
=
InvoiceIssue
.
objects
.
init_invoice_issue
(
InvoiceFactory
(
invoice_date
=
date
(
2019
,
7
,
20
)),
"C"
)
issue_c
.
invoice_issue
.
comment
=
"C"
issue_c
.
invoice_issue
.
save
()
assert
set
(
expect
)
==
set
(
[
x
.
comment
for
x
in
InvoiceIssue
.
objects
.
issues
(
invoice_date
)]
)
@
pytest
.
mark
.
parametrize
(
"invoice_date,expect"
,
[
(
date
(
2019
,
1
,
31
),
[
"A"
]),
(
date
(
2019
,
7
,
20
),
[
"C"
]),
(
None
,
[
"A"
,
"C"
]),
],
)
@
pytest
.
mark
.
django_db
def
test_issues_outstanding
(
invoice_date
,
expect
):
issue_a
=
InvoiceIssue
.
objects
.
init_invoice_issue
(
InvoiceFactory
(
invoice_date
=
date
(
2019
,
1
,
31
)),
"A"
)
issue_a
.
invoice_issue
.
comment
=
"A"
issue_a
.
invoice_issue
.
save
()
# b
issue_b
=
InvoiceIssue
.
objects
.
init_invoice_issue
(
InvoiceFactory
(
invoice_date
=
date
(
2019
,
7
,
20
)),
"B"
)
issue_b
.
invoice_issue
.
comment
=
"B"
issue_b
.
invoice_issue
.
confirmed
=
True
issue_b
.
invoice_issue
.
save
()
# c
issue_c
=
InvoiceIssue
.
objects
.
init_invoice_issue
(
InvoiceFactory
(
invoice_date
=
date
(
2019
,
7
,
20
)),
"C"
)
issue_c
.
invoice_issue
.
comment
=
"C"
issue_c
.
invoice_issue
.
save
()
assert
set
(
expect
)
==
set
(
[
x
.
comment
for
x
in
InvoiceIssue
.
objects
.
issues_outstanding
(
invoice_date
)
]
)
@
pytest
.
mark
.
django_db
def
test_lines
():
invoice
=
InvoiceFactory
()
...
...
invoice/views.py
View file @
a9b0eb85
...
...
@@ -982,8 +982,8 @@ class ReconcileDayView(
).
order_by
(
"invoice_date"
)
def
_issues
(
self
):
date
=
self
.
_date
()
return
InvoiceIssue
.
objects
.
filter
(
invoice__invoice_date
=
date
).
order_by
(
invoice_
date
=
self
.
_date
()
return
InvoiceIssue
.
objects
.
issues
(
invoice_
date
).
order_by
(
"invoice_id"
,
"pk"
)
...
...
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