<template id="report_label">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<div class="page">
<div class="row">
<div class="example_class">
<t t-esc="o.name" />
<t t-esc="o.type" />
<p>Size: <span t-esc="o.calculate_size()"/></p>
<p>Color: <span t-esc ="o.calculate_color()" /></p>
<p>Price: </p>
<tr><td colspan="2"><img t-att-src="'/report/barcode/Code128/%s' % 'test-0001'" style="width:100%;height:25px"/> </td></tr>
</div>
</div>
</div>
</t>
</t>
</template>
this is my template and for some reason, barcode is not showing up.
if I test in http://localhost:8069/report/barcode/Code128/test-0001 then it returns me a barcode.
and reportlab is also installed.
same result but smaller borders with
<img t-if="o.barcode" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' %('Code128',o.barcode,250,50)"/>
is Settings > System Parameters need to change
Key report.url
Value http://0.0.0.0:8069
Related
I create template in module labs.
<template id="worbook_employee_miss_message">
<t t-if="time_research">
<div>
<span style="color: red">test</span>
</div>
</t>
</template>
I call it in formview
<t t-call="labs.worbook_employee_miss_message">
<t t-set="time_research" t-value="time_research"/>
</t>
But there is no block div on form. time_research field is not empty.
I tried your code and it's ok. Be sure to call the template inside a
<div class="page">
</div>
I am working with qweb reports in odoo 10 . Here is what i did
<odoo>
<template id="report_customer">
<t t-call="report.html_container">
<t t-set="data_report_margin_top" t-value="50"/>
<t t-foreach="range(5)" t-as="1">
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<div class="page example-css-class">
<h2>Report title</h2>
<p>This object's name is
<span t-field="o.full_name"/>
</p>
<ul class="list-inline">
<li>Page:</li>
<li><span class="page"/></li>
<li>/</li>
<li><span class="topage"/></li>
</ul>
</div>
</t>
</t>
</t>
</t>
</template>
</odoo>
and i also tried this
<odoo>
<template id="report_customer">
<t t-call="report.html_container">
<t t-set="data_report_margin_top" t-value="50"/>
<t t-foreach="range(5)" t-as="1">
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<div class="page example-css-class">
<h2>Report title</h2>
<p>This object's name is
<span t-field="o.full_name"/>
</p>
<div class="footer" style="text-align: center !important;">
Page <span class="page"/> of <span class="topage"/>
</div>
</div>
</t>
</t>
</t>
</t>
</template>
</odoo>
but in both cases i am not able to see page numbers. I also tried adding custom header and footer in separate templates but that also doesn't work.
Try this :
<div class="footer">
<div class="row">
<center><span>Page </span><span class="page" /> of <span class="topage" /></center>
</div>
</div>
It works perfectly for me.
Note : I have used without calling report.external_layout
Please try this code for page number in Qweb-report. It will automatically display page no.
<t t-call="report.external_layout"></t>
Go to Accounting => Accounting Dashboard => click on Reconcile button
We get below Qweb view.
In that Qweb view, How can we hide "Automatic reconciliation" button ?
I have tried following but didn't work:
<templates xml:space="preserve">
<!-- 1st try -->
<t t-name="automatic_reconciliation_1st" t-extend="reconciliation">
<t t-jquery=".btn" t-operation="replace"></t>
</t>
<!-- 2nd try -->
<t t-name="automatic_reconciliation_2nd" t-extend="reconciliation">
<t t-jquery=".js_automatic_reconciliation" t-operation="replace"></t>
</t>
<!-- 3rd try -->
<t t-name="automatic_reconciliation_3rd" t-extend="reconciliation">
<t t-jquery=".oe_form_sheet oe_form_sheet_width o_form_sheet" t-operation="replace">
<div class="oe_form_sheet oe_form_sheet_width o_form_sheet">
<h1><t t-esc="title"/></h1>
<div t-if="! hide_progress" class="progress progress-striped">
<div class="progress-text"><span class="valuenow">0</span> / <span class="valuemax"><t t-esc="total_lines"/></span></div>
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" t-att-aria-valuemax="total_lines" style="width: 0%;">
</div>
</div>
<div class="oe_clear o_clear"></div>
<div class="notification_area"></div>
<div class="interface_options oe_form o_form"></div>
<div class="reconciliation_lines_container"></div>
<div class="show_more_container"><button class="show_more btn btn-default btn-sm">Show more... (<span class="num_items_remaining"></span> remaining)</button></div>
<p class="o_protip text-muted" align="right">Tip: Hit CTRL-Enter to reconcile all the balanced items in the sheet.</p>
</div>
</t>
</t>
</templates>
Try this .
<t t-name="account.reconciliation">
<div class="o_form_view"><div class="oe_form_sheetbg o_form_sheet_bg"><div class="oe_form_sheet oe_form_sheet_width o_form_sheet">
<h1><t t-esc="title"/></h1>
<div t-if="! hide_progress" class="progress progress-striped">
<div class="progress-text"><span class="valuenow">0</span> / <span class="valuemax"><t t-esc="total_lines"/></span></div>
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" t-att-aria-valuemax="total_lines" style="width: 0%;">
</div>
</div>
<div class="oe_clear clearer"></div>
<div class="notification_area"></div>
<div class="interface_options oe_form o_form"></div>
<div class="reconciliation_lines_container"></div>
<div class="show_more_container"><button class="show_more btn btn-default btn-sm">Show more... (<span class="num_items_remaining"></span> remaining)</button></div>
<p class="o_protip text-muted" align="right">Tip: Hit CTRL-Enter to reconcile all the balanced items in the sheet.</p>
</div></div></div>
</t>
Alternative solution:
.js_automatic_reconciliation { display:none; }
I want add a link for download a demo file, in the template base_import. The original template is it as show below:
<t t-name="ImportView">
<t t-set="_id" t-value="_.uniqueId('export')"/>
<form action="" method="post" enctype="multipart/form-data" class="oe_import">
<input type="hidden" name="csrf_token" t-att-value="csrf_token"/>
<input type="hidden" name="session_id"
t-att-value="widget.session.session_id"/>
<input type="hidden" name="import_id"/>
<div class="oe_import_box col-sm-9">
<div class="col-sm-12">
<p>Select a CSV or Excel file to import. Help</p>
</div>
<div class="col-sm-10">
<div class="input-group">
<input type="text" class="oe_import_file_show form-control" placeholder="No file chosen..."/>
<span class="input-group-btn">
<label class="btn btn-primary" for="my-file-selector">
<input accept=".csv, .xls, .xlsx, .ods" id-attf-id="file_#{_id}"
name="file" id="my-file-selector" class="oe_import_file" type="file" style="display:none;"/>
Load File
</label>
</span>
<span class="input-group-btn">
<button type="button" class="btn btn-default oe_import_file_reload" disabled="disabled">Reload File</button>
</span>
</div>
</div>
<!-- More code -->
</div>
</form>
</t>
The code that i write for link add is:
<t t-name="BaseImportCustom" t-extend="ImportView">
<t t-jquery="form.oe_import" t-operation="append">
<p>Download Demo</p>
</t>
</t>
but this not show the link, Somebody know because not work? or if exist another way of do this
First, could you double check if xml file was already declared in __manifest__.py of your new module ?
Second, You shouldn't add t-name="BaseImportCustom" in your extend view, i believe the issue comes from t-name="BaseImportCustom", you can search all xml files in Odoo with the key "t-extend" and notice that there is no case that"t-extend" exist with "t-name". I hope this is OK (not test yet)
<t t-extend="ImportView">
<t t-jquery="form.oe_import" t-operation="append">
<p>Download Demo</p>
</t>
</t>
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