diff --git a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js index f5f02da6990..800b583215f 100644 --- a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js +++ b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js @@ -117,34 +117,6 @@ export class AttachmentViewer extends Component { } } - /** - * Prompt the browser print of this attachment. - * - * @private - */ - _print() { - const printWindow = window.open('about:blank', '_new'); - printWindow.document.open(); - printWindow.document.write(` - - - - - - - - `); - printWindow.document.close(); - } - /** * Rotate the image by 90 degrees to the right. * @@ -290,7 +262,7 @@ export class AttachmentViewer extends Component { */ _onClickPrint(ev) { ev.stopPropagation(); - this._print(); + this.attachmentViewer.print(); } /** diff --git a/addons/mail/static/src/models/attachment_viewer.js b/addons/mail/static/src/models/attachment_viewer.js index 0036e77fd8a..990aa45da0b 100644 --- a/addons/mail/static/src/models/attachment_viewer.js +++ b/addons/mail/static/src/models/attachment_viewer.js @@ -112,6 +112,31 @@ registerModel({ } this.dialogOwner.attachmentListOwnerAsAttachmentView.selectPreviousAttachment(); }, + /** + * Prompt the browser print of this attachment. + */ + print() { + const printWindow = window.open('about:blank', '_new'); + printWindow.document.open(); + printWindow.document.write(` + + + + + + + + `); + printWindow.document.close(); + }, /** * @private * @returns {string}