I´ve added a field in the 'res.company' model and i´m trying to add them to the receipt, but they are not showing up. I´ve added the fields with the next python file:
# -*- coding: utf-8 -*-
from odoo import models, fields, api, exceptions
class MyModuleCompany(models.Model):
_inherit = 'res.company'
branch_code = fields.Integer(string='Branch code')
Then added the fields in the POS company model with the next code:
odoo.define('my_module.company', function (require) {
"use strict";
var models = require('point_of_sale.models');
models.load_fields('res.company', [
'branch_code'
]);
});
Finally, I tried to make them appear in the receipt with the next xml code:
<?xml version="1.0" encoding="UTF-8"?>
<template xml:space="preserve">
<t t-extend="OrderReceipt">
<t t-jquery=".pos-receipt-contact" t-operation="replace">
<div class="pos-receipt-contact">
<t t-if='receipt.company.name'>
<div><t t-esc='receipt.company.name' /></div>
</t>
<t t-if='receipt.company.branch_code'>
<div>Branch:<t t-esc='receipt.company.branch_code' /></div>
</t>
</div>
</t>
</t>
</template>
The field "name" appears but for some reason the "branch" field does not and I can´t find out why.