如何在 qweb 报告中自定义合作伙伴 t-field-options

How to customize partner t-field-options in qweb reports

我正在使用 odoo 9,我想在报告中添加两个自定义字段 RCCode_TVA合作伙伴信息。我在 t-field-options 中添加了 Rc 和 Code_TVA 但没有区别。有什么帮助吗??

partner_view.xml

<?xml version="1.0" encoding="utf-8"?>
 <openerp>
 <data>
  <record id="res_partner_view_purchase_buttons_TVA_RC" model="ir.ui.view">
    <field name="name">num.TVA.RC.res.partner.view.purchase.</field>
    <field name="model">res.partner</field>
    <field name="inherit_id" ref="base.view_partner_form"/>
    <field name="arch" type="xml">
        <xpath expr="//field[@name='website']" position="after">
                    <field name="Code_TVA" select="1" placeholder="Code TVA"/>
                    <field name="RC" select="1" placeholder="Num RC"/>
        </xpath>
    </field>
  </record>
</data>
</openerp>

Partner.py

 # -*- coding: utf-8 -*-
 from openerp import fields,models,api
 from openerp import tools

 import openerp.addons.decimal_precision as dp
 from openerp.tools.translate import _


 class partner(models.Model):
 _inherit = 'res.partner'
 Code_TVA = fields.Char(string="Code de TVA")
 RC = fields.Char(string="Num Registre de Commerce") 

purchase_report.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
   <template id="report_purchasequotation_document" inherit_id="purchase.report_purchasequotation_document">
     <xpath expr="//div[@class='col-xs-5 col-xs-offset-1']" position="replace">
     <div class="col-xs-5 col-xs-offset-1">
            <div t-field="o.partner_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;, &quot;phone&quot;, &quot;fax&quot;, &quot;Code_TVA&quot;, &quot;RC&quot;], &quot;no_marker&quot;: true, &quot;phone_icons&quot;: true}"/>
                <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>

        </div>

     </xpath>

</template>

我找到了答案

<div class="col-xs-5 col-xs-offset-1">
<div t-field="o.partner_id"
    t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true, "phone_icons": true}'/>
    <p t-if="o.partner_id.Code_TVA">Code_TVA: <span t-field="o.partner_id.Code_TVA"/></p>
    <p t-if="o.partner_id.RC">RC: <span t-field="o.partner_id.RC"/></p>
    <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>

</div>