Odoo PoS未在收据中显示自定义字段

问题描述 投票:0回答:1

我已经在'res.company'模型中添加了一个字段,我正尝试将它们添加到收据中,但是它们没有显示。我在下一个python文件中添加了字段:

# -*- coding: utf-8 -*-

from odoo import models, fields, api, exceptions


class MyModuleCompany(models.Model):
    _inherit = 'res.company'

    branch_code = fields.Integer(string='Branch code')

然后用下面的代码在POS公司模型中添加了字段:

odoo.define('my_module.company', function (require) {
    "use strict";

    var models = require('point_of_sale.models');

    models.load_fields('res.company', [
        'branch_code'
    ]);

});

最后,我尝试使它们显示在带有下一个xml代码的收据中:

<?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>

出现“名称”字段,但由于某种原因,“分支”字段没有出现,我找不到原因。

odoo customization pos odoo-13
1个回答
0
投票

它已经在l10n_fr_pos_cert模块中继承了。

我可以看到XML文件标题中的区别。他们使用:

<templates id="template" xml:space="preserve">
© www.soinside.com 2019 - 2024. All rights reserved.