Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!