I want to load new model "pos.order" into models.js file , the intention is to use others fields from "pos.order" table witch are not declared inside the models.js. I tryed to follow the answer from this link (https://www.odoo.com/es_ES/forum/ayuda-1/question/load-custom-models-fields-in-pos-100689), but still don´t know how to get the order printed in the pos receipt.
models_extend.JS file:
odoo.define('pos_info_recibo.models_extend', function(require)
{
var PosBaseWidget = require('point_of_sale.BaseWidget');
var chrome = require('point_of_sale.chrome');
var gui = require('point_of_sale.gui');
var Model = require('web.DataModel');
var screens = require('point_of_sale.screens');
var core = require('web.core');
var pos_model = require('point_of_sale.models');
alert(core._t('carreguei os campos'));
pos_model.load_fields("res.partner","x_contribuinte");
pos_model.load_fields("res.company","street");
pos_model.load_fields("res.company","street2");
alert(core._t('carreguei o novo modelo'));
pos_model.load_models({
model: 'pos.order',
fields: [],
domain: function(self){ return [['state','=','paid']]; },
loaded: function(self,orders){
if ( orders.length > 0 ){
self.order = orders[0];
}
},
});
});
Some code of my XML file:
NIF: <t t-esc="widget.pos.company.company_registry || ''"/><br/>
Morada: <t t-esc="widget.pos.company.street + widget.pos.company.street2 || 'n/a'"/><br/>
<div style="font-weight: bold; font-size: 15px;"><t t-esc="'Ref. da ordem: '"/>
<span t-esc="order.uid || ''"/><br/>
<!--span t-esc="widget.pos.pickings[0].origin || ''"/-->
NUM. INTERNO:<span t-esc="widget.pos.order.name || ''"/><br/>ID. ORDER:<span t-esc="widget.pos.order.id || ''"/>
<br/>NUM. SEQUENCIA:<span t-esc="order.sequence_number || ''"/>
</div>