跳至內容
選單
此問題已被標幟
2 回覆
2344 瀏覽次數

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,

頭像
捨棄
最佳答案

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

頭像
捨棄
最佳答案

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
頭像
捨棄

Jainesh,Thanks bro

相關帖文 回覆 瀏覽次數 活動
0
8月 25
839
0
7月 22
3311
0
6月 18
3928
1
3月 24
2139
1
2月 24
3160