跳至內容
選單
此問題已被標幟
4 回覆
13061 瀏覽次數

<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();

},

});

頭像
捨棄

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.

最佳答案

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

頭像
捨棄
作者

Thanks for help..!!

最佳答案

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();

                 }

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
9月 20
38
1
11月 24
1474
4
10月 24
3782
4
3月 24
2930
2
6月 23
3255