Separador de miles en un t-set para reportes QWeb

388 views
Skip to first unread message

Camilo Ramirez

unread,
Nov 10, 2015, 10:23:45 AM11/10/15
to Usuarios Odoo / OpenERP en España
Buenas a todos.
Tengo un reporte en QWeb 
Donde declaro unas variables para hacer unos calculo e imprimirlos.
Y necesito que esos resultados me impriman con los separadores de miles correspondiente
Este es el codigo que utilizo 

<table height="110px">
    <t t-set="valor_exenta" t-value="0"/>
    <t t-set="valor_5" t-value="0"/>
    <t t-set="valor_10" t-value="0"/>
    <tr t-foreach="o.invoice_line" t-as="l">
        <td width="150px">
            <span t-field="l.product_id.default_code"/>
        </td>
        <td width="140px">
            <span t-esc="'%.0f'%l.quantity"/> <!--IMPRIME VALORES SIN DECIMALES-->
        </td>
        <td width="620px">
            <span t-field="l.product_id.name"/>
        </td>
        <td width="100px">
            <span t-esc="'%.0f'%l.price_unit"/> <!--IMPRIME VALORES SIN DECIMALES-->
        </td>
        <td width="100px">
            <span t-if="'IVA 5%' not in [ilt.name for ilt in l.invoice_line_tax_id] and 'IVA 10%' not in [ilt.name for ilt in l.invoice_line_tax_id]">
                <span t-esc="'%.0f'%l.price_subtotal"/></span>
        </td>
        <td width="180px">
            <span t-if="'IVA 5%' in [ilt.name for ilt in l.invoice_line_tax_id] and 'IVA 10%' not in [ilt.name for ilt in l.invoice_line_tax_id]">
                <span t-esc="l.quantity * l.price_unit">
                    <span t-value="valor_5+(l.quantity * l.price_unit)"/></span>
            </span>
        </td>
        <td width="100px">
            <span t-if="'IVA 10%' in [ilt.name for ilt in l.invoice_line_tax_id]">
                <span t-esc="l.quantity * l.price_unit" >
                    <span t-value="valor_10+(l.quantity * l.price_unit)"/></span>
            </span>
        </td>
    </tr>
</table>

En los campos "t-field" si me imprimen los separadores de miles (Ya que lo pongo en el idioma "Separator Format [3,3,3,3,3,3,3,2]")
Pero donde son de tipo "
t-esc" y "t-value" no lo hacen.
Como podria hacer que me salgan los separadores en ellos?

Desde ya muchas gracias.

cubells

unread,
Nov 11, 2015, 4:32:45 AM11/11/15
to openerp-s...@googlegroups.com
El 10/11/15 a les 16:23, Camilo Ramirez ha escrit:
> Buenas a todos.
> Tengo un reporte en QWeb
> Donde declaro unas variables para hacer unos calculo e imprimirlos.
> Y necesito que esos resultados me impriman con los separadores de miles
> correspondiente
> Este es el codigo que utilizo
> |
>
> En los campos "t-field" si me imprimen los separadores de miles (Ya que
> lo pongo en el idioma "Separator Format [3,3,3,3,3,3,3,2]")
> Pero donde son de tipo "t-esc" y "t-value" no lo hacen.
> Como podria hacer que me salgan los separadores en ellos?


cubells@portatil:~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> format(123456789.45, ",")
'123,456,789.45'

--
Atentament, cubells.
--
Reply all
Reply to author
Forward
0 new messages