[IMP] use hasclass() xpath function

This commit is contained in:
Xavier Morel
2017-08-11 10:44:40 +02:00
parent 8cbc516f8b
commit cbffd99341
45 changed files with 94 additions and 87 deletions
@@ -1,6 +1,6 @@
<odoo>
<template id="portal_my_home_menu_invoice" name="Portal layout : invoice menu entries" inherit_id="portal.portal_layout" priority="30">
<xpath expr="//ol[contains(@class,'o_portal_submenu')]" position="inside">
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
<li t-if="page_name == 'invoice'" class="active">
Invoices
</li>
@@ -8,7 +8,7 @@
</template>
<template id="portal_my_home_invoice" name="Portal My Home : invoice entries" inherit_id="portal.portal_my_home" priority="30">
<xpath expr="//ul[contains(@class,'o_portal_docs')]" position="inside">
<xpath expr="//ul[hasclass('o_portal_docs')]" position="inside">
<li t-if="invoice_count" class="list-group-item">
<span class="badge" t-esc="invoice_count"/>
<a href="/my/invoices">Invoices</a>
@@ -63,4 +63,4 @@
</div>
</t>
</template>
</odoo>
</odoo>
@@ -5,7 +5,7 @@
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.account_journal_dashboard_kanban_view" />
<field name="arch" type="xml">
<xpath expr="//t[@t-name='JournalBodyBankCash']//div[contains(@class, 'o_kanban_primary_right')]" position="inside">
<xpath expr="//t[@t-name='JournalBodyBankCash']//div[hasclass('o_kanban_primary_right')]" position="inside">
<div t-if="journal_type == 'bank' and dashboard.num_checks_to_print != 0">
<div class="row">
<div class="col-xs-12">
@@ -1,6 +1,6 @@
<odoo>
<template id="portal_my_invoices_payment" name="Payment on My Invoices" inherit_id="account.portal_my_invoices">
<xpath expr="//table[contains(@class, 'o_my_status_table')]/thead/tr/th[last()]" position="before">
<xpath expr="//table[hasclass('o_my_status_table')]/thead/tr/th[last()]" position="before">
<th></th>
</xpath>
<xpath expr="//t[@t-foreach='invoices']/tr/td[last()]" position="before">
@@ -11,4 +11,4 @@
</td>
</xpath>
</template>
</odoo>
</odoo>
@@ -5,7 +5,7 @@
<field name="model">res.country</field>
<field name="inherit_id" ref="base.view_country_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@class='oe_button_box']" position="inside">
<xpath expr="//div[hasclass('oe_button_box')]" position="inside">
<button name="%(action_res_city_tree)d"
class="oe_stat_button"
icon="fa-globe"
@@ -6,7 +6,7 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
<field name="arch" type="xml">
<xpath expr="//div[contains(@class, 'oe_kanban_partner_categories')]" position="inside">
<xpath expr="//div[hasclass('oe_kanban_partner_categories')]" position="inside">
<span class="oe_kanban_list_many2many">
<field name="category_id" widget="many2many_tags" options="{'color_field': 'color'}"/>
</span>
+4 -4
View File
@@ -184,7 +184,7 @@
<field name="use_opportunities"/>
</xpath>
<xpath expr="//div[contains(@class, 'o_primary')]" position="after">
<xpath expr="//div[hasclass('o_primary')]" position="after">
<div t-if="record.use_leads.raw_value and record.alias_name.value and record.alias_domain.value">
<small><i class="fa fa-envelope-o"></i>&amp;nbsp; <field name="alias_id"/></small>
</div>
@@ -212,7 +212,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_view')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_view')]" position="inside">
<div t-if="record.use_leads.raw_value" groups="crm.group_use_lead">
<a name="%(crm_case_form_view_salesteams_lead)d" type="action">
Leads
@@ -225,7 +225,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_new')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_new')]" position="inside">
<div t-if="record.use_opportunities.raw_value">
<a name="%(action_opportunity_form)d" type="action">
Opportunity
@@ -233,7 +233,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_reports')]" position="inside">
<div t-if="record.use_leads.raw_value" groups="crm.group_use_lead">
<a name="%(action_report_crm_lead_salesteam)d" type="action">
Leads
+1 -1
View File
@@ -69,7 +69,7 @@
<field name="opportunity_count"/>
<field name="meeting_count"/>
</field>
<xpath expr="//div[@class='oe_kanban_partner_links']" position="inside">
<xpath expr="//div[hasclass('oe_kanban_partner_links')]" position="inside">
<span class="badge" t-if="record.opportunity_count.value>0"><i class="fa fa-fw fa-star"/><t t-esc="record.opportunity_count.value"/></span>
<span class="badge" t-if="record.meeting_count.value>0"><i class="fa fa-fw fa-calendar"/><t t-esc="record.meeting_count.value"/></span>
</xpath>
@@ -9,7 +9,7 @@
<field name="arch" type="xml">
<data>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_reports')]" position="inside">
<div class="row">
<div class="col-xs-12 text-left">
<a name="%(hr_attendance_action_graph_filtered)d" type="action">
@@ -22,4 +22,4 @@
</data>
</field>
</record>
</odoo>
</odoo>
+3 -3
View File
@@ -11,7 +11,7 @@
<field name="expense_sheets_to_approve_count"/>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_primary_right')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_primary_right')]" position="inside">
<div t-if="record.expense_sheets_to_approve_count.raw_value > 0" class="row">
<div class="col-xs-9">
<a name="%(action_hr_expense_sheet_department_to_approve)d" type="action">
@@ -24,7 +24,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_to_approve')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_to_approve')]" position="inside">
<div class="row">
<div class="col-xs-12 text-left">
<a name="%(action_hr_expense_sheet_department_to_approve)d" type="action">
@@ -34,7 +34,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_reports')]" position="inside">
<div class="row">
<div class="col-xs-12 text-left">
<a name="%(action_hr_expense_sheet_department_filtered)d" type="action">
+5 -5
View File
@@ -15,7 +15,7 @@
<field name="absence_of_today"/>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_primary_right')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_primary_right')]" position="inside">
<div t-if="record.leave_to_approve_count.raw_value > 0" class="row">
<div class="col-xs-9">
<a name="%(hr_holidays_action_request_from_department)d" type="action">
@@ -38,7 +38,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_primary_right')]" position="after">
<xpath expr="//div[hasclass('o_kanban_primary_right')]" position="after">
<div class="col-xs-12 o_kanban_primary_bottom">
<div class="row">
<div class="col-xs-3">
@@ -51,7 +51,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_to_approve')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_to_approve')]" position="inside">
<div class="row">
<div class="col-xs-12 text-left">
<a name="%(hr_holidays_action_request_from_department)d" type="action">
@@ -69,7 +69,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_reports')]" position="inside">
<div class="row">
<div class="col-xs-12 text-left">
<a name="%(action_hr_holidays_leaves_analysis_filtered)d" type="action">
@@ -145,4 +145,4 @@
</field>
</record>
</odoo>
</odoo>
@@ -13,7 +13,7 @@
<field name="expected_employee"/>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_primary_right')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_primary_right')]" position="inside">
<div t-if="record.new_applicant_count.raw_value > 0" class="row">
<div class="col-xs-9">
<a name="%(hr_applicant_action_from_department)d" type="action">
@@ -26,7 +26,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_to_do')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_to_do')]" position="inside">
<div class="row">
<div class="col-xs-12 text-left">
<a name="%(hr_applicant_action_from_department)d" type="action">
@@ -36,7 +36,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_reports')]" position="inside">
<div class="row">
<div class="col-xs-12 text-left">
<a name="%(action_hr_recruitment_report_filtered_department)d" type="action">
@@ -59,4 +59,4 @@
<menuitem id="menu_hr_department" name="Departments"
parent="menu_hr_recruitment_configuration" action="action_hr_department"/>
</odoo>
</odoo>
+1 -1
View File
@@ -41,7 +41,7 @@
<field name="arch" type="xml">
<data>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_reports')]" position="inside">
<div class="row">
<div class="col-xs-12 text-left">
<a name="%(act_hr_timesheet_report)d" type="action"
+2 -2
View File
@@ -118,12 +118,12 @@
<field name="use_tasks" position="after">
<field name="allow_timesheets" invisible="1"/>
</field>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]/div[last()]" position="after">
<xpath expr="//div[hasclass('o_kanban_manage_reports')]/div[last()]" position="after">
<div attrs="{'invisible': [('allow_timesheets', '=', False)]}">
<a name="%(act_hr_timesheet_line_by_project)d" type="action">Timesheets</a>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_project_kanban_box')]/div[last()]" position="after">
<xpath expr="//div[hasclass('o_project_kanban_boxes')]/div[last()]" position="after">
<div attrs="{'invisible': [('allow_timesheets', '=', False)]}" class="o_project_kanban_box">
<a t-if="record.allow_timesheets.raw_value" name="%(act_hr_timesheet_line_by_project)d" type="action">
<span class="o_label">Timesheets</span>
@@ -54,7 +54,7 @@
</button>
</div>
</div>
<xpath expr="//page[@class='o_hr_timesheet_sheet_details']" position="after">
<xpath expr="//page[hasclass('o_hr_timesheet_sheet_details')]" position="after">
<page string="Attendances" groups="hr_attendance.group_hr_attendance">
<group>
<group groups="hr_attendance.group_hr_attendance">
@@ -84,7 +84,7 @@
<field name="groups_id" eval="[(4,ref('hr_payroll.group_hr_payroll_user'))]"/>
<field name="arch" type="xml">
<data>
<xpath expr="//div[contains(@class, 'manage_reports')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_reports')]" position="inside">
<div class="row">
<div class="col-xs-12 text-left">
<a name="%(action_payslip_report_all)d" type="action">
@@ -49,7 +49,7 @@
<!-- TDE FIXME: was customize_show=True -->
<template id="pay_meth_link" inherit_id="portal.portal_layout">
<xpath expr="//div[@class='o_portal_my_details']" position="inside">
<xpath expr="//div[hasclass('o_portal_my_details')]" position="inside">
<t t-if="request.env['payment.acquirer'].search([('website_published', '=', True), ('registration_view_template_id', '!=', False)])">
<div class='manage_payment_method mt16'><a href="/my/payment_method">Manage your payment acquirers</a></div>
</t>
@@ -30,7 +30,7 @@
<field name="state_id" position="before">
<field name="pos_order_count"/>
</field>
<xpath expr="//div[@class='oe_kanban_partner_links']" position="inside">
<xpath expr="//div[hasclass('oe_kanban_partner_links')]" position="inside">
<span t-if="record.pos_order_count.value>0" class="badge"><i class="fa fa-fw fa-shopping-bag"/><t t-esc="record.pos_order_count.value"/></span>
</xpath>
</field>
+3 -3
View File
@@ -70,15 +70,15 @@
<attribute name="attrs">{'invisible': [('team_type', '=', 'pos')]}</attribute>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_view')]" position="attributes">
<xpath expr="//div[hasclass('o_kanban_manage_view')]" position="attributes">
<attribute name="attrs">{'invisible': [('team_type', '=', 'pos')]}</attribute>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_new')]" position="attributes">
<xpath expr="//div[hasclass('o_kanban_manage_new')]" position="attributes">
<attribute name="attrs">{'invisible': [('team_type', '=', 'pos')]}</attribute>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_reports')]" position="inside">
<t t-if="record.team_type.raw_value == 'pos'">
<a name="%(point_of_sale.action_report_pos_order_all)d" type="action">
Sales
+1 -1
View File
@@ -328,7 +328,7 @@
</tree>
</field>
</field>
<xpath expr="//div[@class='oe_title']" position="inside">
<xpath expr="//div[hasclass('oe_title')]" position="inside">
<field name="attribute_value_ids" widget="many2many_tags" groups="product.group_product_variant"/>
</xpath>
</field>
@@ -17,7 +17,7 @@
</group>
</group>
</xpath>
<xpath expr="//div[@class='oe_title']" position="inside">
<xpath expr="//div[hasclass('oe_title')]" position="inside">
<field name="product_expiry_alert" invisible="1"/>
<span class="label label-danger" attrs="{'invisible': [('product_expiry_alert', '=', False)]}">Expiration Alert</span>
</xpath>
+1 -1
View File
@@ -41,7 +41,7 @@
<field name="mobile" position="after">
<field name="purchase_order_count"/>
</field>
<xpath expr="//div[@class='oe_kanban_partner_links']" position="inside">
<xpath expr="//div[hasclass('oe_kanban_partner_links')]" position="inside">
<span t-if="record.purchase_order_count.value>0" class="badge"><i class="fa fa-fw fa-shopping-cart"/><t t-esc="record.purchase_order_count.value"/></span>
</xpath>
</field>
+3 -3
View File
@@ -98,7 +98,7 @@
<field name="rating_last_value"/>
<field name="rating_ids"/>
</xpath>
<xpath expr="//div[@class='oe_kanban_bottom_left']" position="inside">
<xpath expr="//div[hasclass('oe_kanban_bottom_left')]" position="inside">
<b t-if="record.rating_ids.raw_value.length">
<span style="font-weight:bold;" class="fa fa-fw mt4 fa-smile-o text-success" t-if="record.rating_last_value.value == 10" title="Latest Rating: Satisfied"/>
<span style="font-weight:bold;" class="fa fa-fw mt4 fa-meh-o text-warning" t-if="record.rating_last_value.value == 5" title="Latest Rating: Not Satisfied"/>
@@ -148,7 +148,7 @@
<field name="percentage_satisfaction_project" invisible="1"/>
<field name="rating_status" invisible="1"/>
</field>
<xpath expr="//div[contains(@class, 'o_kanban_primary_left')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_primary_left')]" position="inside">
<div t-if="record.rating_status.raw_value != 'no'" class="mt8 text-primary" title="Percentage of happy ratings over the past 30 days. Get rating details from the More menu.">
<b>
<t t-if="record.percentage_satisfaction_project.value == -1">
@@ -162,7 +162,7 @@
</b>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_card_manage_section')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_card_manage_section')]" position="inside">
<div t-if="record.rating_status.raw_value != 'no'">
<a name="action_view_all_rating" type="object">
Customer Ratings
+1 -1
View File
@@ -29,7 +29,7 @@
<field name="mobile" position="after">
<field name="sale_order_count"/>
</field>
<xpath expr="//div[@class='oe_kanban_partner_links']" position="inside">
<xpath expr="//div[hasclass('oe_kanban_partner_links')]" position="inside">
<span t-if="record.sale_order_count.value>0" class="badge"><i class="fa fa-fw fa-usd"/><t t-esc="record.sale_order_count.value"/></span>
</xpath>
</field>
+2 -2
View File
@@ -7,7 +7,7 @@
</template>
<template id="portal_my_home_menu_sale" name="Portal layout : sales menu entries" inherit_id="portal.portal_layout" priority="20">
<xpath expr="//ol[contains(@class,'o_portal_submenu')]" position="inside">
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
<li t-if="page_name == 'quote' or sales_order and sales_order.state == 'sent'">
<a t-if="sales_order" t-attf-href="/my/quotes?{{ keep_query() }}">Quotations</a>
<t t-else="">Quotations</t>
@@ -25,7 +25,7 @@
</template>
<template id="portal_my_home_sale" name="Portal My Home : sales entries" inherit_id="portal.portal_my_home" priority="20">
<xpath expr="//ul[contains(@class,'o_portal_docs')]" position="inside">
<xpath expr="//ul[hasclass('o_portal_docs')]" position="inside">
<li t-if="quotation_count" class="list-group-item">
<span class="badge" t-esc="quotation_count"/>
<a href="/my/quotes">Quotations</a>
+3 -3
View File
@@ -95,7 +95,7 @@
</t>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_view')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_view')]" position="inside">
<div t-if="record.use_quotations.raw_value">
<a name="%(action_quotations_salesteams)d" type="action" class="o_quotation_view_button">Quotations</a>
</div>
@@ -107,7 +107,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_new')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_new')]" position="inside">
<div t-if="record.use_quotations.raw_value">
<a name="%(action_quotation_form)d" type="action">
Quotation
@@ -115,7 +115,7 @@
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_manage_reports')]" position="inside">
<xpath expr="//div[hasclass('o_kanban_manage_reports')]" position="inside">
<div t-if="record.use_quotations.raw_value">
<a name="%(action_order_report_quotation_salesteam)d" type="action">
Quotation
+5 -5
View File
@@ -150,7 +150,7 @@
<t t-call-assets="website.assets_editor" t-css="false" groups="website.group_website_publisher"/>
</t>
</xpath>
<xpath expr="//header//div[@class='navbar-header']" position="replace">
<xpath expr="//header//div[hasclass('navbar-header')]" position="replace">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-top-collapse">
<span class="sr-only">Toggle navigation</span>
@@ -161,13 +161,13 @@
<a class="navbar-brand" href="/" t-if="website" t-field="website.name">My Website</a>
</div>
</xpath>
<xpath expr="//header//ul[@id='top_menu']/li[@class='divider']" position="attributes">
<xpath expr="//header//ul[@id='top_menu']/li[hasclass('divider')]" position="attributes">
<attribute name="t-if">website.user_id != user_id</attribute>
</xpath>
<xpath expr="//header//ul[@id='top_menu']/li[@class='dropdown']" position="attributes">
<xpath expr="//header//ul[@id='top_menu']/li[hasclass('dropdown')]" position="attributes">
<attribute name="t-if">website.user_id != user_id</attribute>
</xpath>
<xpath expr="//header//ul[@id='top_menu']/li[@class='divider']" position="before">
<xpath expr="//header//ul[@id='top_menu']/li[hasclass('divider')]" position="before">
<t t-foreach="website.menu_id.child_id" t-as="submenu">
<t t-call="website.submenu"/>
</t>
@@ -200,7 +200,7 @@
</template>
<template id="layout_logo_show" inherit_id="website.layout" customize_show="True" name="Show Logo">
<xpath expr="//header//a[@class='navbar-brand']" position="replace">
<xpath expr="//header//a[hasclass('navbar-brand')]" position="replace">
<a href="/" class="navbar-brand logo">
<span t-field="res_company.logo" t-options="{'widget': 'image'}" t-att-alt="'Logo of %s' % res_company.name" t-att-title="res_company.name" />
</a>
@@ -300,7 +300,7 @@
<!-- Options: Blog Post: user can reply -->
<template id="opt_blog_post_complete_comment" name="Allow blog post comment" inherit_id="website_blog.blog_post_complete" active="False" customize_show="True">
<xpath expr="//div[@class='o_blog_post_complete o_sharing_links']" position="after">
<xpath expr="//div[hasclass('o_blog_post_complete','o_sharing_links')]" position="after">
<section id="comments" class="read_width">
<t t-call="website_mail.message_thread">
<t t-set="object" t-value="blog_post"/>
@@ -312,7 +312,7 @@
<!-- Options: Blog Post : Read Next Article -->
<template id="opt_blog_post_complete_read_next" name="Read next article"
inherit_id="website_blog.blog_post_complete" active="True" customize_show="True">
<xpath expr="//div[@id='comments']|//div[@class='o_blog_post_complete o_sharing_links']" position="after">
<xpath expr="//div[@id='comments']|//div[hasclass('o_blog_post_complete','o_sharing_links')]" position="after">
<t t-if="next_post">
<t t-call="website_blog.blog_cover">
<t t-set="cover_properties" t-value="next_post_cover_properties"/>
@@ -359,7 +359,7 @@
<xpath expr="//div[@id='blog_content']" position="attributes">
<attribute name="class" add="js_tweet" separator=" "/>
</xpath>
<xpath expr="//div[@id='title']//div[contains(@class, 'blog_title')]" position="attributes">
<xpath expr="//div[@id='title']//div[hasclass('blog_title')]" position="attributes">
<attribute name="class" add="js_tweet" separator=" "/>
</xpath>
</template>
@@ -369,7 +369,7 @@
<xpath expr="//div[@id='blog_content']" position="attributes">
<attribute name="class" add="js_comment" separator=" "/>
</xpath>
<xpath expr="//div[@id='title']//div[contains(@class, 'blog_title')]" position="attributes">
<xpath expr="//div[@id='title']//div[hasclass('blog_title')]" position="attributes">
<attribute name="class" add="js_comment" separator=" "/>
</xpath>
</template>
@@ -193,7 +193,7 @@
</xpath>
</template>
<template id="portal_my_home_menu_lead" name="Portal layout : lead menu entry" inherit_id="portal.portal_layout" priority="15">
<xpath expr="//ol[contains(@class,'o_portal_submenu')]" position="inside">
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
<li t-if="page_name == 'lead' or lead">
<a t-if="lead" t-attf-href="/my/leads?{{ keep_query() }}">
My Leads
@@ -220,7 +220,7 @@
</template>
<template id="portal_my_home_lead" name="Portal My Home : lead entries" inherit_id="portal.portal_my_home" priority="15">
<xpath expr="//div[contains(@class,'o_my_home_content')]" position="inside">
<xpath expr="//div[hasclass('o_my_home_content')]" position="inside">
<t t-if="user_id.commercial_partner_id.grade_id">
<h3 t-if="lead_count" class="page-header">
<a href="/my/leads">My Leads
@@ -30,7 +30,7 @@
</xpath>
<!-- Generic questions -->
<xpath expr="//div[@class='container']/t[last()]" position="after">
<xpath expr="//div[hasclass('container')]/t[last()]" position="after">
<t t-if="event.general_question_ids">
<h4 class="page-header mt8"><strong>Questions</strong></h4>
<div>
@@ -84,7 +84,7 @@
</template>
<template id="cart" inherit_id="website_sale.cart_lines" name="Hide product reduction for event tickets">
<xpath expr="//td[@class='td-product_name']/div/a" position="attributes">
<xpath expr="//td[hasclass('td-product_name')]/div/a" position="attributes">
<attribute name="t-attf-href"/>
<attribute name="t-att-href">
line.event_id and ('/event/%s/register' % slug(line.event_id)) or ('/shop/product/%s' % slug(line.product_id.product_tmpl_id))
@@ -6,7 +6,7 @@
<field name="model">event.type</field>
<field name="inherit_id" ref="website_event.event_type_view_form_inherit_website"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='event_type_visibility_website']/div[@class='o_setting_right_pane']" position='inside'>
<xpath expr="//div[@name='event_type_visibility_website']/div[hasclass('o_setting_right_pane')]" position='inside'>
<div class="row mt16" attrs="{'invisible': [('website_menu', '=', False)]}">
<label class="col-md-4" for="website_track"/> <field name="website_track"/>
</div>
@@ -8,7 +8,7 @@
</template>
<template id="aboutus" inherit_id="website.aboutus" customize_show="True" name="Our Team">
<xpath expr="//div[@class='oe_structure']" position="after">
<xpath expr="//div[hasclass('oe_structure')]" position="after">
<section class="container" id="team">
<div class="col-sm-12 text-center" t-if="len(employees)">
<h2>Our Team</h2>
@@ -23,7 +23,7 @@
<!-- Add Snippets' into library -->
<template id="website_hr_recuitment_snippets_include" inherit_id="website.snippets" name="Website HR Recruitment Snippets Include">
<xpath expr="//div[@id='snippet_content']/div[@class='o_panel_body']/*[1]" position="before">
<xpath expr="//div[@id='snippet_content']/div[hasclass('o_panel_body')]/*[1]" position="before">
<t t-snippet="website_hr_recruitment.s_hr_rating" t-thumbnail="/website_hr_recruitment/static/src/img/ui/s_hr_rating_thumb.jpg"/>
</xpath>
</template>
@@ -58,4 +58,4 @@
</xpath>
</template>
</odoo>
</odoo>
@@ -12,7 +12,7 @@
</page>
</notebook>
</xpath>
<xpath expr="//div[@class='oe_title']" position="inside">
<xpath expr="//div[hasclass('oe_title')]" position="inside">
<group groups="website_mass_mailing.group_website_popup_on_exit">
<field name="popup_redirect_url"/>
</group>
@@ -2,7 +2,7 @@
<odoo>
<template id="portal_my_home_menu_purchase" name="Portal layout : purchase menu entries" inherit_id="portal.portal_layout" priority="25">
<xpath expr="//ol[contains(@class,'o_portal_submenu')]" position="inside">
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
<li t-if="page_name == 'purchase' or purchase_order">
<a t-if="purchase_order" t-attf-href="/my/purchase?{{ keep_query() }}">Purchase Orders</a>
<t t-else="">Purchase Orders</t>
@@ -14,7 +14,7 @@
</template>
<template id="portal_my_home_purchase" name="Portal My Home : purchase entry" inherit_id="portal.portal_my_home" priority="25">
<xpath expr="//ul[contains(@class,'o_portal_docs')]" position="inside">
<xpath expr="//ul[hasclass('o_portal_docs')]" position="inside">
<li t-if="purchase_count" class="list-group-item">
<span class="badge" t-esc="purchase_count"/>
<a href="/my/purchase">Purchase Orders</a>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_layout" name="Portal layout: project menu entry" inherit_id="portal.portal_layout" priority="40">
<xpath expr="//ol[contains(@class,'o_portal_submenu')]" position="inside">
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
<li t-if="page_name == 'project' or project">
<a t-if="project" t-attf-href="/my/projects?{{ keep_query() }}">Projects</a>
<t t-else="">Projects</t>
@@ -20,7 +20,7 @@
</template>
<template id="portal_my_home" name="Portal My Home: project entries" inherit_id="portal.portal_my_home" priority="40">
<xpath expr="//ul[contains(@class,'o_portal_docs')]" position="inside">
<xpath expr="//ul[hasclass('o_portal_docs')]" position="inside">
<li t-if="project_count" class="list-group-item">
<span class="badge" t-esc="project_count"/>
<a href="/my/projects">Projects</a>
@@ -2,7 +2,7 @@
<odoo>
<template id="my_task" inherit_id="website_project.my_task" name="Project Task Timesheets">
<xpath expr="//div[@class='panel-body']" position="inside">
<xpath expr="//div[hasclass('panel-body')]" position="inside">
<div class="container" t-if="task.timesheet_ids">
<hr/>
<table class="table table-hover">
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_saleorder_validity_date" inherit_id="sale.report_saleorder_document">
<xpath expr="//div[@class='page']/div[@id='informations']" position="inside">
<xpath expr="//div[hasclass('page')]/div[@id='informations']" position="inside">
<div t-if="doc.validity_date and doc.state in ['draft', 'sent']" class="col-xs-3">
<strong>Expiration Date:</strong>
<p t-field="doc.validity_date"/>
</div>
</xpath>
<xpath expr="//div[@class='page']/p[@id='fiscal_position_remark']" position="after">
<xpath expr="//div[hasclass('page')]/p[@id='fiscal_position_remark']" position="after">
<div t-if="doc.options and doc.state in ['draft', 'sent']" style="page-break-before:always;">
<h2>
<span>Suggested Products</span>
+5 -5
View File
@@ -57,7 +57,7 @@
</template>
<template id="search count" inherit_id="website.website_search_box" active="False" customize_show="True" name="Show # found">
<xpath expr="//button[contains(@class, 'oe_search_button')]" position="inside">
<xpath expr="//button[hasclass('oe_search_button')]" position="inside">
<span t-if='search and search_count' class='oe_search_found'> <small>(<t t-esc="search_count"/> found)</small></span>
</xpath>
</template>
@@ -123,7 +123,7 @@
</template>
<template id="products_description" inherit_id="website_sale.products_item" active="False" customize_show="True" name="Product Description">
<xpath expr="//div[@class='product_price']" position="before">
<xpath expr="//div[hasclass('product_price')]" position="before">
<div class="text-info oe_subdescription" contenteditable="false">
<div itemprop="description" t-field="product.description_sale"></div>
</div>
@@ -131,7 +131,7 @@
</template>
<template id="products_add_to_cart" inherit_id="website_sale.products_item" active="False" customize_show="True" name="Add to Cart">
<xpath expr="//div[@class='product_price']" position="inside">
<xpath expr="//div[hasclass('product_price')]" position="inside">
<input name="product_id" t-att-value="product.product_variant_id.id" type="hidden" />
<t t-if="len(product.product_variant_ids) == 1">
<a class="btn btn-default btn-xs a-submit">
@@ -222,7 +222,7 @@
</template>
<template id="sort" inherit_id="website_sale.products" active="True" customize_show="True" name="Show Sort by">
<xpath expr="//div[@class='products_pager']/div/t[@t-call][last()]" position="after">
<xpath expr="//div[hasclass('products_pager')]/div/t[@t-call][last()]" position="after">
<t t-set="list_price_desc_label">Catalog price: High to Low</t>
<t t-set="list_price_asc_label">Catalog price: Low to High</t>
<t t-set="name_asc_label">Name - A to Z</t>
@@ -505,7 +505,7 @@
</template>
<template inherit_id='website_sale.product' id="product_picture_magnify" customize_show="True" name="Activate Magnify">
<xpath expr='//div[contains(@class, "js_sale")]' position='attributes'>
<xpath expr='//div[hasclass("js_sale")]' position='attributes'>
<attribute name="class" separator=" " add="ecom-zoomable zoomodoo-hover" />
</xpath>
</template>
@@ -9,7 +9,7 @@
</template>
<template id="add_to_compare" inherit_id="website_sale.products_item" active="True" customize_show="True" name="Comparison List" priority="22">
<xpath expr="//div[@class='product_price']" position="inside">
<xpath expr="//div[hasclass('product_price')]" position="inside">
<a class="hidden-xs btn btn-default btn-xs o_add_compare" title="Compare" t-att-data-product-product-id="product.product_variant_ids[0].id" data-action="o_comparelist"><span class="fa fa-exchange"></span></a>
</xpath>
</template>
@@ -10,13 +10,13 @@
</template>
<template id="optional_products" inherit_id="website_sale.cart_lines" name="Optional products">
<xpath expr="//table[@id='cart_products']/tbody//td[contains(@class, 'td-qty')]/div" position="attributes">
<xpath expr="//table[@id='cart_products']/tbody//td[hasclass('td-qty')]/div" position="attributes">
<attribute name="t-if">not line.linked_line_id</attribute>
</xpath>
<xpath expr="//table[@id='cart_products']/tbody//tr" position="attributes">
<attribute name="t-att-class">'optional_product info' if line.linked_line_id else None</attribute>
</xpath>
<xpath expr="//table[@id='cart_products']/tbody//td[contains(@class, 'td-qty')]" position="inside">
<xpath expr="//table[@id='cart_products']/tbody//td[hasclass('td-qty')]" position="inside">
<t t-if="line.linked_line_id">
<span class="js_quantity text-muted" t-att-data-line-id="line.id" t-att-data-product-id="line.product_id.id" t-esc="int(line.product_uom_qty)"/>
</t>
@@ -141,10 +141,10 @@
</template>
<template id="products_add_to_cart" inherit_id="website_sale.products_add_to_cart">
<xpath expr="//div[@class='product_price']/t[1]" position="attributes">
<xpath expr="//div[hasclass('product_price')]/t[1]" position="attributes">
<attribute name="t-if">len(product.product_variant_ids) == 1 and not len(product.optional_product_ids) &gt;= 1</attribute>
</xpath>
<xpath expr="//div[@class='product_price']/t[2]" position="attributes">
<xpath expr="//div[hasclass('product_price')]/t[2]" position="attributes">
<attribute name="t-if">len(product.product_variant_ids) &gt; 1 or len(product.optional_product_ids) &gt;= 1</attribute>
</xpath>
</template>
@@ -9,7 +9,7 @@
</template>
<template id="add_to_wishlist" inherit_id="website_sale.products_item" active="True" customize_show="True" name="Wishlist" priority="20">
<xpath expr="//div[@class='product_price']" position="inside">
<xpath expr="//div[hasclass('product_price')]" position="inside">
<t t-set="in_wish" t-value="product.product_variant_ids[0] in request.env.user.partner_id.wishlist_ids.mapped('product_id')"/>
<a class="btn btn-default btn-xs o_add_wishlist" t-att-disabled='in_wish or None' title="Add to Wishlist" t-att-data-product-product-id="product.product_variant_ids[0].id" data-action="o_wishlist"><span class="fa fa-heart"></span></a>
</xpath>
@@ -4,7 +4,7 @@
<!-- add link to the standard footer -->
<template id="slide_footer" inherit_id="website.footer_default" name="Footer Slides Link">
<xpath expr="//div[@id='info']//ul[@class='list-unstyled']" position="inside">
<xpath expr="//div[@id='info']//ul[hasclass('list-unstyled')]" position="inside">
<li>
<a href="/slides">Presentations</a>
</li>
+7
View File
@@ -153,6 +153,7 @@ xpath_utils = etree.FunctionNamespace(None)
xpath_utils['hasclass'] = _hasclass
TRANSLATED_ATTRS_RE = re.compile(r"@(%s)\b" % "|".join(TRANSLATED_ATTRS))
WRONGCLASS = re.compile(r"(@class\s*=|=\s*@class|contains\(@class)")
class View(models.Model):
@@ -301,6 +302,12 @@ actual arch.
if match:
message = "View inheritance may not use attribute %r as a selector." % match.group(1)
self.raise_view_error(message, self.id)
if WRONGCLASS.search(node.get('expr', '')):
_logger.warn(
"Error-prone use of @class in view %s (%s): use the "
"hasclass(*classes) function to filter elements by "
"their classes", self.name, self.xml_id
)
else:
for attr in TRANSLATED_ATTRS:
if node.get(attr):
+1 -1
View File
@@ -48,7 +48,7 @@ class FormatAddressMixin(models.AbstractModel):
if address_view_id and not self._context.get('no_address_format'):
#render the partner address accordingly to address_view_id
doc = etree.fromstring(arch)
for address_node in doc.xpath("//div[@class='o_address_format']"):
for address_node in doc.xpath("//div[hasclass('o_address_format')]"):
Partner = self.env['res.partner'].with_context(no_address_format=True)
sub_view = Partner.fields_view_get(
view_id=address_view_id.id, view_type='form', toolbar=False, submenu=False)