You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
2.0 KiB
49 lines
2.0 KiB
/** @odoo-module **/
|
|
import { Component } from "@odoo/owl";
|
|
import { _lt, _t } from "@web/core/l10n/translation";
|
|
import { registry } from "@web/core/registry";
|
|
import { AbstractAwaitablePopup } from "@point_of_sale/app/popup/abstract_awaitable_popup";
|
|
import { usePos } from "@point_of_sale/app/store/pos_hook";
|
|
|
|
export class PrintPopup extends AbstractAwaitablePopup {
|
|
static template = "PrintPopup";
|
|
setup() {
|
|
super.setup();
|
|
this.pos = usePos();
|
|
}
|
|
async printReceipt() {
|
|
console.log(this,'this,,,,,,,')
|
|
/*create a new window to hold the content to be printed*/
|
|
var printWindow = window.open('', 'PrintWindow', 'height=600,width=400');
|
|
console.log(this.__owl__.bdom.el.innerHTML,'owl..........')
|
|
/* get the HTML content of the popup, excluding the buttons*/
|
|
var content = this.__owl__.bdom.el.innerHTML;
|
|
printWindow.document.write(content);
|
|
/* print the content and close the window*/
|
|
printWindow.print();
|
|
window.location.reload();
|
|
}
|
|
async cancel() {
|
|
/*Orders are cancelled through the cancel function.*/
|
|
window.location.reload();
|
|
}
|
|
get orderlines() {
|
|
/*Selected order lines are passed to UI.*/
|
|
var orderlines = this.pos.selectedOrder.orderlines
|
|
var orderlinesList = []
|
|
orderlines.forEach(function (orderlines) {
|
|
var totalprice = orderlines.price * orderlines.quantity
|
|
orderlinesList.push([orderlines.product.display_name, orderlines.quantity, orderlines.price, totalprice])
|
|
})
|
|
return orderlinesList;
|
|
}
|
|
get total() {
|
|
/*Total is calculated and passed*/
|
|
var total = 0
|
|
var totalvalues = this.pos.selectedOrder.paymentlines
|
|
totalvalues.forEach(function (totalvalues) {
|
|
total = total + totalvalues.amount
|
|
})
|
|
return total;
|
|
}
|
|
}
|
|
|