Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
4145 Näkymät

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
Hylkää
Paras vastaus

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
marrask. 23
1766
1
toukok. 25
4007
1
marrask. 22
1693
1
marrask. 22
1881
0
jouluk. 20
58