Odoo 18 provides a robust and adaptable Point of Sale (POS) module, enabling businesses to tailor workflows according to their unique requirements. One of the requirements is transferring session-based data from the front-end POS interface to the backend POS orders. This allows for tracking additional details such as customer feedback, promotional notes, or special instructions related to a sale.
In this blog, we will explore how to load session data from the POS front-end into the POS order in Odoo 18. As an example, we will integrate a customer suggestion field into the POS order and ensure that data entered in the POS session is correctly stored in the backend.
Add a Custom Field to the POS Order Model
First, let’s add a custom field to the pos.order model to store customer suggestions entered during the session before saving session data,
from odoo import fields, models
class PosOrder(models.Model):
_inherit = 'pos.order'
suggestion = fields.Char(
string='Customer Suggestion',
readonly=True,
help='Customer suggestion can be seen here'
)
Now, we have added the suggestion field to store customer feedback. Next, we need to modify the POS order form view to include this field in the backend display.
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_pos_order_form" model="ir.ui.view">
<field name="name">pos.order.form.view</field>
<field name="model">pos.order</field>
<field name="inherit_id" ref="point_of_sale.view_pos_pos_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='extra']" position="inside">
<group string="Customer Feedback">
<field name="suggestion"/>
</group>
</xpath>
</field>
</record>
</odoo>
This ensures that customer suggestions appear in the POS order form under the Extra tab, as shown below.

Add Customer Suggestion Button in the POS Interface
Now, let's add a Customer Suggestion button to the payment screen in the POS session to enable cashiers to gather customer suggestions.
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="pos_custom.PaymentScreenButtons"
t-inherit="point_of_sale.PaymentScreenButtons"
t-inherit-mode="extension">
<xpath expr="//button[hasclass('partner-button')]" position="after">
<button
class="button btn btn-light py-3 text-start rounded-0 border-bottom"
t-on-click="() => this.customer_suggestion()">
<i class="fa fa-file-text-o"/> Customer Suggestion
</button>
</xpath>
</t>
</templates>
This will place a Customer Suggestion button on the Payment Screen.

Define the Click Functionality of the Customer Suggestion Button
Now, we need to implement functionality for this button to capture and store user input.
/** @odoo-module **/
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
import { patch } from "@web/core/utils/patch";
import { _t } from "@web/core/l10n/translation";
import { TextInputPopup } from "@point_of_sale/app/utils/input_popups/text_input_popup";
import { makeAwaitable } from "@point_of_sale/app/store/make_awaitable_dialog";
patch(PaymentScreen.prototype, {
async customer_suggestion() {
const selectedOrder = this.pos.get_order();
if (!selectedOrder) {
console.warn("No active order found.");
return;
}
const existingSuggestion = selectedOrder.suggestion || ""; // Retrieve existing suggestion if any
const payload = await makeAwaitable(this.dialog, TextInputPopup, {
title: _t("Add Customer Suggestion"),
rows: 4,
startingValue: existingSuggestion,
});
if (payload && typeof payload === "string") {
selectedOrder.set_customer_suggestion(payload);
}
return { confirmed: typeof payload === "string", inputSuggestion: payload };
}
});
This will open a popup to enter a suggestion when clicking the button and store the input in the POS session.

Load Customer Suggestions from POS Session to POS Order
To save the suggestions in the backend, we need to extend the order model to include the suggestion when exporting data.
/** @odoo-module */
import { patch } from "@web/core/utils/patch";
import { PosOrder } from "@point_of_sale/app/models/pos_order";
patch(PosOrder.prototype, {
setup(vals) {
super.setup(vals);
this.suggestion = vals.suggestion || false;
},
set_customer_suggestion(suggestion) {
this.suggestion = suggestion;
},
});
This ensures that suggestions entered in the POS session are stored and transferred to the backend order.
Now let's check the workflow by creating an order and adding a suggestion as follows.

Once the order is validated, we can see the Customer suggestion saved on the backend in the corresponding field.

By following these steps, we successfully loaded session-based data from the POS interface into backend POS orders in Odoo 18. Now, customer suggestions collected during the POS session are permanently stored in the POS order for future reference. This customization enhances customer interaction, business insights, and order tracking in Odoo 18.
This method can be expanded to store additional session-based details, including delivery instructions, discount approvals, or customer feedback.
To read more about how to load POS Session Data to POS Order in Odoo 17, refer to our blog How to Load POS Session Data to POS Order in Odoo 17.