External ID not found in the system: "report.external_layout_header" - odoo

I want to migrate a module report from odoo 10 to odoo 11 but it seems that odoo 11 doesn't contain a module in addons called report. Can you help me and tell me with what I can replace it.
External ID not found in the system: report.external_layout_header" while parsing None:3, near
<data inherit_id="report.external_layout_header">
<xpath expr="//div[#class='header']" position="replace">
<div class="header">
<div class="row zero_min_height">
<div class="col-xs-12">
<div style="border-bottom: 1px solid black;"/>
</div>
</div>
<div class="row">
<div class="col-xs-6" name="company_address">
<span t-field="company.partner_id" t-field-options="{"widget": "contact", "fields": ["address", "name"], "no_marker": true}" style="border-bottom: 1px solid black; display:inline-block;"/>
</div>
<div class="col-xs-6 text-right">
<img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
</div>
</div>
</div>
</xpath>
</data>```
Second error: Element '<xpath expr="//div[#name='customer_address']/div/div">' cannot be located in parent view
None" while parsing None:3, near
<data inherit_id="stock.report_delivery_document">
<xpath expr="//div[#name='customer_address']/div/div" position="replace">
<span t-if="o.picking_type_id.code=='outgoing'"><strong>Adresse Client:</strong></span>
<span t-if="o.picking_type_id.code=='incoming'"><strong>Adresse Fournisseur:</strong></span>
</xpath>
<xpath expr="//h2" position="replace">
<h2 t-if="o.picking_type_id.code=='outgoing'">
Bon de livraison:
<span t-field="o.name"/>
</h2>
<h2 t-else="">
Bon de réception:
<span t-field="o.name"/>
</h2>
</xpath>

In Odoo11 the "report" module is integrated with "web" module.
Replace this report.external_layout_header with web.external_layout and don't forget to add 'web' in your dependency
inherit_id="web.external_layout"

Hello, omas
Can you Please write the following code:
<data inherit_id="web.external_layout_background">
<xpath expr="//div[hasclass('o_background_header')]" position="replace">
<div class="header">
<div class="row zero_min_height">
<div class="col-xs-12">
<div style="border-bottom: 1px solid black;"/>
</div>
</div>
<div class="row">
<div class="col-xs-6" name="company_address">
<span t-field="company.partner_id" t-field-options="{"widget": "contact", "fields": ["address", "name"], "no_marker": true}" style="border-bottom: 1px solid black; display:inline-block;"/>
</div>
<div class="col-xs-6 text-right">
<img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
</div>
</div>
</div>
</xpath>
</data>```
I Hope this helps you.
Thank you.

Related

How to make a QWeb report widget?

I'm trying to create a simple Qweb widget. My code is like this
<template id="contact_name">
<address t-ignore="true" class="mb0" itemscope="itemscope" itemtype="http://schema.org/Signature">
<div t-att-class="'name' not in fields and 'css_non_editable_mode_hidden'">
<span itemprop="name" t-esc="name"/>
</div>
</address>
</template>
Then I called the widget like this
<address t-field="o.partner_id" t-field-options='{"widget": "contact_name", "fields": ["name"], "no_marker": true}' />
It did not print out name but print out the object res.partner(703,)
How is it to print the name? Is it not enough to just to use <span itemprop="name" t-esc="name"/>?
<div class="page">
<div class="oe_structure"/>
<div class="col-xs-6 pull-left">
<h2 style="color:red">
<span>Plan Order :
<span style="color:Red" t-field='doc.name'/>
</span>
</h2>
</div>
<div colspan="4" class="col-xs-6 text-right">
<span>
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Code128', doc.name, 500, 50)"
style="width:100%;height:50px"/>
</span>
</div>

Selenium:- Popup handelling in HTML

I am using Firefox Quantum.
It's something different than Mozzila firefox. I can't use firebug now as it is not supporting.How can i verify that the i am on a different frame.
As currently i can't write on the popup message. Maybe it is on different frame.
Can anyone explain me with proper example.
The HTMLM of the code is:-
<div class="store_form">
<div class="row">
<div class="col s12 m12 marg-top">
<div class="row">
<div class="col s12 m6 store_band_contact">
</div>
<div class="col s12 m6 store_add_left">
</div>
</div>
</div>
<form id="form_contact" class="col s12 m12" novalidate="novalidate">
<div id="errorMsg"></div>
<!-- <div class="row">
<p class="col s12" style="font-size: 15px;" >
<strong id="buyer_company"></strong>
</p>
</div> -->
<!-- <div class="row">
<p class="col s12" id="">Subject: Request to remove my bid
</p>
</div> -->
<div class="row">
<div class="input-field col s12">
<span class="editFiledHeading">Request to remove my bid</span>
<!-- Contact Seller -->
<textarea name="comment" maxlength="20000" id="comment" class="ckeditor" placeholder="" style="visibility: hidden; display: none;"></textarea><div id="cke_comment" class="cke_1 cke cke_reset cke_chrome cke_editor_comment cke_ltr cke_browser_webkit" dir="ltr" lang="en" role="application" aria-labelledby="cke_comment_arialbl" style="width: 99.8%;"><span id="cke_comment_arialbl" class="cke_voice_label">Rich Text Editor, comment</span><div class="cke_inner cke_reset" role="presentation"><span id="cke_1_top" class="cke_top cke_reset_all" role="presentation" style="height: auto; user-select: none;"><span id="cke_12" class="cke_voice_label">Editor toolbars</span><span id="cke_1_toolbox" class="cke_toolbox" role="group" aria-labelledby="cke_12" onmousedown="return false;"></span></span><div id="cke_1_contents" class="cke_contents cke_reset" role="presentation" style="height: 200px;"><span id="cke_16" class="cke_voice_label">Press ALT 0 for help</span><iframe src="" frameborder="0" class="cke_wysiwyg_frame cke_reset" title="Rich Text Editor, comment" aria-describedby="cke_16" tabindex="0" allowtransparency="true" style="width: 439px; height: 100%;"></iframe></div></div></div>
<input type="hidden" name="bid" id="bid_id" value="1035">
</div>
</div>
<div class="row" style="margin-top: 10px;">
<div class="col s6">
<p style="margin: 5px 0 0;">
<input type="checkbox" name="is_copy" id="is_copy" value="1">
<label for="is_copy">Send me a copy</label>
</p>
</div>
<div class="col s6">
<span class="right remainingLimit" id="comment_label" data-length="2500">Remaining: 2500</span>
</div>
</div>
<div class="row">
<div class="col s12">
<p class="defaultP">
If you like to remove a bid you can do that by
sending the request to the seller. Please make
sure that you state the reason for doing this.
Obvious accidents by using the wrong value are
easy to justify.
Please note that it is up to the seller to accept
or decline your request!
</p>
</div>
</div>
<div class="row">
<div class="col s12 center" style="margin: 20px 0 15px;">
<button class="transParentBtnSmall">Submit</button>
</div>
</div>
</form>
</div>
</div>

Why my custom report header is showing in html but not in pdf in Odoo v10?

I have created a custom report which inherits sale.report_saleorder and I am trying to add custom header.
<openerp>
<data>
<template id="report_saleorder_inherit" inherit_id="sale.report_saleorder">
<xpath expr="t" position="before">
<div class="head_wrap">
<div class="row">
<div class="col-xs-3">
<img t-if="res_company.logo" t-att-src="'data:image/png;base64,%s' %res_company.logo"
style="max-height: 45px;" />
</div>
<div class="col-xs-9 text-right" style="margin-top:20px;"
t-field="res_company.rml_header1" />
</div>
<div class="row zero_min_height">
<div class="col-xs-12">
<div style="border-bottom: 1px solid black;"></div>
</div>
</div>
<div class="row">
<div class="col-xs-6" name="company_address">
<span t-field="res_company.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}'
style="border-bottom: 1px solid black; display:inline-block;" />
</div>
</div>
</div>
</xpath>
</template>
</data>
</openerp>
When I select report format as 'HTML', it is working without any problem. But when I print it as 'PDF', it doesn't render my header. Is there a solution for this? How can I print report with my header?
If you want to use a custom header you must inherit the report.external_layout_header, this one:
<t t-name="report.external_layout_header">
<div class="header">
<div class="row">
<div class="col-xs-3">
<img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
</div>
<div class="col-xs-9 text-right" style="margin-top:20px;" t-field="company.rml_header1"/>
</div>
<div class="row zero_min_height">
<div class="col-xs-12">
<div style="border-bottom: 1px solid black;"/>
</div>
</div>
<div class="row">
<div class="col-xs-5">
<div t-field="company.partner_id" t-field-options="{"widget": "contact", "fields": ["address", "name"], "no_marker": true}" style="border-bottom: 1px solid black;" class="pull-left"/>
</div>
</div>
</div>
</t>
So, you should inherit the header like this:
<openerp>
<data>
<template id="custom_external_layout_header" inherit_id="report.external_layout_header">
<!-- [...] -->
</template>
</data>
</openerp>
Put your custom header inside <div class="header">
Eg :
<div class="header">
<span>hi</span>
<div>
1. sudo apt-get remove wkhtmltopdf --purge
2. sudo wget
https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
3. sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
4. sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
5. sudo cp /usr/local/bin/wkhtmltoimage /usr/bin

How to display the company header only on the first page?

i want to show the company reportheader only on the first page.I have now beautifull qweb report in PDF. But if my reports (sale order, for example) have more than one page, the header is on EACH page.
How to put company header only on the first page?
Thanks,
Header is only displayed once, in first page.report. The others are empty
<template id="report_quotation_header" inherit_id="report.external_layout_header">
<xpath expr="//div[#class='header']" position="replace">
<div class="header">
<t t-set="data_report_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>
<div class="row">
<div class="col-xs-3" name="company_address">
<div t-field="company.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}'
style="border-bottom: 1px solid black;"/>
</div>
</div>
</div>
</xpath>
</template> <!-- end teamplate header-->
Call your header inside page div. This will print header only on first page of qweb report in odoo
in odoo 10 I have done this as follows:
<template id="custom_report_header" inherit_id="report.external_layout_header" primary="True">
<xpath expr="//div[#class='header']" position="replace">
<div class="header">
<div class="row">
<div class="col-xs-3">
<img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
</div>
<div class="col-xs-9 text-right" style="margin-top:20px;" t-field="company.rml_header1"/>
</div>
<div class="row zero_min_height">
<div class="col-xs-12">
<div style="border-bottom: 1px solid black;"></div>
</div>
</div>
</div>
</xpath>
</template>
<template id="your_custom_header_id" inherit_id="report.external_layout" primary="True">
<xpath expr="//t[#t-call='report.external_layout_header']" position="replace">
<t t-call="your_module_name.custom_report_header" />
</xpath>
</template>
<template id="your_report_name"
<t t-call="report.html_container">
<div class="page">
<t t-call="your_module_name.your_custom_header_id">
</t>
....
</div>
</t>
</template>
pramod24
You can use the OCA App Report Qweb Element Page Visibility.
You can use this class first-page shows an element only on the first page.
Thanks

How to display an image in a QWeb report?

I extended the 'report.external_layout_footer' qweb view to display image.
Below is my code in the file reports/external_layout.xml:
<template id="report_footer_custom" inherit_id="report.external_layout_footer">
<xpath expr="//div[#class='footer']" position="replace">
<div class="footer">
<img t-att-src="'data:image/jpeg;base64,/var/www/cbl_openerp/openerp/cap_addons/cap_sale/img/footer.jpeg'"/>
<ul class="list-inline">
<li>Page:</li>
<li>
<span class="page"/>
</li>
<li>/</li>
<li>
<span class="topage"/>
</li>
</ul>
</div>
</xpath>
</template>
And here is my openerp.py content :
...
"depends": ["base","sale","report"],
...
"data": ['sale.xml',
'reports/reports.xml',
'reports/external_layout.xml',
'reports/informations_prestation.xml',
'views/product_template.xml',
'filter.xml'],
...
"images":['img/footer.jpeg',],
...
But when I print a sale order, i can't view my image at the bottom of the page.
Does anyone have any suggestions?
Just try this below code and set the image path from your module and run it .
<template id="report_footer_custom"inherit_id="report.external_layout_footer">
<xpath expr="//div[#class='footer']" position="replace">
<div class="footer">
<img class="img img-responsive" src="/sale_order_report/static/src/img/header.jpg"/>
<ul class="list-inline">
<li>Page:</li>
<li><span class="page"/></li>
<li>/</li>
<li><span class="topage"/></li>
</ul>
</div>
</xpath>
</template>
My side its working fine in the QWeb Report Custom Footer
In case you want to use an image that isn't static, here's what you can do instead.
Using the company logo as an example:
<img
t-attf-src="data:image/*;base64,{{company.logo}}"
t-att-alt="company.name"
/>
Using the mime type "image/*" will let you use different format of image and not just jpeg or just png.
Then as odoo render by default binary data as base64, you can simply append the content of the image after base64,.
The following snippet also works for QWeb reports (Odoo v10).
<span t-field="o.product_id.image_medium" t-field-options="{'widget': 'image'}"/>
...where o.product_id.image_medium is a dynamic field.
This is for anyone working with odoo12 or an approximate version. The reports module is web and not report. Odoo introduced styled reports and this snippet extends each one of them.
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<data noupdate="0">
<!-- The external layout background header -->
<template id="external_layout_background_inherit" inherit_id="web.external_layout_background">
<xpath expr="//div[#class='header']" position="replace">
<div class="header">
<div class="o_background_header">
<div class="row" style="width: 100%; margin: 0 auto;">
<img src="extend_layout/static/src/img/header.jpg" style="width:100%;" />
</div>
</div>
</div>
</xpath>
</template>
<!-- The external layout boxed header -->
<template id="external_layout_boxed_inherit" inherit_id="web.external_layout_boxed">
<xpath expr="//div[#class='header']" position="replace">
<div class="header">
<div class="o_boxed_header">
<div class="row" style="width: 100%; margin: 0 auto;">
<img src="extend_layout/static/src/img/header.jpg" style="width:100%;" />
</div>
</div>
</div>
</xpath>
</template>
<!-- The external layout clean header -->
<template id="external_layout_clean_inherit" inherit_id="web.external_layout_clean">
<xpath expr="//div[#class='header']" position="replace">
<div class="header">
<div class="o_clean_header">
<div class="row" style="width: 100%; margin: 0 auto;">
<img src="extend_layout/static/src/img/header.jpg" style="width:100%;" />
</div>
</div>
</div>
</xpath>
</template>
<!-- The external layout standad header -->
<template id="external_layout_standard_inherit" inherit_id="web.external_layout_standard">
<xpath expr="//div[#class='header']" position="replace">
<div class="header">
<div class="row" style="width: 100%; margin: 0 auto;">
<img src="extend_layout/static/src/img/header.jpg" style="width:100%;" />
</div>
</div>
</xpath>
</template>
<!-- Remove company address from the reports -->
<template id="address_layout_inherit" inherit_id="web.address_layout">
<xpath expr="//div[#class='address row']" position="replace">
<div style="height: 50px;"></div>
</xpath>
</template>
</data>
</odoo>