Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

POS module Widget inheritance java script issue

By
Sam
on 10/28/15, 5:01 PM 648 views

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


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/28/15, 5:01 PM
Seen: 648 times
Last updated: 10/28/15, 5:01 PM