Skip to content

Commit

Permalink
Merge pull request #187 from acsone/fix-cmis_report_write_render-jdo
Browse files Browse the repository at this point in the history
[FIX] cmis_report_write: add override to render again to save files in cmis_folder
  • Loading branch information
FrancoMaxime authored Jun 12, 2024
2 parents 94ded0c + 93e258d commit 0c48496
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmis_field/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"external_dependencies": {
"python": [
"cmislib>=0.7.0",
"cmislib", # >= 0.7.0
]
},
}
11 changes: 10 additions & 1 deletion cmis_report_write/models/ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ def _render_qweb_pdf(self, report_ref, res_ids, data=None):
self.with_context(cmis_report_keys=(report, SAVE_IN_CMIS_MARKER)),
)._render_qweb_pdf(report_ref, res_ids, data=data)

@api.model
def _render(self, report_ref, res_ids, data=None):
report = self._get_report(report_ref)
with report.save_in_attachment_if_required():
return super(
IrActionsReport,
self.with_context(cmis_report_keys=(report, SAVE_IN_CMIS_MARKER)),
)._render(report_ref, res_ids, data=data)

def retrieve_attachment(self, record):
if self.attachment != SAVE_IN_CMIS_MARKER:
return super().retrieve_attachment(record)
Expand Down Expand Up @@ -210,7 +219,7 @@ def _get_cmis_filename(self, record):
def _get_backend(self, record):
self.ensure_one()
if self.cmis_folder_field_id:
field = record._fields[self.cmis_folder_field_id.name]
field = record._fields[self.sudo().cmis_folder_field_id.name]
return field.get_backend(self.env)
return self.cmis_backend_id

Expand Down

0 comments on commit 0c48496

Please sign in to comment.