[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

@@ -29,14 +29,27 @@ class ActivityStatementWizard(models.TransientModel):
else:
self.date_start = self.date_end - relativedelta(days=30)
def _export(self):
"""Export to PDF."""
data = self._prepare_statement()
return self.env.ref(
"partner_statement.action_print_activity_statement"
).report_action(self.ids, data=data)
def _prepare_statement(self):
res = super()._prepare_statement()
res.update({"date_start": self.date_start})
return res
def _print_report(self, report_type):
self.ensure_one()
data = self._prepare_statement()
if report_type == "xlsx":
report_name = "p_s.report_activity_statement_xlsx"
else:
report_name = "partner_statement.activity_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)