Table size, thead and tbody in Qweb odoo 10 - odoo

i have 2 problemes with long tables in Qweb.
1/ if there is no place for all table on first page , Qweb print all the table on seconde page . but i want the first part of table on the first page and the seconde part on the seconde page (look to img1 and img2).
2/if the table is too long i have probleme with thead and tbody for all pages(
thead and tbody start from the same line so for all pages the first ligne is illisible ) except the first one (look to img3 and img4).
i added a comment to understand which table i'm talking about it (comment "This table" before table and "End table" after table).
Thanks
<odoo>
<data>
<record id="facture_cadre_format" model="report.paperformat">
<field name="name">European A4</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">80</field>
<field name="margin_bottom">23</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False" />
<field name="header_spacing">70</field>
<field name="dpi">90</field>
</record>
<report id="new_factures"
string="Facture (new)"
model="account.invoice"
report_type="qweb-pdf"
name="livraison_report.new_facture"
paperformat="facture_cadre_format"
/>
<template id="new_facture">
<t t-call="report.html_container">
<t t-call="facture_layout.facture_layout">
<div class="page">
<!-- Report page content -->
<style>
tbody {
font-size: 10px;
}
.police {
font-size: 10px;
}
.tableau {
page-break-inside: avoid;
}
</style>
<t t-foreach="docs" t-as="o">
<h2>
<span t-if="o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">Facture</span>
<span t-if="o.type == 'out_invoice' and o.state == 'proforma2'">PRO-FORMA</span>
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
<span t-if="o.type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span>
<span t-if="o.type == 'out_refund'">Refund</span>
<span t-if="o.type == 'in_refund'">Vendor Refund</span>
<span t-if="o.type == 'in_invoice'">Vendor Bill</span>
<span t-field="o.number"/>
</h2>
<div class="row mt32 mb32">
<div class="col-xs-2" t-if="o.name">
<strong>Description:</strong>
<p t-field="o.name"/>
</div>
<div class="col-xs-2" t-if="o.date_invoice">
<strong>Date de la facture:</strong>
<p t-field="o.date_invoice"/>
</div>
<div class="col-xs-2" t-if="o.date_due and o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">
<strong>Date d'échéance:</strong>
<p t-field="o.date_due"/>
</div>
<div class="col-xs-2" t-if="o.origin">
<strong>Origine:</strong>
<p t-field="o.origin"/>
</div>
<div class="col-xs-2" t-if="o.partner_id.ref">
<strong>BL:</strong>
<span t-esc="', '.join(map(lambda x: (x.name), o.picking_id))"/>
</div>
<div name="reference" class="col-xs-2" t-if="o.reference">
<strong>Reference:</strong>
<p t-field="o.reference"/>
</div>
</div>
<!-- _______________________________________________________This Table__________________________________________________________________ -->
<table class="table table-condensed table-bordered ">
<thead>
<tr style="background-color:#A9E2F3;">
<th>Description</th>
<th class="hidden">Source Document</th>
<th class="text-right">P.U</th>
<th class="text-right">PPA</th>
<th class="text-right">PPH</th>
<th class="text-right">Qté</th>
<th class="text-center">UM</th>
<th class="text-center">Mnt Brut</th>
<th class="text-right">RM(%)</th>
<th class="text-right">Tax Excluded Price</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.invoice_line_ids" t-as="l">
<td>
<span t-field="l.name"/>
<t t-if="(l.lot_formatted_note is not False)">
<div style="margin-left:25px;" t-field="l.lot_formatted_note" />
<br/>
</t>
</td>
<td class="hidden"><span t-field="l.origin"/></td>
<td class="text-right">
<span t-field="l.price_unit"/>
</td>
<td class="text-right">
<span t-field="l.ppa"/>
</td>
<td class="text-right">
<span t-field="l.prix_pharmacien"/>
</td>
<td class="text-right">
<span t-esc="'%.0f'%(l.quantity)"/>
</td>
<td class="text-center">
<span t-field="l.uom_id" groups="product.group_uom"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal_brut"/>
</td>
<td class="text-right">
<span t-field="l.discount"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
</tbody>
</table>
<!-- _______________________________________________________End Table__________________________________________________________________ -->
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed table-bordered tableau">
<tr class="border-black" >
<td><strong>Montant BRUT</strong></td>
<td class="text-right">
<span t-field="o.amount_untaxed_brut" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
<tr class="border-black" >
<td><strong>Montant Remise</strong></td>
<td class="text-right">
<span t-field="o.amount_discount" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
<tr class="border-black">
<td><strong>Montant HT</strong></td>
<td class="text-right">
<span t-field="o.amount_untaxed" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
<t t-foreach="o._get_tax_amount_by_group()" t-as="amount_by_group">
<tr>
<td><span t-esc="amount_by_group[0] if len(o.tax_line_ids) > 1 else (o.tax_line_ids.tax_id.description or o.tax_line_ids.tax_id.name)"/></td>
<td class="text-right">
<span t-esc="amount_by_group[1]" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
</t>
<tr class="border-black">
<td><strong>Montant TTC</strong></td>
<td class="text-right">
<span t-field="o.amount_total" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
</table>
</div>
</div>
<p class="police">
<strong>ARRETEE LA PRESENTE FACTURE A LA SOMME DE:</strong>
<span t-field="o.amount_to_text"/>
</p>
<p t-if="o.comment">
<strong>Comment:</strong>
<span t-field="o.comment"/>
</p>
<p t-if="o.payment_term_id">
<span t-field="o.payment_term_id.note"/>
</p>
<p t-if="o.fiscal_position_id.note">
<strong>Fiscal Position Remark:</strong>
<span t-field="o.fiscal_position_id.note"/>
</p>
<table class="table table-condensed table-bordered tableau">
<thead>
<tr >
<th class="text-center"><strong>Commercial</strong></th>
<th class="text-center"><strong>Client</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<br/>
<br/>
</td>
<td>
<br/>
<br/>
</td>
</tr>
</tbody>
</table>
</t>
</div>
</t>
</t>
</template>
</data>
</odoo>

