콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
1880 화면

Hi, i need to overwrite async apply_discount(pc) on pos_discount module. Can you guys help me how to properly overwrite this ?


Update: i have been following the answer given and when browser loading the page, i found that there are some error:

warning: Some modules could not be started

Missing dependencies: Array [ "point_of_sale.DiscountButton" ]

Non loaded modules: Array [ "custom_module.DiscountButton" ]

Is there any missing code that i need to apply ?


Thanks.

아바타
취소
베스트 답변

Hi,

To overwrite the 'apply_discount' function in the pos_discount module in Odoo 15, you can follow the code below:

odoo.define('Custom.DiscountButton', function (require) {

'use strict';

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

const DiscountButton = require('pos_discount.DiscountButton');


const CustomDiscountButton = DiscountButton =>

class extends DiscountButton {

async apply_discount(pc) {

// Add your custom code here

}

}

Registries.Component.extend(DiscountButton, CustomDiscountButton);

return DiscountButton;

});


Ensure to add the js file to the manifest under assets:

'assets': {

'point_of_sale.assets': ["path"]

}

Replace "path" with the actual path to your js file


Hope it helps

아바타
취소
관련 게시물 답글 화면 활동
0
11월 24
1245
0
3월 15
4855
0
7월 25
284
0
6월 25
497
1
6월 25
716