Skip to Content
Menu
This question has been flagged
1 Reply
1316 Views

custom_receipt_header.js
/** @odoo-module */

import { patch } from "@web/core/utils/patch";

import { Order } from "@point_of_sale/app/store/models";

import { ReceiptScreen } from "@point_of_sale/app/screens/receipt_screen/receipt_screen";

import { onWillUnmount } from "@odoo/owl";

import { FloorScreen } from "@pos_restaurant/app/floor_screen/floor_screen";


patch(Order.prototype, {

export_for_printing() {

const result = super.export_for_printing(...arguments);

result.headerData = {

...this.pos.getReceiptHeaderData(),

date_order : this.date_order,

}

return result;

},

})


code standart in pos_restaurant not active when i using custom_receipt_header.js

Avatar
Discard
Best Answer

Hi,


To include the table name in the receipt header, Update the export_for_printing method to include the table name in the headerData.


JS:


/** @odoo-module */


import { patch } from "@web/core/utils/patch";

import { Order } from "@point_of_sale/app/store/models";


patch(Order.prototype, {

export_for_printing() {

const result = super.export_for_printing(...arguments);

result.headerData = {

...this.pos.getReceiptHeaderData(),

date_order: this.date_order,

table_name: this.pos.table ? this.pos.table.name : "",

};

return result;

},

})


XML:

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
    <t t-name="CustomReceiptHeader.ReceiptHeader"
       t-inherit="point_of_sale.ReceiptHeader" t-inherit-mode="extension">
            <xpath expr="//div[hasclass('cashier')]" position="after">
                <div>
                    <t t-esc="this.props.data.date_order"/>
                </div>
                <div>
                    <t t-esc="this.props.data.table_name"/>
                </div>
            </xpath>
        </t>
</templates>


Hope it helps


Avatar
Discard
Related Posts Replies Views Activity
1
Jan 25
1108
1
Aug 24
1131
0
Jun 24
1062
2
Jan 23
3060
1
May 18
4499