Skip to Content
Menu
This question has been flagged
1 Reply
3399 Views

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>


Avatar
Discard
Best Answer

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>
Avatar
Discard
Related Posts Replies Views Activity
0
Nov 23
831
1
Jul 23
2456
1
Nov 22
931
1
Nov 22
1186
0
Dec 20
58