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

How to allow a user to add new products from inside the POS?

By
Yenthe
on 11/18/14, 9:15 AM 1,410 views

Hey everybody

i've started customizing the Point of Sale module from Odoo because I want some extra options.
So far I've managed to add a new button inside my view, which triggers a function on click in JavaScript.
I'm now wondering how I can make it so that if the user clicks on my button he can directly see a view that shows him the option to create a new product.
My POS view now looks like this:


pos.xml code:

                <div class="placeholder-PaypadWidgetNewProduct"></div>
                                <div class='subwindow-container-fix pads'>
                                    <div class="control-buttons oe_hidden"></div>
                                    <div class="placeholder-PaypadWidget"></div>
                                    <div class="placeholder-NumpadWidget"></div>
                                </div>
                            </div>
                        </div>


    <t t-name="PaypadWidgetNewProduct">
        <div class="paypad touch-scrollable">
        </div>
    </t>

My widgets.js code:

     module.PaypadWidgetNewProduct = module.PosBaseWidget.extend({
        template: 'PaypadWidgetNewProduct',
        renderElement: function() {
            var self = this;
            this._super();

            _.each(this.pos.cashregisters,function(cashregister) {
                var button = new module.PaypadButtonWidgetNewProduct(self,{
                    pos: self.pos,
                    pos_widget : self.pos_widget,
                    cashregister: cashregister,
                });
                button.appendTo(self.$el);
            });
        }
    });

    module.PaypadButtonWidgetNewProduct = module.PosBaseWidget.extend({
        template: 'PaypadButtonWidgetNewProduct',
        init: function(parent, options){
            this._super(parent, options);
            this.cashregister = options.cashregister;
        },
        renderElement: function() {
            var self = this;
            this._super();

            this.$el.click(function(){
        alert('Extra functionality to add new product should come here?');
            });
        },
    });

Can anybody explain me how I can add code to this to be able to create a new product inside the POS module? Ideally I would love to show the same view as when you create a new product from sales > products > create. Any tips are welcome as I don't even know how to write / get data from the database here..

With kind regards
Yenthe
 

I'm still really looking for any guidance or help about this. Anybody?

Yenthe
on 11/25/14, 4:26 AM

We  have module provide the ability to create a product directly from inside the POS screen, thus you can sell it right away. *  Click Here [1]  *for more details [1] https://www.youtube.com/watch?v=LPcp3dTz6fo

Smart Way LLC
on 11/25/14, 7:04 AM
0
Mario Arias Badila
On 12/25/14, 10:07 PM

You should check the way a new customer is created... Then just adjust your model and fields...

Regards

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

4 follower(s)

Stats

Asked: 11/18/14, 9:15 AM
Seen: 1410 times
Last updated: 3/16/15, 8:10 AM