Use <thead> tag for your requirement.

Hi try changing the values of some fields in this record,
<record id="facture_cadre_format" model="report.paperformat">
<field name="name">European A4</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">80</field>
<field name="margin_bottom">23</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False" />
<field name="header_spacing">70</field>
<field name="dpi">90</field>
</record>
I have faced the same issue and rectified by changing some values here.I don't correctly remember which one.Try changing values of page height and if it doesn't work try other fields.

Related

how to pass data from my controller to the view in laravel 8

am trying to retrieve data from the controller and send it through and email to student but it not working .i have tried it but it not going
public function test(){
$welcome = DB::table('results')
->select('studentinfos_id','marks','subject_code','name','email','rollid','classname','classnumber','image_path')
->join('studentinfos','studentinfos.id','=','results.studentinfos_id')
->join('subjects','subjects.id','=','results.subjects_id')
->join('addclasses','addclasses.id','=','results.addclasses_id')
->where('studentinfos.id',1)
->orderBy('subject_code','ASC')
->get();
Mail::to('serge#gmaile','divine')->cc('leade#gmail')->send(new mytestmail($welcome));
echo 'check ur inbox';
}
how do i get all the result from the $welcome in my view.blade.php
i was hopping that i will send and email that contains student info and result of there marks and subject through email
<div class="container">
<div class="text-center">
<h1> Result for {{ $classname }} student </h1>
</div>
<div class="border bg-white seespace p-3">
<div class="row">
<div class="col-md-8">
<table class="table table-borderless">
<tr>
<th>CLASS</th>
<td>{{ $welcome->classname }} {{ $welcome->classnumber }}</td>
</tr>
<tr>
<th>FULL NAME</th>
<td>: {{ $welcome->name }}</td>
</tr>
<tr>
<th>EMAIL</th>
<td>: {{ $welcome->email }}</td>
</tr>
<tr>
<th>ENROLLMENT</th>
<td>: {{ $welcome->enrollment }}</td>
</tr>
</table>
</div>
<div class="col-md-4">
<img class=" imgreport center" src="{{ asset('images/' . $welcome->image) }}"
alt="Card image cap">
</div>
</div>
<nav class="bg-dark text-white-50 mb-5">
<div class="container">
<div class="row p-3">
</div>
</div>
</nav>
<table class="table text-center table-bordered table-responsive py-3">
<thead class="thead-info text-center">
<tr>
<th>no</th>
<th>subject</th>
<th>marks</th>
</tr>
</thead>
<tbody>
<?php $num=1;
$total = 0;
$name;
?>
#foreach($welcome as $see)
<tr>
<td>{{ $num++ }}</td>
<td>{{ $see->subject_code }}</td>
<td>{{ $see->marks }}</td>
</tr>
<?php
$total += $see->marks ?>
#endforeach
<tr>
<td></td>
<td >total marks</td>
<td>{{ $total }}</td>
</tr>
<tr>
<td></td>
<td>Download</td>
<td>
<form action="/print" method="get">
<input type="hidden" value="{{$studnet}}" name='id' >
<button class="btn btn-info">Download</button>
</form>
</td>
</tr>
</tbody>
</table>
</div>
</div>
#stop
you have to pass the welcome variable to your view.
In the controller method add the data when displaying your view:
return view('view', ['welcome' => $welcome]);
https://laravel.com/docs/8.x/views#passing-data-to-views

