Reputation: 611
I want to show product default code in pos receipt. Can I inherit or edit in models.js or from other ? Thanks.
export_for_printing: function(){
return {
...
default_code: this.get_default_code(),
};
},
get_default_code: function(){
return this.product.default_code;
},
Upvotes: 2
Views: 825
Reputation: 2444
Revise the Solution:
To get the product's other field access you need to do customization in the JS
& XML
template.
JS Code:
odoo.define('ypour_app.your app', function (require) {
"use strict";
var models = require('point_of_sale.models');
var OrderlineSuper = models.Orderline;
models.Orderline = models.Orderline.extend({
export_for_printing : function() {
var data = OrderlineSuper.prototype.export_for_printing.call(this);
// this.get_product() => you can have here all the product data [barcode/default_code/ etc.]
data.product_default_code = this.get_product().default_code;
return data;
}
});
});
XML Code:
<t t-extend="OrderReceipt">
<t t-jquery="t[t-foreach*='receipt.orderlines']" t-operation="append">
<b>Default Code </b>: <t t-esc="line.product_default_code"/>
</t>
</t>
Upvotes: 3