[FIX] account: remove nested html p tag in p tag for invoicing report

Current behavior:
The invoice payment term of the report is a p tag with another p tag inside like:
<p name="payment_term">
	<span>
		<p> This is a payment term note</p>
	</span>
</p>
but because nested p tags are not supported in html de result in the browser is something like:
<p name="payment_term">
        <span></span>
</p>
<p> This is a payment term note</p>
<p></p>

Similar behavior can be observe for the fiscal position note.

Expected behavior:
The code should respect html format rules and not have nested p tags.

Solution: We replace the parent p tags by div tags, and we modify xml file that have xpath relying
on this tag.

opw-2804933

closes odoo/odoo#88660

Related: odoo/enterprise#26372
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
mafo-odoo
2022-04-29 12:05:24 +02:00
parent 20fbc19a2d
commit ac04c9dbfd
3 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -167,15 +167,15 @@
<p t-if="o.move_type in ('out_invoice', 'in_refund') and o.payment_reference" name="payment_communication">
Please use the following communication for your payment : <b><span t-field="o.payment_reference"/></b>
</p>
<p t-if="o.invoice_payment_term_id" name="payment_term">
<div t-if="o.invoice_payment_term_id" name="payment_term">
<span t-field="o.invoice_payment_term_id.note"/>
</p>
</div>
<div t-if="not is_html_empty(o.narration)" name="comment">
<span t-field="o.narration"/>
</div>
<p t-if="not is_html_empty(o.fiscal_position_id.note)" name="note">
<div t-if="not is_html_empty(o.fiscal_position_id.note)" name="note">
<span t-field="o.fiscal_position_id.note"/>
</p>
</div>
<p t-if="o.invoice_incoterm_id" name="incoterm">
<strong>Incoterm: </strong><span t-field="o.invoice_incoterm_id.code"/> - <span t-field="o.invoice_incoterm_id.name"/>
</p>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//p[@name='payment_term']" position="after">
<xpath expr="//div[@name='payment_term']" position="after">
<p t-if="o.company_id.country_id.code == 'AE' and o.partner_id.country_id.code != 'AE' and o.env.ref('l10n_ae.gcc_countries_group') in o.partner_id.country_id.country_group_ids">
Supply between <b>United Arab Emirates</b> and
<b>
+1 -1
View File
@@ -173,7 +173,7 @@
<xpath expr="//th[@name='th_taxes']" position="replace"/>
<xpath expr="//span[@id='line_tax_ids']/.." position="replace"/>
<p name="payment_term" position="replace"/>
<div name="payment_term" position="replace"/>
<xpath expr="//span[@t-field='o.payment_reference']/../.." position="replace"/>
<!-- replace information section and usage chilean style -->