Skip to Content
Menu
This question has been flagged
1 Reply
5023 Views

I want to add my custom field in pos print receipt in odoo 11 and this is my js code:


var module = require('point_of_sale.models'); var models = module.PosModel.prototype.models; for(var i=0; i<models.length; i++){ var model=models[i]; if(model.model === 'res.partner'){ model.fields.push('custom_field1'); } }
and XML Code:
<?xml version="1.0" encoding="utf-8"?> <templates id="point_of_sale.template" xml:space="preserve"> <t t-name="PosTicket" t-extend="PosTicket"> <t t-jquery=".receipt-user" t-operation="after"> <t t-if="order.get_client().name"> <t t-esc="order.get_client().name"/> </t> <t t-if="order.get_client().custom_field"> <t t-esc="order.get_client().custom_field"/> </t> </t> </t> </templates>
The value gets printed in debug mode and not in normal mode.
Avatar
Discard
Best Answer

Hello Anand,
We can do simply like this for js code.,

var pos_model = require('point_of_sale.models');
pos_model.load_fields("res.partner", "someCustomField");

Regards,
Parth

Avatar
Discard