Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
5754 Zobrazení

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!')
                    });
            },
        });
});


Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
6
úno 18
15970
1
lis 24
1789
4
říj 24
4413
0
říj 22
5479
0
zář 22
38