Skip to content

Commit

Permalink
Add legal and policy references as an option for the compact report
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhardt committed Dec 17, 2024
1 parent 45cb08b commit 4805b7c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changelog
16.2.6 (unreleased)
-------------------

- Nothing changed yet.
- Add legal and policy references as an option for the compact report
(`#2815 <https://github.com/syslabcom/scrum/issues/2815>`_)
[reinhardt]


16.2.5 (2024-12-09)
Expand Down
21 changes: 20 additions & 1 deletion src/euphorie/client/docx/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,10 @@ def use_solution_description(self):
def is_show_measure_responsible_date(self):
return "measure_responsible_date" in self.options

@property
def is_show_resources_legal_references(self):
return "resources_legal_references" in self.options

def set_answer_font(self, answer, cell):
font = self.justifiable_font.get(answer)
if font:
Expand All @@ -1058,14 +1062,16 @@ def set_cell_risk_title(self, cell, risk):
def set_cell_risk(self, cell, risk):
"""Take the risk and add the appropriate text:
title, descripton, comment, measures in place
title, description, comment, measures in place, resources
"""
self.set_cell_risk_title(cell, risk)
if self.is_show_description_of_risks:
self.set_cell_risk_description(cell, risk)
self.set_cell_risk_measures(cell, risk)
if self.is_show_comments:
self.set_cell_risk_comment(cell, risk)
if self.is_show_resources_legal_references:
self.set_resources_legal_references(cell, risk)

cell.add_paragraph(style="Risk Normal")

Expand All @@ -1083,6 +1089,19 @@ def set_cell_risk_comment(self, cell, risk):
)
self.compiler(risk["comment"], cell, style="Risk Italics")

def set_resources_legal_references(self, cell,risk):
if risk["resources"] and risk["resources"].strip():
cell.add_paragraph()
cell.add_paragraph(
api.portal.translate(
_(
"report_heading_resources",
default="Legal and policy references:",
)
),
)
self.compiler(risk["resources"], cell)

def set_cell_actions(self, cell, risk):
"""Take the risk and add the appropriate text:
Expand Down
1 change: 1 addition & 0 deletions src/euphorie/client/docx/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def get_risks_for(self, sql_module):
"postponed": sql_risk.postponed,
"number": sql_risk.number,
"priority": sql_risk.priority,
"resources": risk.legal_reference,
}
)
return risks
Expand Down
4 changes: 4 additions & 0 deletions src/euphorie/content/country.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ class ICountry(model.Schema, IBasic):
"measure_responsible_date",
title=_("Measure responsible and date"),
),
SimpleTerm(
"resources_legal_references",
title=_("Legal and policy references"),
),
]
)
),
Expand Down

0 comments on commit 4805b7c

Please sign in to comment.