[FIX] point_of_sale: Scrollbar on receipt print

A scrollbar appeared every time a receipt was printed. To fix this,
we put a height of 0 to the div that contains the receipt.

html2canvas then had trouble computing the height of the background.
There's a `height` option that can be given to the library but if the
logo on the receipt was not loaded yet, the size we computed was wrong.
We then compute the height only once the images have been loaded, in
the `onparsed` method.

We also remove a CSS class that wasn't used anymore.

X-original-commit: 84418ae5bc1509c2c45323ecf6aed4ce4811f4d5
This commit is contained in:
Antoine Prieels
2019-10-11 08:23:23 +00:00
committed by fw-bot
parent 3a2c69edbf
commit 93deb095c8
3 changed files with 10 additions and 10 deletions
@@ -1546,9 +1546,6 @@ td {
font-size: 13px !important;
width: 266px !important;
}
.pos .pos-receipts{
display: none !important;
}
.o_debug_manager {
display: none !important;
}
@@ -1,9 +1,13 @@
.pos-receipt-print {
width: 512px;
height: 0;
overflow: hidden;
position: absolute;
left: 0;
top: 0;
text-align: left;
direction: ltr;
font-size: 28px;
padding-bottom: 2em;
color: #000000;
}
@@ -55,11 +59,6 @@
color: red;
}
.pos-receipts {
height: 0;
overflow: hidden;
}
.pos-payment-terminal-receipt {
text-align: center;
font-size: 75%;
@@ -48,7 +48,11 @@ var PrinterMixin = {
var self = this;
$('.pos-receipt-print').html(receipt);
var promise = new Promise(function (resolve, reject) {
html2canvas($('.pos-receipt-print')[0], {
self.receipt = $('.pos-receipt-print>.pos-receipt');
html2canvas(self.receipt[0], {
onparsed: function(queue) {
queue.stack.ctx.height = Math.ceil(self.receipt.outerHeight() + self.receipt.offset().top);
},
onrendered: function (canvas) {
$('.pos-receipt-print').empty();
resolve(self.process_canvas(canvas));