[FIX] purchase_requsition: clean report placeholders

Previous PR: odoo/odoo#135739 added in report placeholders for the sake
of easier editing of reports with studio. Unfortunately it didn't check
that these placeholders aren't printed with real records which results
in junk being included in the report, so we add in conditions to avoid
this situation.

Also, since the report was already being edited, clean up some of the
placeholders because they didn't make sense/ didn't do anything (e.g.
the `address` values weren't used + already have a special placeholder
in studio => remove them).

closes odoo/odoo#156674

Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
Tiffany Chang (tic)
2024-03-06 14:30:46 +00:00
parent 3f4e15bb4c
commit 9626504181
@@ -6,30 +6,30 @@
<t t-call="web.external_layout">
<t t-set="address">
<span t-field="o.vendor_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'>VAT123</span>
<p t-if="o.vendor_id.vat"><t t-out="o.company_id.account_fiscal_country_id.vat_label or 'Tax ID'"/>: <span t-field="o.vendor_id.vat">VAT_DEMO</span></p>
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="o.vendor_id.vat"><t t-out="o.company_id.account_fiscal_country_id.vat_label or 'Tax ID'"/>: <span t-field="o.vendor_id.vat"/></p>
</t>
<div class="page">
<div class="oe_structure"/>
<h2><span t-out="o.type_id.name">VAT</span> <span t-field="o.name">Type Demo</span></h2>
<h2><span t-out="o.type_id.name">Agreement</span> <span t-field="o.name">Agreement00004</span></h2>
<div class="row my-2">
<div class="col-3">
<strong><span t-out="o.type_id.name">Reference:</span></strong><br/>
<span t-field="o.name">Reference Demo</span>
<strong><span t-out="o.type_id.name">Agreement:</span></strong><br/>
<span t-field="o.name">Agreement00004</span>
</div>
<div class="col-3">
<div t-if="o.ordering_date" class="col-3">
<strong>Scheduled Ordering Date:</strong><br/>
<span t-field="o.ordering_date">2023-08-20</span>
</div>
<div class="col-3">
<div t-if="o.date_end" class="col-3">
<strong>Agreement Deadline:</strong><br/>
<span t-field="o.date_end">2023-09-15</span>
</div>
<div class="col-3">
<div t-if="o.origin" class="col-3">
<strong>Source:</strong><br/>
<span t-field="o.origin">Origin Demo</span>
<span t-field="o.origin">Origin</span>
</div>
</div>
@@ -58,7 +58,7 @@
<span t-field="line_ids.product_id.name">Product</span>
</td>
<td>
<span t-field="line_ids.product_description_variants">Description Demo</span>
<span t-if="line_ids.product_description_variants" t-field="line_ids.product_description_variants">Product description</span>
</td>
<td class="text-end">
<span t-field="line_ids.product_qty">5</span>
@@ -67,16 +67,15 @@
<span t-field="line_ids.product_uom_id.name">Unit</span>
</td>
<td t-if="o.type_id == env.ref('purchase_requisition.type_single')">
<span t-field="line_ids.price_unit" t-options='{"widget": "monetary", "display_currency": line_ids.requisition_id.currency_id}'>Price</span>
<span t-field="line_ids.price_unit" t-options='{"widget": "monetary", "display_currency": line_ids.requisition_id.currency_id}'>$50</span>
</td>
<td class="text-end">
<span t-field="line_ids.schedule_date">2023-08-11</span>
<span t-if="line_ids.schedule_date" t-field="line_ids.schedule_date">2023-08-11</span>
</td>
</tr>
</tbody>
</table>
</t>
<t t-if="o.purchase_ids">
<h3>Requests for Quotation Details</h3>
<table class="table table-sm">
@@ -96,7 +95,7 @@
<span t-field="purchase_ids.date_order">2023-08-15</span>
</td>
<td class="text-end">
<span t-field="purchase_ids.name">Reference Demo</span>
<span t-field="purchase_ids.name">PO000042</span>
</td>
</tr>
</tbody>