Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2168 Lượt xem

HI guys, I hope you are doing well



I'm new in odoo, Any suggestions related how to customize RewardButton?


Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Hi, I have been trying with this:
/** @odoo-module **/

odoo.define('point_of_sale.RewardButton', function (require) {

'use strict';

const RewardButton = require('point_of_sale.RewardButton');

const Registries = require('point_of_sale.Registries');

const ProductScreen = require('point_of_sale.ProductScreen');

const RewardButtonUp = RewardButton => class extends RewardButton {

setup() {

console.log("ENTER INTO SETUP");

super.setup();

useListener('click', this.onMiClick);

}

async onMiClick() {

console.log("My custom click");

}

};

Registries.Component.extend(RewardButton, RewardButtonUp);

return RewardButtonUp;

});

But nothing happend

Câu trả lời hay nhất

Hi,

The template for Rewards is in addons/pos_loyalty/static/src/xml/ControlButtons/RewardButton.xml
You can either customise that, or inherit that in your custom module and customise.
To do that after creating a custom module, add your xml and inside that,

<t t-name="RewardButton" t-inherit="pos_loyality.RewardButton" t-inherit-mode="extension" owl="1">
<xpath expr="//span[hasclass('control-button')]" position="replace">

//Your customised code here.
</xpath>
</t>



Hope it helps

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you for the answer,

With this, how I can customize the RewardButton.js functions, for example:

async _applyReward()

right?

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 23
2508
1
thg 2 25
2442
1
thg 3 24
2513
2
thg 6 24
3555
1
thg 2 24
2117