跳至内容
菜单
此问题已终结
1 回复
4215 查看

I create odoo module to print quantity from point of sale, and my module work fine with  developer mode (with assets), but does not when I deactivate the developer mode (with assets)


my script file inside path /pos_quantity/static/src/js/script.js


    odoo.define('pos_quantity', function (require) {
    "use strict";
    
    var core = require('web.core');
    var PosScreens = require('point_of_sale.screens');
    
    var _t = core._t;
    
    PosScreens.OrderWidget.include({
        set_value: function(val) {
            var order = this.pos.get_order();
            if (order.get_selected_orderline()) {
                var mode = this.numpad_state.get('mode');
                if( mode === 'quantity'){
                    order.get_selected_orderline().set_quantity(val);
                    console.log('Hello');
                    console.log('quantity');
                }
                if (this.pos.config.iface_customer_facing_display) {
                    this.pos.send_current_order_to_customer_facing_display();
                }
            }
        }
    });
    
    });


my template file


    <?xml version="1.0" encoding="utf-8"?>
    <odoo>
        <template id="assets_backend" name="POS UI Backend Assets Inherit" inherit_id="web.assets_backend">
            <xpath expr="//script[last()]" position="after">
                <script type="text/javascript" src="/pos_quantity/static/src/js/script.js">
                </script>
             </xpath>
        </template>
    </odoo>


形象
丢弃
最佳答案

strange! if it works with debug assets mode it should work without it.
is there any traceback in the browser console?

can you try with add script to point_of_sale.asset instead of web.assets_backend

<template id="pos_quantity_assets" inherit_id="point_of_sale.assets">
      <xpath expr="." position="inside">
           <script type="text/javascript" src="/pos_quantity/static/src/js/script.js">
           </script>
     </xpath>
</template>
形象
丢弃
相关帖文 回复 查看 活动
0
11月 23
1809
1
5月 25
4106
1
11月 22
1759
1
11月 22
1938
0
12月 20
58