How Can Display Receipt In Quotation in odoo 12?

I using odoo 12 , I need display receipt similar point of sale receipt in quotation in sale module
Just replicate the Point of Sale Report in the sale.order model. The internal_layout may be useful in that case
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_saledetails">
<t t-call="web.html_container">
<t t-call="web.internal_layout">
<div class="page">
<div class="text-center">
<h2>Sales Details</h2>
<strong><t t-esc="date_start" t-options="{'widget': 'datetime'}"/> - <t t-esc="date_stop" t-options="{'widget': 'datetime'}"/></strong>
</div>
<!-- Orderlines -->
<h3>Products</h3>
<table class="table table-sm">
<thead><tr>
<th>Product</th>
<th>Quantity</th>
<th>Price Unit</th>
</tr></thead>
<tbody>
<tr t-foreach='products' t-as='line'>
<t t-set="internal_reference" t-value="line['code'] and '[%s] ' % line['code'] or ''" />
<td><t t-esc="internal_reference" /><t t-esc="line['product_name']" /></td>
<td>
<t t-esc="line['quantity']" />
<t t-if='line["uom"] != "Unit(s)"'>
<t t-esc='line["uom"]' />
</t>
</td>
<td>
<t t-esc='line["price_unit"]' />
<t t-if='line["discount"] != 0'>
Disc: <t t-esc='line["discount"]' />%
</t>
</td>
</tr>
</tbody>
</table>
<br/>
<h3>Payments</h3>
<table class="table table-sm">
<thead><tr>
<th>Name</th>
<th>Total</th>
</tr></thead>
<tbody>
<tr t-foreach='payments' t-as='payment'>
<td><t t-esc="payment['name']" /></td>
<td><t t-esc="payment['total']" t-options="{'widget': 'float', 'precision': currency_precision}"/></td>
</tr>
</tbody>
</table>
<br/>
<h3>Taxes</h3>
<table class="table table-sm">
<thead><tr>
<th>Name</th>
<th>Tax Amount</th>
<th>Base Amount</th>
</tr></thead>
<tbody>
<tr t-foreach='taxes' t-as='tax'>
<td><t t-esc="tax['name']" /></td>
<td><t t-esc="tax['tax_amount']" t-options="{'widget': 'float', 'precision': currency_precision}"/></td>
<td><t t-esc="tax['base_amount']" t-options="{'widget': 'float', 'precision': currency_precision}"/></td>
</tr>
</tbody>
</table>
<br/>
<br/>
<strong>Total: <t t-esc='total_paid' t-options="{'widget': 'float', 'precision': currency_precision}"/></strong>
</div>
</t>
</t>
</template>
</data>
</openerp>

How to get pdf file while printing report in odoo 10?

