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>
Related
here is the template that I use but the products are printed each on its page whereas I want the product to be printed on a page once the page is full that it continues on a new page
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="stock_view_report_template">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.external_layout">
<div class="page">
<h2>Stock actuel</h2>
<table class="table table-condensed">
<thead>
<tr>
<th>product</th>
<th>Quantity</th>
<th>Location</th>
<th>Owner</th>
<th>Lot</th>
<th>Incoming Date</th>
<th>Inventory Value</th>
</tr>
</thead>
<tbody>
<td><span t-field="o.product_id.name"/></td>
<td><span t-field="o.qty"/></td>
<td><span t-field="o.location_id.name"/></td>
<td><span t-field="o.owner_id"/></td>
<td><span t-field="o.lot_id"/></td>
<td><span t-field="o.in_date"/></td>
<td><span t-field="o.inventory_value"/></td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</t>
</template>
</data>
</openerp>
odoo users.
This is part of my Qweb report:
<table class="table-metal">
<thead>
<tr>
<th style="text-transform: none;width:20%">Name</th>
<th style="text-transform: none;width:30%">Width</th>
<th style="text-transform: none;width:20%">Mark</th>
<th style="text-transform: none;width:20%">Standard</th>
<th style="text-transform: none;width:10%">Number</th>
</tr>
</thead>
<tbody>
<t t-set="node_name_value" t-value="noname"/>
<t t-foreach="doc.passport_metal_ids" t-as="metal_ids">
<tr>
<t t-if="metal_ids.product_name.name != node_name_value">
<t t-set="count" t-value="doc.get_count_row(metal_ids.product_name.name)"/>
<td valign="top" t-att-rowspan="count"><span t-field="metal_ids.product_name.name" /></td>
</t>
<t t-if="metal_ids.brand_id.name[0] == 'S'">
<td>Лист S=<span t-esc="metal_ids.size_id.name.split('x')[0]" /></td>
</t>
<t t-else="">
<td>Лист B-PN-0 S=<span t-esc="metal_ids.size_id.name.split('x')[0]" /><br></br>ГОСТ 19903-74 </td>
</t>
<td><span t-field="metal_ids.brand_id.name" /></td>
<td><span t-field="metal_ids.gost_id.name" /></td>
<td><span t-field="metal_ids.certificate" /></td>
<t t-set="node_name_value" t-value="metal_ids.product_name.name"/>
</tr>
</t>
</tbody>
<tfoot>
<tr>
<td colspan="5"></td>
</tr>
</tfoot>
</table>
<p style="page-break-after:always;"></p>
Because of the dynamic column:
<td valign="top" t-att-rowspan="count"><span t-field="metal_ids.product_name.name" /></td>
I get the following:
I added , but it did not help
Table columns are out of bounds. How to fix it?
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.
<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.
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>