Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WARNING Error-prone use of @class

> 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

Can someone explain me why i'm getting this warning. using class only in 2 places.

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

and

<xpath expr="//div[@class='row mt32 mb32']/div[@t-if='o.name']" position="replace"/>
like image 216
Chaban33 Avatar asked Nov 03 '17 09:11

Chaban33


1 Answers

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"/>
like image 115
Tanzil Khan Avatar answered Oct 14 '22 01:10

Tanzil Khan