Openerp 警告使用@class时容易出错

Openerp 警告使用@class时容易出错,openerp,odoo-8,odoo-9,odoo-10,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 filt

有人能解释一下为什么我会收到这个警告吗。仅在两个位置使用类

> 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


现在可以使用hasclass()。示例-

  • 如果继承路径中有一个类:
  • xpath expr=“//div[hasclass('dropdown')]”position=“replace”>

  • 如果继承路径中有多个类:
  • xpath expr=“//div[hasclass('dropdown'、'btn-group'、'dropdown\u sorty\u by')”position=“replace”>

    在您的情况下,它应该是:

    <xpath expr="//div[@class='row mt32 mb32']/div[@t-if='o.name']" position="replace"/>
    
    
    
    尝试使用位置属性,类似这样的
    虽然它在Odoo中工作,但它似乎不是标准的XPath功能。
    <xpath expr="//div[@class='row mt32 mb32']/div[@t-if='o.name']" position="replace"/>
    
    <xpath expr="//div[hasclass('row','mt32','mb32')]/div[@t-if='o.name']" position="replace"/>