Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
1849 Weergaven

Hi,


I am trying to add a new button under customer name in Pos Payment UI (PaymentScreen).


I try this but it don't work, Odoo said me that addControlButton does not exist in PaymentScreen.




import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";import { Component } from "@odoo/owl";import { usePos } from "@point_of_sale/app/store/pos_hook";import { patch } from "@web/core/utils/patch";
export class PosDutyFreeButton extends Component {
static template = "PosDutyFreeButton";
setup() {
this.pos = usePos();
}
async onClick() {}
}
}

PaymentScreen.addControlButton({
component: PosDutyFreeButton,
condition: function () {
return true;
},
});



Can anyone help me?


Regards,

Avatar
Annuleer
Beste antwoord

Hi,

1. Inherit PaymentScreenButtons template for adding new button after customer name.

<?xml version="1.0" encoding="UTF-8" ?>

<templates id="template" xml:space="preserve">

    <t t-name="PaymentScreenButtons" t-inherit="point_of_sale.PaymentScreenButtons" t-inherit-mode="extension">

               <xpath expr="//button[hasclass('partner-button')]" position="after">

                   //your code

               </xpath>


    </t>

    </templates>

2. Patch payment screen for adding button functionality.   

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

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


patch(PaymentScreen.prototype, {

     //Add button function

});


Hope it helps

Avatar
Annuleer
Beste antwoord

Hey Régis GEROMEGNACE,


I hope you are doing well.


I'd like to provide you with a reference screenshots:







I Hope this information proves helpful to you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
Avatar
Annuleer

Jainesh,Thanks bro

Gerelateerde posts Antwoorden Weergaven Activiteit
0
aug. 25
475
0
jul. 22
3024
0
jun. 18
3682
1
mrt. 24
1865
1
feb. 24
2813