Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
39f428a6
Commit
39f428a6
authored
Nov 24, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: Fixup! Skip if Cloud Contract has no Lines
parent
6c968390
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/Entity_statSlapOSOutstandingAmount.py
...ins/slapos_contract/Entity_statSlapOSOutstandingAmount.py
+10
-4
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_contract/Entity_statSlapOSOutstandingAmount.py
View file @
39f428a6
...
...
@@ -29,16 +29,22 @@ currency_uid_list = [
portal
.
currency_module
.
CNY
.
getUid
(),
]
contract_line_list
=
contract
.
objectValues
(
portal_type
=
"Cloud Contract Line"
)
if
not
len
(
contract_line_list
):
return
context
.
Entity_statOutstandingAmount
(
at_date
=
at_date
)
for
currency_uid
in
currency_uid_list
:
for
line
in
contract
.
objectValues
(
portal_type
=
"Cloud Contract Line"
):
for
line
in
contract_line_list
:
if
line
.
getPriceCurrencyUid
()
==
currency_uid
:
maximum_invoice_credit
=
line
.
getMaximumInvoiceCredit
()
amount_per_currency
=
context
.
Entity_statOutstandingAmount
(
at_date
=
at_date
,
resource_uid
=
currency_uid
)
if
amount_per_currency
>
maximum_invoice_credit
:
return
amount_per_currency
# We exceed maximum amount because
# user already requested too much
return
amount_per_currency
-
maximum_invoice_credit
# We exceed maximum amount because
# user already requested too much
if
maximum_invoice_delay
:
# Recalculate now ignoring the all invoices from lastest days.
...
...
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