Skip to Content
Menu
This question has been flagged
4 Replies
11792 Views

<template id="template" xml:space="preserve">

    <t t-name="CreatSaleOrder">

        <div class="row">

            <button id="sale_order_button" >

                <i class="fa fa-shopping-cart pos-so-cart"/>

                <p>Create Sale Order</p>

            </button>

        </div>

    </t>

</template>

--- here is my js code ----


screens.NumpadWidget.include({

    changedMode: function() {

    var self = this;

               if (self.pos.config.so_option) {

                    $('#sale_order_button').('show');

                } else {

                     $('#sale_order_button').('hide');

                 }

    self._super();

},

});

Avatar
Discard

Where do you need to add that button in "actionpad" or "numpad"? so inherit appropriate template and add button then you could try in JavaScript.

Best Answer

Update

You could try like this,

<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
    <t t-name="CreateSaleOrder">
        <div class='control-button sale_order_button'>
            <i class='fa fa-shopping-cart pos-so-cart' /> Create Sale Order
        </div>
    </t>
</templates>
var CreateSaleOrder = screens.ActionButtonWidget.extend({
template: 'CreateSaleOrder',
    //your codes here
});
screens.define_action_button({
'name': 'createsaleorder',
'widget': CreateSaleOrder,
'condition': function(){
return this.pos.config.so_option;
},
});

or this post will help you https://stackoverflow.com/questions/41997252/odoo-10-add-button-to-pos

Avatar
Discard
Author

Thanks for help..!!

Best Answer

Hi, veerali shah

here we are using jquery to hide() and show() the button

if you using id please use '#' infront of name and if you use class name please use '.'

if (self.pos.config.so_option) {

                    $('#sale_order_button').show();

                } else {

                     $('#sale_order_button').hide();

                 }

Avatar
Discard
Related Posts Replies Views Activity
0
Sep 20
38
1
Nov 24
110
4
Oct 24
1444
4
Mar 24
1110
2
Jun 23
1936