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

Hi everyone, I have a issue with some TicketScreen override method.

I override _getSearchFields to add another search field for orders (Orders button on the POS) like this:


odoo.define('MY_CUSTOME_MODULE.TicketScreen', function (require) {
'use strict';

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

const CustomTicketScreen = (TicketScreen) =>
class extends TicketScreen {
_getSearchFields() {
const fields = super._getSearchFields(...arguments);
fields.CUSTOMER_ID = {
repr: (order) => order.get_client_id(),
displayName: this.env._t('Customer ID'),
modelField: 'partner_id.id',
}
return fields;
}
};

Registries.Component.extend(TicketScreen, CustomTicketScreen);

return TicketScreen;
});

This works well because when I want to search for an order, I can choose the new field I added.

Now when I try to see all the order search fields from the payment screen, I only have access to the basic fields added by Odoo, the new field I added is not appearing. The override of the method I did earlier is not invoked here :


odoo.define('MY_CUSTOME_MODULE.PaymentScreen', function (require) {
'use strict';

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

const CustomPaymentMethod = (PaymentScreen) =>
class extends PaymentScreen {
constructor() {
super(...arguments);
var super_ticket_screen_model = new TicketScreen();
     console.log("All search fields :", super_ticket_screen_model._getSearchFields()); // Here, I don't see new seach field i add
}
};

Registries.Component.extend(PaymentScreen, CustomPaymentMethod);

return PaymentScreen;
});

Did I miss something or did I do something wrong?


Thanks in advance.

아바타
취소
관련 게시물 답글 화면 활동
1
10월 22
5292
2
7월 22
19420
0
3월 19
2983
3
4월 25
473
1
1월 25
1466