I'm trying to modify POS widget, getting the following error:
TypeError: screens.ActionpadWidget is not a function
at OdooClass.screens.ProductScreenWidget.include.start
I'm sure there is some mess with inheritance or syntax but have no idea where the key to solve it.
Below is my code:
odoo.define('my_pos.my_pos', function (require) {
"use strict";
var screens = require('point_of_sale.screens');
var models = require('point_of_sale.models');
var core = require('web.core');
var QWeb = core.qweb;
var _t = core._t;
// ######################
// Product Screen Widget
// ######################
screens.ProductScreenWidget.include({
start: function(){
var self = this;
this.actionpad = new screens.ActionpadWidget(this,{});
this.actionpad.replace(this.$('.placeholder-ActionpadWidget'));
this.numpad = new screens.NumpadWidget(this,{});
this.numpad.replace(this.$('.placeholder-NumpadWidget'));
this.order_widget = new screens.OrderWidget(this,{
numpad_state: this.numpad.state,
});
this.order_widget.replace(this.$('.placeholder-OrderWidget'));
this.product_list_widget = new screens.ProductListWidget(this,{
mouseover_product_action: function(product){ self.mouseover_product(product); },
product_list: this.pos.db.get_product_by_category(0)
});
this.product_list_widget.replace(this.$('.placeholder-ProductListWidget'));
this.product_categories_widget = new screens.ProductCategoriesWidget(this,{
product_list_widget: this.product_list_widget,
});
this.product_categories_widget.replace(this.$('.placeholder-ProductCategoriesWidget'));
this.action_buttons = {};
var classes = action_button_classes;
for (var i = 0; i < classes.length; i++) {
var classe = classes[i];
if ( !classe.condition || classe.condition.call(this) ) {
var widget = new classe.widget(this,{});
widget.appendTo(this.$('.control-buttons'));
this.action_buttons[classe.name] = widget;
}
}
if (_.size(this.action_buttons)) {
this.$('.control-buttons').removeClass('oe_hidden');
}
},
// What happens when Mouse over Product (just for test)
mouseover_product: function(product) {
this.gui.show_popup('error', {
'title': _t('Mouse over!'),
'body': _t('Watch your mouse man!')
});
},
});
});