# 83 Publication rework EcoAccount Compensation
* adds implementation for is_ready_for_publish() on compensation (uses intervention's implementation) and EcoAccount
This commit is contained in:
parent
20ed6a7720
commit
469dabf6aa
@ -193,6 +193,16 @@ class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMix
|
|||||||
)
|
)
|
||||||
return deduction
|
return deduction
|
||||||
|
|
||||||
|
def is_ready_for_publish(self) -> bool:
|
||||||
|
""" Checks whether the data passes all constraints for being publishable
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
is_ready (bool) : True|False
|
||||||
|
"""
|
||||||
|
is_recorded = self.recorded is not None
|
||||||
|
is_ready = is_recorded
|
||||||
|
return is_ready
|
||||||
|
|
||||||
|
|
||||||
class EcoAccountDocument(AbstractDocument):
|
class EcoAccountDocument(AbstractDocument):
|
||||||
"""
|
"""
|
||||||
|
@ -451,7 +451,7 @@ def report_view(request: HttpRequest, id: str):
|
|||||||
|
|
||||||
tab_title = _("Report {}").format(comp.identifier)
|
tab_title = _("Report {}").format(comp.identifier)
|
||||||
# If intervention is not recorded (yet or currently) we need to render another template without any data
|
# If intervention is not recorded (yet or currently) we need to render another template without any data
|
||||||
if not comp.intervention.recorded:
|
if not comp.intervention.is_ready_for_publish():
|
||||||
template = "report/unavailable.html"
|
template = "report/unavailable.html"
|
||||||
context = {
|
context = {
|
||||||
TAB_TITLE_IDENTIFIER: tab_title,
|
TAB_TITLE_IDENTIFIER: tab_title,
|
||||||
|
@ -553,7 +553,7 @@ def report_view(request:HttpRequest, id: str):
|
|||||||
|
|
||||||
tab_title = _("Report {}").format(acc.identifier)
|
tab_title = _("Report {}").format(acc.identifier)
|
||||||
# If intervention is not recorded (yet or currently) we need to render another template without any data
|
# If intervention is not recorded (yet or currently) we need to render another template without any data
|
||||||
if not acc.recorded:
|
if not acc.is_ready_for_publish():
|
||||||
template = "report/unavailable.html"
|
template = "report/unavailable.html"
|
||||||
context = {
|
context = {
|
||||||
TAB_TITLE_IDENTIFIER: tab_title,
|
TAB_TITLE_IDENTIFIER: tab_title,
|
||||||
|
Loading…
Reference in New Issue
Block a user