I have used this code but not working returning empty PDF file in odoo 10
self.env['report'].sudo().get_pdf(self, 'equipment_management.report_gatepass')
.xml code:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report id="equipment_action"
model="calibration.details"
string="Gatepass "
report_type="qweb-pdf"
name="equipment_management.report_gatepass"
file="equipment_management.report_gatepass"
/>
<record id="paperformats" model="report.paperformat">
<field name="name">European A4 low margins</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">20</field>
<field name="margin_bottom">20</field>
<field name="margin_left">20</field>
<field name="margin_right">20</field>
<field name="header_line" eval="False" />
<field name="header_spacing">10</field>
<field name="dpi">90</field>
</record>
<record id="equipment_management.equipment_action" model="ir.actions.report.xml">
<field name="paperformat_id" ref="equipment_management.paperformats" />
</record>
<template id="report_gatepass">
<t t-call="report.html_container">
<t t-set="counter" t-value="001"/>
<t t-foreach="docs" t-as="o">
<div class="page">
<style>
.box{
background: black;
max-width: 250px;
text-align:center;
color:white;}
</style>
<div class="row">
<table width="100%" cellpadding="0px" cellspacing="0px" style="border:1px solid black">
<tr style="border-bottom:1px solid black">
<td width="20%" valign="top" align="center" padding="15px">
<img t-att-src="'data:image/png;base64,%s' % res_company.logo" height="100px" width="90px" />
</td>
<td width= "80%">
<div style="font-size:18px;"><center><b><t t-if="res_company.name" t-esc="res_company.name"/></b></center></div>
<div style="font-size:12px;"><center><t t-if="res_company.rml_header1" t-esc="res_company.rml_header1"/></center></div>
<div style="font-size:12px"><center><t t-if="res_company.street" t-esc ="res_company.street"/> <t t-if="res_company.street2" t-esc ="res_company.street2"/> <t t-if="res_company.state_id" t-esc ="res_company.state_id.name"/> <t t-if="res_company.country_id" t-esc ="res_company.country_id.name"/></center></div>
<div style="font-size:12px"><center>Tel No.<t t-if="res_company.phone" t-esc ="res_company.phone"/>, Fax<t t-if="res_company.fax" t-esc ="res_company.fax"/>, Email <t t-if="res_company.email" t-esc ="res_company.email"/>, Website <t t-if="res_company.website" t-esc ="res_company.website"/></center></div>
</td>
</tr>
<tr>
<td colspan="2" width="100%" style="font-size:24px"><center><div class="box"><strong>GATEPASS</strong></div></center></td>
</tr>
<tr style="border-bottom:1px solid black">
<td colspan="2" width="100%" style="font-size:14px"><center><strong>(NIWE-Returnable Material)</strong></center></td>
</tr>
<tr style="border-bottom:1px solid black">
<td colspan="2">
<table width="100%" cellpadding="0px" cellspacing="0px">
<tr>
<td width="25%" style="font-size:14px;line-height:300%;"><center><strong>Reference No.:</strong></center></td>
<td width="25%" style="font-size:14px;line-height:300%;text-align:left;"><strong><t t-esc="o.name"/></strong></td>
<td width="25%" style="font-size:14px;line-height:300%;"><center><strong>Date:</strong></center></td>
<td width="25%" style="font-size:14px;line-height:300%;text-align:left"><strong><span t-field="o.date" t-field-options='{"format": "dd-MM-y"}'/></strong></td>
</tr>
</table>
</td>
</tr>
<tr style="border-bottom:1px solid black">
<td colspan="2">
<table width="100%" cellpadding="0px" cellspacing="0px" style="font-size:12px">
<tr style="border-bottom:1px solid black;height:50px;">
<td width="5%" style="text-align:center;border-right:1px solid black">1</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Name and Designation of the Person taking the Material</td>
<td width="42%" style="padding-left:5px"><t t-if="o.responsible_person.name" t-esc="o.responsible_person.name"/></td>
</tr>
<tr style="border-bottom:1px solid black;height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">2</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Address of supplier taking material out of NIWE Campus(with phone No.)</td>
<td width="42%" style="padding-left:5px">
<div style="font-size:12px"><t t-if="o.responsible_person.street" t-esc ="o.responsible_person.street"/></div>
<div><t t-if="o.responsible_person.street2" t-esc ="o.responsible_person.street2"/></div>
<div><t t-if="o.responsible_person.state_id" t-esc ="o.responsible_person.state_id.name"/> </div>
<div><t t-if="o.responsible_person.country_id" t-esc ="o.responsible_person.country_id.name"/></div>
<div style="font-size:12px"><t t-if="o.responsible_person.phone" t-esc ="o.responsible_person.phone"/></div>
<div><t t-if="o.responsible_person.mobile" t-esc ="o.responsible_person.mobile"/></div>
</td>
</tr>
<tr style="border-bottom:1px solid black;height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">3</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Description of items with its serial Number and Quantity etc.,</td>
<td width="42%" style="padding-left:5px">
<div><b>Name:</b><t t-if="o.instrument.name" t-esc="o.instrument.name"/></div>
<div><b>Serial No:</b><t t-if="o.serial" t-esc="o.serial"/></div>
<div><b>Description:</b><t t-if="o.instrument.description" t-esc="o.instrument.description"/></div>
</td>
</tr>
<tr style="border-bottom:1px solid black;height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">4</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Purpose for which the Material(s) in/are being taken out</td>
<td width="42%" style="padding-left:5px"><t t-if="o.purpose" t-esc="o.purpose"/></td>
</tr>
<tr style="border-bottom:1px solid black;height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">5</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Probable date of return of Material if any</td>
<td width="42%" style="padding-left:5px"><t t-if="o.date_of_return"><span t-field="o.date_of_return" t-field-options='{"format": "dd-MM-y"}'/></t></td>
</tr>
<tr style="border-bottom:1px solid black;height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">6</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">NIWE-officer responsible for inspection Returning the Material</td>
<td width="42%" style="padding-left:5px"><t t-if="o.officer.name" t-esc="o.officer.name"/></td>
</tr>
<tr style="height:60px;">
<td width="5%" style="text-align:center;border-right:1px solid black">7</td>
<td width="53%" style="padding-left:5px;border-right:1px solid black">Any other Informations</td>
<td width="42%" style="padding-left:5px"><t t-if="o.other_info" t-esc="o.other_info"/></td>
</tr>
</table>
</td>
</tr>
</table>
<table style="font-size:12px" width="100%">
<tr>
<br/><br/><br/><br/>
</tr>
<tr>
<td width="35%" style="text-align:left"><span><div>Signature of the person taking the</div>
<div>Material out NIWE Campus</div></span></td>
<td width="35%"><span><div>Signature of the Officer/Material</div><div style="text-align:center">Indenter</div></span></td>
<td width="30%" style="text-align:right">Signature of Head/Project Leader</td>
</tr>
</table>
<table style="font-size:12px" width="100%">
<tr>
<br/><br/><br/><br/>
</tr>
<tr>
<td width="50%" style="text-align:left">Authorized Signatory</td>
<td width="50%" style="text-align:right"><span>Signature of Security Officer/Security
<div>Guard on duty in NIWE</div></span></td>
</tr>
</table>
</div>
</div>
</t>
</t>
</template>
</data>
</openerp>
Correct syntax:
pdf = request.env['report'].sudo().get_pdf([sale_order_id], 'sale.report_saleorder', data=None)
By default the report format of Odoo reports are in PDF, I don't know why your specifically asking for pdf file while printing. The below given is a sample code for attaching PDF file of sale_order report as attachment to the order/quotation using .get_pdf.
Example:
#api.multi
def print_quotation(self):
for order in self:
result = self.env['report'].sudo().get_pdf([order.id], 'sale.report_saleorder')
return self.env['ir.attachment'].create({
'name': 'Sample',
'type': 'binary',
'datas': base64.encodestring(result),
'res_model': 'sale.order',
'res_id': order.id,
'mimetype': 'application/x-pdf'
})
Openerp has changed to Odoo. So please change the below section in your code if you are using Odoo 10.0:
<openerp>
<data>
</data>
</openerp>
to
<odoo>
<data>
</data>
</odoo>
Hope this may help you !

