Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
5745 Weergaven

I'm working on Odoo 11

I need to customize the report invoice which external id is "report_invoice_document_with_payments".

I tried this way:

<template id="report_custom_invoice_with_payments" inherit_id="account.report_invoice_document_with_payments" customize_show="True">
<xpath expr="." position="replace">
<t name="report_custom_invoice" t-name="account.report_invoice_document_with_payments">
<xpath expr="//div[@class='table4']" position="append">
<div><strong>Payé:</strong></div>
</xpath>
</t>
</xpath>
</template>

I get this error:

Traceback (most recent call last):
  File "/home/wilfried/wise/wiserp/odoo/models.py", line 1023, in _validate_fields
    check(self)
  File "/home/wilfried/wise/wiserp/odoo/addons/base/ir/ir_ui_view.py", line 330, in _check_xml
    view_def = view.read_combined(['arch'])
  File "/home/wilfried/wise/wiserp/haddons/web_debranding/models/ir_ui_view.py", line 16, in read_combined
    res = super(View, self).read_combined(fields=fields)
  File "/home/wilfried/wise/wiserp/odoo/addons/base/ir/ir_ui_view.py", line 704, in read_combined
    arch_tree = self.apply_inheritance_specs(arch_tree, view_arch, parent_view['id'])
  File "/home/wilfried/wise/wiserp/odoo/addons/base/ir/ir_ui_view.py", line 641, in apply_inheritance_specs
    self.raise_view_error(_("Element '%s' cannot be located in parent view") % tag, inherit_id)
  File "/home/wilfried/wise/wiserp/odoo/addons/base/ir/ir_ui_view.py", line 503, in raise_view_error
    raise ValueError(message)
ValueError: L'élément '<xpath expr="//div[@id='total']/div/table">' ne peut être localisé dans la vue parente

Contexte de l'erreur :
Vue `report_invoice_document`
[view_id: 484, xml_id: account.report_invoice_document, model: n/a, parent_id: n/a]

Please help me.

Firstly, in my customized module, I created a xml file that inherits "report_invoice_document". this is my code:

<template id="report_custom_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//div[@class='page']" position="replace">
<link href="/wise_account/static/src/css/report_invoice.css" rel="stylesheet"/>
<div id="page">
<div class="customer_name">
<address t-field="o.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<div t-if="o.partner_id.vat" class="mt16"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_id.vat"/></div>
</div>
<div class="invoice">FACTURE</div>

