This question has been flagged

Every time I make an invoice I generate a custom sequence code in account.invoice. I can see it in the POS orders, and it's being generated properly, but I can't make it display the code inside the POS or the Receipt screen. I read you could insert it extending models.js and then calling it from the .xml but I can't make it work. After many many tries this is what I got:


My models.js is the following:


odoo.define('pos.models', function(require) {
  "use strict";
  var models = require('pos.order');
  models.load_models({
    model:  'pos.order',
    fields: ['my_field'],
    domain: function(self){ return [['state','=','opened']; },
    loaded: function(self,pos_my_field){
      self.pos_my_field = pos_my_field[0];
    },
  });
});

and in the XML I've tried calling it with:
<t t-esc="widget.pos.my_field" />
<t t-esc="widget.my_field" />
<t t-esc="my_field" />
and plenty of other variations but you get the point.
Avatar
Discard