[14.0][FWD] partner_statement

- Added html and xlsx support for activity outgoing statement
This commit is contained in:
Christopher Ormaza
2021-11-29 16:08:24 -05:00
committed by Miquel Raïch
parent f3e1ac3b18
commit 17a596997a
13 changed files with 619 additions and 21 deletions

View File

@@ -11,9 +11,22 @@ class OutstandingStatementWizard(models.TransientModel):
_inherit = "statement.common.wizard"
_description = "Outstanding Statement Wizard"
def _export(self):
"""Export to PDF."""
def _print_report(self, report_type):
self.ensure_one()
data = self._prepare_statement()
return self.env.ref(
"partner_statement.action_print_outstanding_statement"
).report_action(self.ids, data=data)
if report_type == "xlsx":
report_name = "p_s.report_outstanding_statement_xlsx"
else:
report_name = "partner_statement.outstanding_statement"
return (
self.env["ir.actions.report"]
.search(
[("report_name", "=", report_name), ("report_type", "=", report_type)],
limit=1,
)
.report_action(self, data=data)
)
def _export(self, report_type):
"""Default export is PDF."""
return self._print_report(report_type)