I am currently working on a custom module for Odoo 17 and facing an issue with JavaScript customization in the Point of Sale (POS) module. I am trying to override the add_product method in the POS, but my changes don't seem to take effect. I've ensured that my JavaScript file is included in the point_of_sale.assets bundle, but I'm not seeing the expected behavior or any console logs that I've added for debugging.
I included the JavaScript file in the point_of_sale.assets bundle in my module's __manifest__.py. Here's a snippet of the code for reference:
odoo.define('give_and_get_order_module.CustomOrder', function(require) {
'use strict';
var models = require('point_of_sale.models');
var OrderSuper = models.Order.prototype;
models.Order.include({
add_product: function(product, options) {
console.log("Custom add_product method called");
if (!options || !options.quantity) {
options = options || {};
options.quantity = -1;
}
return OrderSuper.add_product.apply(this, [product, options]);
},
});
});
And the relevant part of my __manifest__.py:
'assets': {
'point_of_sale.assets': [
'give_and_get_order_module/static/src/js/custom_order.js',
],
},
I would appreciate any insights or suggestions on what I might be missing or doing wrong. Is there a specific aspect of POS module customization in Odoo 17 that I need to be aware of?
Thank you in advance for your help!