From 9f835a30df5c17d8a4f7630770655bb8f3175116 Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Wed, 12 Aug 2020 12:00:21 +0000 Subject: [PATCH] [REF] point_of_sale: simplify media print The old implementation manually sets 'display' to 'none' to the elements we don't want to see in the print. This is tedious because we need to identify every element to be hidden when in fact we know the only element that we want to print -- the receipt. So in this commit, we set the 'visibility' of all elements to 'hidden' and only the element tree of the receipt is set to visible. --- addons/point_of_sale/static/src/css/pos.css | 80 ++++----------------- 1 file changed, 12 insertions(+), 68 deletions(-) diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index 137465b54ad..f3af94c55b9 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -1690,67 +1690,20 @@ td { } @media print { - * { + body * { + visibility: hidden; + } + .pos .receipt-screen .pos-receipt-container { + position: fixed; + top: 0; + left: 0; + } + .pos .receipt-screen .pos-receipt-container * { + visibility: visible; + background: white !important; color: black !important; } - body { - margin: 0; - color: white !important; - /* avoid black background if backgrounds are printed */ - background: initial; - } - .o_notification_manager, - .oe_leftbar, - .oe_loading, - .pos .pos-topheader, - .pos .pos-leftpane, - .pos .keyboard_frame, - .pos .receipt-screen header, - .pos .receipt-screen .top-content, - .pos .receipt-screen .centered-content .button, - .pos .receipt-screen .centered-content .print_invoice { - display: none !important; - } - .pos, - .pos .pos-content, - .pos .rightpane, - .pos .screen, - .pos .window, - .pos .window .subwindow, - .pos .subwindow .subwindow-container{ - display: block; - position: static; - height: auto; - } - .pos{ - background: white !important; - } - .pos .rightpane { - left: 0px !important; - background-color: white; - } - .pos .receipt-screen { - text-align: left; - } - .pos .receipt-screen .centered-content{ - position: static; - border: none; - } - .pos .pos-receipt-container { - text-align: left; - } - .pos-actionbar { - display: none !important; - } - .debug-widget{ - display: none !important; - } - .pos *{ - text-shadow: none !important; - box-shadow: none !important; - background: transparent !important; - } - .pos .pos-receipt{ + .pos .pos-receipt { margin: 0; margin-left: auto !important; margin-right: auto !important; @@ -1758,15 +1711,6 @@ td { font-size: 13px !important; width: 266px !important; } - .o_debug_manager { - display: none !important; - } - .o_chat_window { - display: none !important; - } - .blockUI { - display: none !important; - } } /* d) The Scale screen */