Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
5225 Vistas

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
 

Avatar
Descartar
Autor

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

Autor

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

Mejor respuesta

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

Regards

Avatar
Descartar