Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
4144 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
nov 23
1761
1
may 25
3998
1
nov 22
1685
1
nov 22
1877
0
dic 20
58