Géry Ogam
Géry Ogam

Reputation: 8027

Company fields do not work in the body of an X.M.L. report

When customizing a sale order X.M.L. report in Odoo 8, adding company fields inside the body does not work. For instance:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>
    <template id="my_report_body" inherit_id="sale.report_saleorder_document">
      <xpath expr="//div[@class='page']/div[3]" position="replace">
        <p t-if="o.date_order" class="text-right">
          À <span t-field="company.city"/>, le <span t-field="o.date_order"/>
        </p>
      </xpath>
    </template>
  </date>
</openerp>

raises the following exception:

QWebException: "'NoneType' object has no attribute '_fields'" while evaluating

However it works in the header or footer. How can I make it work in the body too?

Upvotes: 2

Views: 84

Answers (1)

Bhavesh Odedra
Bhavesh Odedra

Reputation: 11143

You have used not register/declare field company.

Instead of company use company_id field.

Try with following code.

Replace

<span t-field="company.city"/>

with

<span t-field="o.company_id.city"/>

Upvotes: 3

Related Questions