Skip to Content
Menu
This question has been flagged

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
Discard
Best Answer

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
Discard
Best Answer

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
Discard
Related Posts Replies Views Activity
0
Jul 22
2413
0
Jun 18
3134
1
Mar 24
1187
1
Feb 24
1863
0
Jan 24
1081