Skip to Content
Menu
This question has been flagged

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.

Avatar
Discard
Related Posts Replies Views Activity
1
Oct 22
4638
2
Jul 22
18350
0
Mar 19
2499
1
Nov 24
110
4
Oct 24
1445