Account invoice report

<openerp>
<data>
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//span[#t-field='t.amount']" position="after">
<span t-field="t.note"/>
</xpath>
</template>
</data>
</openerp>
i added field to invoice report inside tax table. but how can i make tax table visible only if there is note field, and hide if note is empty.
i trying something with t-if but my goal is to show tax table not to hide it when note field is not empy. is there any kind of t-ifnot?
<xpath expr="//span[#t-field='t.amount']/../../../../thead/tr" position="replace">
<th t-if="o.notes"
</xpath>
Yes. We can achieve it with following example:
<t t-if="o.notes">
<!-- Fields visible if Notes has value-->
</t>
<t t-if="not o.notes">
<!-- Fields visible if Notes has no value-->
</t>
EDIT
Design your table in one of condition.
<t t-if="o.notes">
<table style="border:1px solid; width:100%">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</t>
Hello An..,
Best Learning Tutorial
If you want use any types of condition so QWeb is provides many types of inbuilt functionality. More information for read below link,
1) https://www.odoo.com/documentation/8.0/reference/qweb.html
Solution
Account invoice base/odoo table is below,
<div class="row" t-if="len(o.tax_line_ids) > 0">
<div class="col-xs-6">
<table class="table table-condensed">
<thead>
<tr>
<th>Tax</th>
<th class="text-right">Base</th>
<th class="text-right">Amount</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.tax_line_ids" t-as="t">
<td><span t-field="t.tax_id.description"/></td>
<td class="text-right">
<span t-field="t.base" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
<td class="text-right">
<span t-field="t.amount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
Now you want to show the table when t.note field is not empty so odoo XML provides if condition to check the anything.
Now try this below code for your problem,
<openerp>
<data>
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//span[#t-field='t.amount']" position="after">
<t t-if="t.note">
<span t-field="t.note"/>
<!-- For example i add one new table -->
<table class="table table-condensed">
<thead>
<tr>
<th>Tax</th>
<th class="text-right">Base</th>
<th class="text-right">Amount</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.tax_line_ids" t-as="t">
<td><span t-field="t.name"/></td>
<td class="text-right">
<span t-field="t.base"
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</td>
<td class="text-right">
<span t-field="t.amount"
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</td>
</tr>
</tbody>
</table>
</t>
<t t-if="not t.note">
<!-- If empty t.note so not show tax table -->
</t>
</xpath>
</template>
</data>
</openerp>
I hope my answer is helpful.
If any query so comment please.

