Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

183
Vistas
Odoo Javascript, how can I access to the value of this object?

So I'm workin in POS module in Odoo 14, I've created a field in 'pos.order' called 'ticket_number' which is related to the id of the record. So if the id is 15, the ticket_number will be 15 too. This field is already charged to the 'pos.order' model:

odoo.define("custom_pos_order.models", function (require) {
"use strict";

    var models = require('point_of_sale.models');

    models.load_fields('pos.order', 'id');
    models.load_fields('pos.order', 'ticket_number');

});

My purpose is to show this new field in the voucher when you get to the last screen: POS Last screen

As you can see, in the red box I would like to show this field.

But, as this field is not native, I have to workaround with some Javascript. I have this object in the console, and this object contains the value of the id of the order: JS Object

So my question is, how can I access to that value in JS code, to assign it to a new variable?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Please use the below line to load fields in a single line instead writing two and more lines for each fields

models.load_fields("pos.order",['id','ticket_number']);

Also mention the field in the below function to get it in the receipt screen

get_receipt_render_env: function() {
    var order = this.pos.get_order();
    return {
        widget: this,
        pos: this.pos,
        order: order,
        receipt: order.export_for_printing(),
        orderlines: order.get_orderlines(),
        paymentlines: order.get_paymentlines(),
    };
},
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda