警告错误使用@class

时间:2017-11-03 09:19:12

标签: openerp odoo-8 odoo-9 odoo-10

> WARNING 11_test1 odoo.addons.base.ir.ir_ui_view: Error-prone use of
> @class in view report_invoice_document
> (account_invoice_report.report_invoice_document): use the
> hasclass(*classes) function to filter elements by their classes

有人可以解释我为什么会收到这个警告。仅在2个地方使用班级。

<td class="text-right">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), l.invoice_line_tax_ids))"/>
  </td>

<xpath expr="//div[@class='row mt32 mb32']/div[@t-if='o.name']" position="replace"/>

1 个答案:

答案 0 :(得分:4)

You can use hasclass() now. Example-

  1. In case of one class in the inherited path:

xpath expr="//div[hasclass('dropdown')]" position="replace">

  1. In case of multiple class in inherited path:

xpath expr="//div[hasclass('dropdown','btn-group','dropdown_sorty_by')]" position="replace">

In your case it should be:

<xpath expr="//div[hasclass('row','mt32','mb32')]/div[@t-if='o.name']" position="replace"/>