Inherit qweb report and replace string odoo 9

I'm inherit qweb report, now I want replace string Total Without Taxes, Taxes, Total
<div class="row" name="total">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td><strong>Total Without Taxes</strong></td>
<td class="text-right">
<span t-field="doc.amount_untaxed"
t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
</td>
</tr>
<tr>
<td>Taxes</td>
<td class="text-right">
<span t-field="doc.amount_tax"
t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
</td>
</tr>
<tr class="border-black">
<td><strong>Total</strong></td>
<td class="text-right">
<span t-field="doc.amount_total"
t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
</td>
</tr>
</table>
</div>
</div>
<xpath expr="?????" position="replace">
</xpath>
Any simple solution or online example?..................................
please try this code :-
<xpath expr="//div[#name='total']" position="replace">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<!--Add your Custom String-->
<td><strong>Custom String</strong></td>
<td class="text-right">
<span t-field="doc.amount_untaxed"
t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
</td>
</tr>
<tr>
<!--Add your Custom String for taxes-->
<td>Custom String</td>
<td class="text-right">
<span t-field="doc.amount_tax"
t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
</td>
</tr>
<tr class="border-black">
<!--Add your Custom String for Total-->
<td><strong>Custom String</strong></td>
<td class="text-right">
<span t-field="doc.amount_total"
t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
</td>
</tr>
</table>
</div>
</xpath>
Try this. Havent had a chance to test it.
<xpath expr="//table[contains(#class, 'table-condensed')]/tr[first()]/td[first()]" position="replace">
<!-- YOUR XML HERE -->
</xpath>