Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
158 Visninger

Hello community,


I am working on Odoo v19 POS and trying to integrate Bakong KHQR (Cambodian payment system) as a payment method.


So far, I have:


Created a custom module with a pos.payment.method extension (new fields like token, account, merchant info).


Added form view fields for the payment method.


Added assets (payment_bakong.js) for POS.



The problem:


I can save payment methods in backend.


But I cannot display the KHQR code on the POS payment screen.


My current XML view inheritance fails with xpath (error: Element '<xpath expr="//sheet/notebook">' cannot be located in parent view).



Questions:


1. What is the correct way to extend the POS payment screen in Odoo 19 to display a QR code (dynamic/static)?


2. Do I need to use OWL (Odoo Web Library) components for the POS frontend or can I rely on pure JS/QWeb templates?


3. Any working examples/tutorials for extending pos.payment.method with custom fields visible in the POS UI?


Resource:

pypi.org/project/bakong-khqr



Thanks a lot for your support 🙏

Avatar
Kassér
Bedste svar

Hi


In Odoo 19, the POS frontend is fully rewritten in OWL (Odoo Web Library). That means:


    You cannot reliably use only QWeb/xpath to inject UI in POS anymore.


    Instead, you extend or patch OWL components (e.g., PaymentScreen, PaymentScreenPaymentLines, or PaymentMethodButton) using patch from @web/core/utils/patch.


Example code:-


/** @odoo-module **/


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

import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";


patch(PaymentScreen.prototype, {

    setup() {

        super.setup();

        this.state.showQR = false;

    },


    async showKHQR(paymentMethod) {

        // Example: generate KHQR code with bakong-khqr lib or external API

        const qrData = "your_dynamic_qr_string";

        this.state.qrData = qrData;

        this.state.showQR = true;

    },

});


Then in your custom template:


<t t-name="pos.PaymentScreenKHQR" owl="1">

  <div t-if="state.showQR" class="bakong-qr-container">

    <img t-att-src="'/report/barcode/?type=QR&value=' + state.qrData" />

  </div>

</t>


And register the template with PaymentScreen.components.


Tips for Flow for Bakong KHQR Integration:-


    Add your custom fields (token, merchant_id, etc.) to pos.payment.method.


    Load them in POS using PosGlobalState patch (pos_data_loader.js).


    Patch PaymentScreen to detect when your KHQR payment method is selected.


    Generate QR (dynamic string) either:


        On backend via Python (using bakong-khqr pypi lib), return to POS, OR


        On frontend with a JS QR library.


    Display QR inside your custom OWL component embedded in PaymentScreen.


Hope it helps

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
0
mar. 25
1395
1
mar. 25
2403
2
feb. 25
2829
0
nov. 17
3365
3
aug. 16
3689