<div id="line1">
<table class="table1" style="text-decoration:black;">
<thead>
<tr>
<th class="num">NUMERO</th>
<th class="num">DATE</th>
<th class="num">REFERENCE</th>
</tr>
</thead>
<tbody>
<tr>
<td class="num">
<span t-field="o.number"/>
</td>
<td class="num">
<p t-field="o.date_invoice"/>
</td>
<td class="num">
<p t-field="o.reference"/>
</td>
</tr>
</tbody>
</table>
</div>
<div id="line2">
<div class="watermark" style="width:50%;position:absolute;opacity:0.25;text-align:center;">
<img src='/web/binary/company_logo' style="width:100%"/>
</div>
<table class="table2" style="text-decoration:black;">
<thead>
<tr>
<th class="tab2">Référence</th>
<th class="tab2" colspan="4">Désignation</th>
<th class="qte">Qté</th>
<th class="tab2">Prix unitaire</th>
<th class="tab2">Remise</th>
<th class="tab2">Montant HT</th>
</tr>
</thead>
<tbody>
<t t-set="tht" t-value="0"></t>
<t t-set="vdiscount" t-value="0"></t>
<t t-set="vht" t-value="0"></t>
<tr t-foreach="o.invoice_line_ids" t-as="l">
<td class="adress">
<span t-field="l.name"/>
</td>
<td class="adress" colspan="4">
<span t-field="l.name"/>
</td>
<td class="quantity">
<span t-esc="int(float(l.quantity))"/>,00
<span t-field="l.uom_id" groups="product.group_uom"/>
</td>
<td class="pu">
<span t-field="l.price_unit"/>
</td>
<td class="discount">
<t t-set="vdiscount" t-value="((l.price_unit*l.quantity)-(l.price_unit*l.quantity*0.05))*0.08"></t>
<span t-esc="int(float(vdiscount))"/>
</td>
<td class="ht">
<t t-set="vht" t-value="(l.price_unit*l.quantity)-(l.price_unit*l.quantity*0.05)-vdiscount"></t>
<span t-esc="int(float(vht))"/>
</td>
<t t-set="tht" t-value="tht+vht"/>
</tr>
<tr>
<td class="line"></td>
<td class="line" colspan="4"></td>
<td class="line"></td>
<td class="line"></td>
<td class="line"></td>
<td class="line"></td>
</tr>
<tr>
<td class="line"></td>
<td class="line" colspan="4"></td>
<td class="line"></td>
<td class="line"></td>
<td class="line"></td>
<td class="line"></td>
</tr>
<tr>
<td class="line"></td>
<td class="line" colspan="4"></td>
<td class="line"></td>
<td class="lin"></td>
<td class="lin"></td>
<td class="lin"></td>
</tr>
<tr>
<td class="lin"></td>
<td class="lin"></td>
<td class="lin"></td>
<td class="lin"></td>
<td class="lin"></td>
<td class="lin"></td>
</tr>

</tbody>
</table>
</div>
<div id="line3">
<table class="table3" style="text-decoration:black;">
<thead>
<tr>
<th class="th1">Code</th>
<th class="th2">Base</th>
<th class="th3">Taux</th>
<th class="th4">Montant</th>
</tr>
</thead>
<tbody>
<tr>
<td class="t1">
TVA
</td>
<td class="t2">
<span t-esc="int(float((tht-(tht/100))))"/>
</td>
<td class="t3">
19,25 %
</td>
<td class="t4">
<span t-esc="int(float(((tht-(tht/100))*0.1925)))"/>
</td>
</tr>
<tr>
<td class="tline1">
Précompte Achat
</td>
<td class="tline2">
<span t-esc="int(float((tht-(tht/100))))"/>
</td>
<td class="tline3">
2,00 %
</td>
<td class="tline4">
<span t-esc="int(float(((tht-(tht/100))*0.02)))"/>
</td>
</tr>
<tr>
<td class="th1">
Total
</td>
<td class="th2">
<span t-esc="int(float(tht-(tht/100)))"/>
</td>
<td class="th3">

</td>
<td class="th4">
<span t-esc="int(float(((tht-(tht/100))*0.1925)+((tht-(tht/100))*0.02)))"/>
</td>
</tr>
</tbody>
</table>
<div class="table4">
<table class="table5" >
<thead>
<tr>
<th class="tab4" style="text-decoration:black;">Total HT</th>
<th class="tab4">Escompte</th>
<th class="tab4">Total TTC</th>
<th class="tab4">Acompte</th>
<th class="th5">NET A PAYER</th>
</tr>
</thead>
<tbody>
<tr>
<td class="td4">
<span t-esc="int(float(tht))"/>
</td>
<td class="td4">
<span t-esc="int(float(tht/100))"/>
</td>
<td class="td4">
<span t-esc="int(float((tht-(tht/100))+((tht-(tht/100))*0.1925)+((tht-(tht/100))*0.02)))"/>
</td>
<td class="td4">
45000
</td>
<td class="td4">
<span t-esc="int(float(((tht-(tht/100))+((tht-(tht/100))*0.1925)+((tht-(tht/100))*0.02)-45000)))"/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</xpath>
</template>
Avatar
Annuleer

What a coincidence, right now I have the same problem. But I do not have the answer yet.

Beste antwoord

I have same problem.

can you give me solution?

Avatar
Annuleer