Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
4303 Visninger

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
Kassér
Bedste svar

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
Kassér
Related Posts Besvarelser Visninger Aktivitet
0
nov. 23
1892
1
maj 25
4240
1
nov. 22
1855
1
nov. 22
2044
0
dec. 20
58